Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6677 Discussions

MKL PARDISO crashes when run in parallel

Rylan1
Novice
350 Views

Hi, I'm developing code based on matlab, and this code is accelerated with mex function.

In the mex function, I have multiple linear system, Ax = b, to be solved, with A the sparse matrix stored in CSC format.  Of course, I know MKL PARDISO can run in parallel by directly setting variable MKL_DOMAIN_PARDISO.  However,  in my case, since multiple linear systems are to be solved, I want to set the thread for all MKL part to be one, while the assembly of the sparse matrix A and the call of MKL PARDISO run in parallel.

Since this code is a little complex, I just show the sketch here,

 mkl_set_num_threads(thread);

#pragma omp parallel for num_threads(THREADS)  

for(  int i=0; i<Ele2d;i++)

{

    Stage one: Assemble the sparse matrix A

    Stage two: Call MKL PARDISO to solve this linear system follow the example provided in file pardiso_unsym.c in the example folder.

}

This program can run in serial mode, while crashes in parallel mode.  The stack trace is as follows,

Capture.PNG

And the compile commands are as follows,

thread = 6;
mex('-v',['COMPFLAGS=$COMPFLAGS /openmp -DTHREADS=', num2str(thread)], ['LDFLAGS=$LDFLAGS /openmp'], '-largeArrayDims',...
'-ID:\Software\Intel\Install\mkl\2022.0.0\include', '-ID:\PhdResearch\NdgMath', '-LD:\Software\Intel\Install\mkl\2022.0.0\lib\intel64',...
'-lmkl_intel_lp64_dll.lib', '-lmkl_core_dll.lib', '-lmkl_intel_thread_dll.lib', ...
'mxSparseVersionUpdateImplicitRHS.c','D:\PhdResearch\NdgMath\NdgMemory.c','mxImplicitVerticalEddyViscosity.c')

What may cause this? Thanks in advance

0 Kudos
1 Solution
Rylan1
Novice
330 Views

Acctually, I have just sorted this out.

In my case, the pattern of A is fixed, i.e., both 'ia' and 'ja' are fixed.  So I store them as public data such that they can be fetched by each thread during the computation.

Tests indicate that this is not doable, and I have to set both 'ia' and 'ja' for each thread independently.

 

View solution in original post

5 Replies
Rylan1
Novice
348 Views

There is a mistake in the post, I set the global thread for MKL part to be one, i.e.

 mkl_set_num_threads(1);

Rylan1
Novice
331 Views

Acctually, I have just sorted this out.

In my case, the pattern of A is fixed, i.e., both 'ia' and 'ja' are fixed.  So I store them as public data such that they can be fetched by each thread during the computation.

Tests indicate that this is not doable, and I have to set both 'ia' and 'ja' for each thread independently.

 

ShanmukhS_Intel
Moderator
315 Views

Hi,

 

Thank you for sharing the information and posting on Intel Communities.

 

>>Actually, I have just sorted this out. In my case, the pattern of A is fixed, i.e., both 'ia' and 'ja' are fixed. So I store them as public data such that they can be fetched by each thread during the computation.

 

Glad to know that your issue is resolved. Could you please let us know if we could close this thread at our end.

 

Best Regards,

Shanmukh.SS

 

Rylan1
Novice
306 Views
ShanmukhS_Intel
Moderator
295 Views

Hi,


Glad to know that your issue is resolved. Thanks for sharing the solution with us. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.


Best Regards,

Shanmukh.SS


Reply