Calling Pardiso in parallel loop

Calling Pardiso in parallel loop


I am using Pardiso for a little while and I am happy with it. It works fine in parallel and I can use all the cores on my machine. Recently I wanted to call pardiso in a for loop to solve different equation systems. The for loop itself is parllelized using openmp (#pragma omp parallel). Now the problem is wheh I call pardiso in this loop it only runs with one single core! The code is as the following 


njbs = 8;

nthr = 6;
N is the number of equation systems

#pragma omp parallel for num_threads(njbs) schedule(dynamic,1)
      for (i=0; i<N; i++)

             B = get_equation _system_number(i); /* B is the handle to the corresponding equation system number i*/

             init(B); /*set all the pointers and corresponding parameters in B. set pt = 0 for this solver*/  

             B.iparm[2]=omp_get_max_threads(); /*B.iparm[2] is 6 now*/

             B->phase = 11;

             PARDISO (pt, &(B->maxfct), &(B->mnum), &(B->mtype), &(B->phase),
             &B->n,  B->a, B->ia, B->ja, &(B->idum), &(B->nrhs),    
             B->iparm, &(B->msglvl),&(B->ddum), &(B->ddum), &(B->error));


when msglvl is activated to show statistics, I get

< Parallel Direct Factorization with number of processors: > 1

Now the question is why does pardiso run in serial? Do I do something wrong or do I have missed something?

Best regards,


2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I have found the solution. mkl_set_dynamic(0) does the job.

Leave a Comment

Please sign in to add a comment. Not a member? Join today