# PETSc with Intel MKL and Pardiso on Windows

**URL:** <https://community.freefem.org/t/petsc-with-intel-mkl-and-pardiso-on-windows/1299>\
**Category:** FreeFEM installation\
**Created:** [November 4, 2021, 4:45pm UTC](https://community.freefem.org/t/petsc-with-intel-mkl-and-pardiso-on-windows/1299 "2021-11-04T16:45:19Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![hbu](https://avatars.discourse-cdn.com/v4/letter/h/6de8d8/32.png) [@hbu](https://community.freefem.org/u/hbu)\
**Post date:** [November 4, 2021, 4:45pm UTC](https://community.freefem.org/t/petsc-with-intel-mkl-and-pardiso-on-windows/1299/1 "2021-11-04T16:45:19Z")

</div>

I would like to compile PETSc under Windows with Intel MKL and Pardiso. I tried to run ./configure with --with-blaslapack-dir=’/c/PROGRA~2/Intel/oneAPI/mkl/latest’ --with-mkl\_pardiso-dir=’/c/PROGRA~2/Intel/oneAPI/mkl/latest’  
Unfortunately, this gave an error: “Could not find a functional BLAS. Run with --with-blas-lib= to indicate the library containing BLAS.”

Then, I tried --with-blaslapack-include=’’ --with-blaslapack-lib=’/c/PROGRA~2/Intel/oneAPI/mkl/latest/lib/intel64/mkl\_blas95\_lp64.lib’ (similar to --with-blaslapack-include=’’ --with-blaslapack-lib=’/mingw64/bin/libopenblas.dll’ which worked)  
This gave the following error: “You set a value for --with-blaslapack-lib=, but [’/c/PROGRA~2/Intel/oneAPI/mkl/latest/lib/intel64/mkl\_blas95\_lp64.lib’] cannot be used”

Any idea what I could do to use Intel MKL and Pardiso? Thank you!

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [November 4, 2021, 4:59pm UTC](https://community.freefem.org/t/petsc-with-intel-mkl-and-pardiso-on-windows/1299/2 "2021-11-04T16:59:23Z")

</div>

I think the easiest would be to compile PETSc with PARDISO, and then let FreeFEM pickup PETSc variables. I cannot test this because I don’t have oneAPI on Windows, but there are PETSc configure scripts available with this. Would that suit your needs?

---

<div class="post-metadata">

**Author:** ![hbu](https://avatars.discourse-cdn.com/v4/letter/h/6de8d8/32.png) [@hbu](https://community.freefem.org/u/hbu)\
**Post date:** [November 5, 2021, 8:14am UTC](https://community.freefem.org/t/petsc-with-intel-mkl-and-pardiso-on-windows/1299/3 "2021-11-05T08:14:29Z")

</div>

Sure! Where would I find those configure scripts? And will I have a working configure line for PETSc with MKL Pardiso on Windows in the end? Should I follow the windows install instructions to achieve this?

Thank you!

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [November 5, 2021, 8:19am UTC](https://community.freefem.org/t/petsc-with-intel-mkl-and-pardiso-on-windows/1299/4 "2021-11-05T08:19:06Z")

</div>

There is on here that you should be able to adapt I think: [config/examples/arch-ci-mswin-opt-impi.py · main · PETSc / petsc · GitLab](https://gitlab.com/petsc/petsc/-/blob/main/config/examples/arch-ci-mswin-opt-impi.py#L14). You’ll need to follow the installation prerequisites, with respect to the packages that you need to install on MinGW. Then, do `make petsc-slepc` in `3rdparty/ff-petsc`, but change in the configure line the `--with-blaslapack-lib` with the one you are seeing in PETSc repo.

---

<div class="post-metadata">

**Author:** ![hbu](https://avatars.discourse-cdn.com/v4/letter/h/6de8d8/32.png) [@hbu](https://community.freefem.org/u/hbu)\
**Post date:** [November 5, 2021, 9:37am UTC](https://community.freefem.org/t/petsc-with-intel-mkl-and-pardiso-on-windows/1299/5 "2021-11-05T09:37:52Z")

</div>

I am getting “You set a value for --with-blaslapack-lib=, but [’-L/c/PROGRA~2/INTEL/oneAPI/mkl/latest/lib/intel64/’, ‘mkl\_intel\_lp64\_dll.lib’, ‘mkl\_sequential\_dll.lib’, ‘mkl\_core\_dll.lib’] cannot be used”  
or  
You set a value for --with-blaslapack-lib=, but [’-L/e/Programme/ComposerXE2013SP1/mkl/lib/intel64’, ‘mkl\_intel\_lp64\_dll.lib’, ‘mkl\_sequential\_dll.lib’, ‘mkl\_core\_dll.lib’] cannot be used

The configure line you sent is for cygwin, right? Is it expected also to work under mingw64?

Where would I enter the modified configure line in 3rdparty/ff-petsc?

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [November 5, 2021, 11:35am UTC](https://community.freefem.org/t/petsc-with-intel-mkl-and-pardiso-on-windows/1299/6 "2021-11-05T11:35:09Z")

</div>

Could you please share your `configure.log`? Also, I’m seeing you posted a different issue on the `petsc-maint` mailing list. Do you need to use Visual Studio with FreeFEM, or would you be content sticking to MinGW?

---

<div class="post-metadata">

**Author:** ![hbu](https://avatars.discourse-cdn.com/v4/letter/h/6de8d8/32.png) [@hbu](https://community.freefem.org/u/hbu)\
**Post date:** [November 5, 2021, 12:07pm UTC](https://community.freefem.org/t/petsc-with-intel-mkl-and-pardiso-on-windows/1299/7 "2021-11-05T12:07:57Z")

</div>

Dear prj,  
I would like to use PETSc + Intel MKL Pardiso. I am not attached to either cygwin or MinGW. I contacted petsc-maint with the cygwin question, because that’s what they propose on their website. Just trying out different routes here.  
At least I got PETsc to work with MinGW using GNU compilers following the instructions on your website. However, only with OpenBlas and without PARDISO.

I cannot attach any documents (new user). Any other way to send you configure.log? Should I just post the full log?

Thank you!

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [November 5, 2021, 12:15pm UTC](https://community.freefem.org/t/petsc-with-intel-mkl-and-pardiso-on-windows/1299/8 "2021-11-05T12:15:19Z")

</div>

OK, if you don’t care about Visual Studio, it will be easier to stick to MinGW, I think. Can’t you upload the log somewhere and send me the link?

---

<div class="post-metadata">

**Author:** ![hbu](https://avatars.discourse-cdn.com/v4/letter/h/6de8d8/32.png) [@hbu](https://community.freefem.org/u/hbu)\
**Post date:** [November 5, 2021, 12:23pm UTC](https://community.freefem.org/t/petsc-with-intel-mkl-and-pardiso-on-windows/1299/9 "2021-11-05T12:23:17Z")

</div>

Sure (see [GigaMove 2.0](https://gigamove.rwth-aachen.de/de/download/85e112dbca1a072ddaf4704f0c7814e7)).

I am a little confused here. Will I be able to link to an existing Visual Studio 2019 project in the end with MinGW or not?

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [November 5, 2021, 12:32pm UTC](https://community.freefem.org/t/petsc-with-intel-mkl-and-pardiso-on-windows/1299/10 "2021-11-05T12:32:18Z")

</div>

What do you mean by “link”? FreeFEM can’t be “linked” (e.g., with a compile line) with other software.

---

<div class="post-metadata">

**Author:** ![hbu](https://avatars.discourse-cdn.com/v4/letter/h/6de8d8/32.png) [@hbu](https://community.freefem.org/u/hbu)\
**Post date:** [November 5, 2021, 12:39pm UTC](https://community.freefem.org/t/petsc-with-intel-mkl-and-pardiso-on-windows/1299/11 "2021-11-05T12:39:33Z")

</div>

Ok, I see. I thought there would be an easy way to use PETSc on Windows via FreeFEM from an existing project. And since you have a lot of experience with building PETSc on Windows, I thought this might be the place to ask.

Thank you!

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [November 5, 2021, 1:30pm UTC](https://community.freefem.org/t/petsc-with-intel-mkl-and-pardiso-on-windows/1299/12 "2021-11-05T13:30:52Z")

</div>

OK, if you are mostly interested about PETSc + Visual Studio, best to stick to the PETSc mailing list. I’m a developer there as well so I’ll help you if I can, though other developers are more used to Cygwin, so they’ll most likely do a better job than me.

---

<div class="post-metadata">

**Author:** ![hbu](https://avatars.discourse-cdn.com/v4/letter/h/6de8d8/32.png) [@hbu](https://community.freefem.org/u/hbu)\
**Post date:** [November 5, 2021, 1:44pm UTC](https://community.freefem.org/t/petsc-with-intel-mkl-and-pardiso-on-windows/1299/13 "2021-11-05T13:44:22Z")

</div>

Ok. I will stick to petsc-maint then, but will try both routes via cygwin and mingw. Thank you for your help!

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [November 5, 2021, 1:50pm UTC](https://community.freefem.org/t/petsc-with-intel-mkl-and-pardiso-on-windows/1299/14 "2021-11-05T13:50:08Z")

</div>

In MinGW, there is an issue with your option `--with-blaslapack-lib`. Maybe you could try: `--with-blaslapack-lib=[/e/FGH/Programme/ComposerXE2013SP1/mkl/lib/intel64/mkl_intel_lp64_dll.lib,/e/FGH/Programme/ComposerXE2013SP1/mkl/lib/intel64/mkl_sequential_dll.lib,/e/FGH/Programme/ComposerXE2013SP1/mkl/lib/intel64/mkl_core_dll.lib]`  
You’ll have to double check that these `.lib` exist (maybe it’s `libmkl_intel_lp64_dll.lib` & co. instead of simply `mkl_intel_lp64_dll.lib`?).

---

<div class="post-metadata">

**Author:** ![hbu](https://avatars.discourse-cdn.com/v4/letter/h/6de8d8/32.png) [@hbu](https://community.freefem.org/u/hbu)\
**Post date:** [November 5, 2021, 2:24pm UTC](https://community.freefem.org/t/petsc-with-intel-mkl-and-pardiso-on-windows/1299/15 "2021-11-05T14:24:23Z")

</div>

I double checked that these libraries exist. Unfortunately, I still get

```
     UNABLE to CONFIGURE with GIVEN OPTIONS (see configure.log for details):

```

* * *

You set a value for --with-blaslapack-lib=, but [’/e/FGH/Programme/ComposerXE2013SP1/mkl/lib/intel64/mkl\_intel\_lp64\_dll.lib’, ‘/e/FGH/Programme/ComposerXE2013SP1/mkl/lib/intel64/mkl\_sequential\_dll.lib’, ‘/e/FGH/Programme/ComposerXE2013SP1/mkl/lib/intel64/mkl\_core\_dll.lib’] cannot be used

(see [GigaMove 2.0](https://gigamove.rwth-aachen.de/de/download/2300ab3028c40d819706cf6245b54c42))

Thank you!

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [November 5, 2021, 2:35pm UTC](https://community.freefem.org/t/petsc-with-intel-mkl-and-pardiso-on-windows/1299/16 "2021-11-05T14:35:29Z")

</div>

I see

```auto
C:/Ruby30-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:/FGH/Programme/ComposerXE2013SP1/mkl/lib/intel64/mkl_intel_lp64_dll.lib(_dgetrs_lp64.obj):(.text[dgetrs]+0x1d): undefined reference to `__security_cookie'
C:/Ruby30-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:/FGH/Programme/ComposerXE2013SP1/mkl/lib/intel64/mkl_intel_lp64_dll.lib(_dgetrs_lp64.obj):(.text[dgetrs]+0xd4): undefined reference to `__security_check_cookie'
C:/Ruby30-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:/FGH/Programme/ComposerXE2013SP1/mkl/lib/intel64/mkl_intel_lp64_dll.lib(_dgetrs_lp64.obj):(.text[dgetrs]+0x187): undefined reference to `__security_check_cookie'
C:/Ruby30-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:/FGH/Programme/ComposerXE2013SP1/mkl/lib/intel64/mkl_intel_lp64_dll.lib(_dgetrs_lp64.obj):(.xdata+0x10): undefined reference to `__GSHandlerCheck'

```

So it looks like it’s not possible to link a code compiled with Intel toolchain and one compiled with MinGW toolchain…

---

<div class="post-metadata">

**Author:** ![hbu](https://avatars.discourse-cdn.com/v4/letter/h/6de8d8/32.png) [@hbu](https://community.freefem.org/u/hbu)\
**Post date:** [November 8, 2021, 8:53am UTC](https://community.freefem.org/t/petsc-with-intel-mkl-and-pardiso-on-windows/1299/17 "2021-11-08T08:53:40Z")

</div>

I managed to build with Cygwin and the following configure line:

./configure --with-debugging=0 --with-cxx-dialect=C++11 --with-shared-libraries=0 --with-cc=“win32fe cl” --with-cxx=“win32fe cl” --with-fc=“win32fe ifort” --with-mpi-lib="-L/cygdrive/c/MSMPI/MPI/lib/x64 msmpifec.lib msmpi.lib" --with-mpi-include="[/cygdrive/c/MSMPI/MPI/Include,/cygdrive/c/MSMPI/MPI/Include/x64]" --with-scalar-type=real --with-mpiexec=/cygdrive/c/MSMPI/Bin/mpiexec.exe --with-mkl\_pardiso-dir=/cygdrive/c/Intel/oneAPI/mkl/latest/ --with-blaslapack-dir=/cygdrive/c/Intel/oneAPI/mkl/latest/

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [November 8, 2021, 11:49am UTC](https://community.freefem.org/t/petsc-with-intel-mkl-and-pardiso-on-windows/1299/18 "2021-11-08T11:49:36Z")

</div>

I see you are using the same compilers then, so it’s expected to work indeed. Glad you got that straightened out.
