PETSc with Intel MKL and Pardiso on Windows

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!

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?

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!

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. 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.

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?

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?

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!

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?

Sure (see GigaMove 2.0).

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?

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

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!

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.

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

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?).

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)

Thank you!

I see

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…

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/

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