MATLAB Answers

How to install pardiso on matlab with `pthread` on windows?

16 views (last 30 days)
wei zhang
wei zhang on 30 Jun 2020
Commented: wei zhang on 11 Jul 2020
I am trying to use PARDISO in Matlab on windows. I notice that some compile options may not availible for windows system. This is my building script for pardisofree.mexw64 as an example.
mex -largeArrayDims -lpardiso -lmwlapack -lmwblas ...
-LD:\IntelSWTools\parallel_studio_xe_2019.0.045\compilers_and_libraries_2019\windows\compiler\lib\intel64_win -lifcoremt ...
-LD:\zw\matlab\PARDISO\pthreads-w32-2-9-1-release\Pre-built.2\lib\x64 -lpthread ...
-lm -output pardisofree ...
common.cpp matlabmatrix.cpp sparsematrix.cpp pardisoinfo.cpp pardisofree.cpp
I have installed the intel parallel XE to get the windows version of gfortran, as lifcoremt.lib.
I also download pthread for windows version from sourceforge https://sourceforge.net/projects/pthreads4w/
So the command above runs ok for me. But I still have any way to activate the multithreads. I got no examples for that. How to build a matlab file to check it? Do I need to compile OPENMP into it? Any suggestion would be appreciated. I am really confused in this process.

  11 Comments

Show 8 older comments
wei zhang
wei zhang on 8 Jul 2020
@Jeremy Hu I also tryied to add "openmp" into compile. This my entire build code for all the files. You may need this.
filename = {'pardisoinit.cpp','pardisoreorder.cpp','pardisofactor.cpp','pardisosolve.cpp','pardisofree.cpp'};
intel_lib_path = '-LD:\IntelSWTools\parallel_studio_xe_2019.0.045\compilers_and_libraries_2019\windows\compiler\lib\intel64_win';
pthread_lib_path = '-LD:\zw\matlab\PARDISO\pthreads-w32-2-9-1-release\Pre-built.2\lib\x64';
for i=1:length(filename)
mex('COMPFLAGS="$COMPFLAGS /openmp"',...
'-largeArrayDims','-lpardiso','-lmwlapack',...
intel_lib_path,'-lifcoremt','-liomp5md',...
pthread_lib_path,'-lpthread',...
'-lm', '-output',filename{i},...
'common.cpp', 'matlabmatrix.cpp', 'sparsematrix.cpp', 'pardisoinfo.cpp', filename{i})
end
Unfortunately, Matlab still crash when I set the iparm[2] = 2 in the pardisoinfo.cpp, no matter before or after pardisoinit_ line. If I set the iparm[2] = 1, I could run the example m file welll. I guess the problem may from OMP_NUM_THREADS. But I don't know how to set it up.
Jeremy Hu
Jeremy Hu on 11 Jul 2020
@Wei Zhang, Thank you! I wasn't able to move past compilation unfortunately, so I don't know how to set up the OMP_NUM_THREADS either. Maybe you can use loadlibrary instead of MEX.
wei zhang
wei zhang on 11 Jul 2020
@Jeremy Hu What do you mean by "move past compilation"? Try clear functions to remove the mex in memory.

Sign in to comment.

Answers (0)

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!