- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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,
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
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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.
Lien copié
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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);
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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
- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable