MKL DSS solver problem in multithread application

MKL DSS solver problem in multithread application


Hello to all, I'm new to this forum and I got a question on the MKL dss.

I'm currently working on a finite element program I wrote by myself. Every time the program is called, there are two systems of equations to be solved. The system solved at first ist the same system solved in the last iteration increment at the end. So the idea is to store the factorized matrix and not delete it at the

end of the program. This needs a lot of memory, but is way faster. My program is already working with one thread, but I like to performe multithread computations. For solvinig I use the Intel MKL DSS solver. My ifort Version is 11.0 (which is very old I know).

Now the Problem is, when the Program runs with multiple threads, it produces an illegal memory reference type error the first time the not deleted factorized matrix is accessed again. Do you have an idea where this could come frome? I thought Intel MKL would be thread safe? It should be said, that it is possible that one thread factorizes the matrix and then another thread uses this stored matrix (in theory, but not working this way). Do you have an idea?

best regards

Nils Lange

5 posts / 0 new

Hello Nils,

You've described a complicated workflow. Ideally, for fast investigation, we'd like to get a reproducer which has a similar workflow and (not necesssarily but) maybe a toy matrix (say, from one of our example) for simplicity. 

General comments:
1) I am not sure I got your threading model from the description. Again, an example or at least a pseudocode would help.
2) I do not recommend using DSS interface, I always suggest using PARDISO. DSS interface has limited scope which sometimes may lead to confusion and is not any simpler in my opinion than regular PARDISO. Avoid using it as much as you can.
3) I would like to assure you that MKL is thread safe in your case but since you observe an issue, I'd better double check.

Best,
Kirill


Hello Kirill,

thanks for the fast reply. The problem is, my program has already around 2000 lines of code, then maybe more 1500 lines of code I only took from my institute, maybe 1500 lines of code in Python Preprocessing and then my program is called from abaqus, a commercial FE Program. I think its not possible to bring it to a small pseudocode, I'm sorry.

But here whats working: I can run Abaqus in multithread mode and then in each thread (each thread computation is compleatly separated) I go through the hole process (dss_create...dss_factor_real...DSS_DELETE) and its working. Whats also working is that in a single thread computation I can save the factorized matrix by NOT calling DSS_DELETE at the end, and when my programm is called again from abaqus I do handle%dummy=pointer (where pointer is the Integer Number I saved) and it's working (lets say I have 1000 not deleted matrixes and I save all the pointers).

But this method is not working in a multithread computation. It can be assured from my side, that the saved and not deleted factorized matrix is only accessed from one thread at a time. Still I get a memory reference error.

Best regards

Nils Lange


Hello Nils,

I understand that. Based on your description, I imagine the following pseudocode:

#pragma omp parallel num_threads(2)
{
     myid = thread_index // 0 or 1
    // setting up parameters for PARDISO (or DSS)
    if (myid == 0)
        pardiso(phase=12); // reordering and factorization
    omp_barrier  
    if (myid == 1)
        pardiso(phase=33); // solve, causes seg fault?
}

Is this correct?

Best,
Kirill


Hello Kirill,

I'm working in Fortran and it looks like C++ but still I think thats not exactly what I'm doing. My programm is executed in multiple threads completely seperated from each other. A Pseudocode would maybe look like this:

(executed in multiple threads but with DIFFERENT ID's)

 

program pseudocode

....

if (beginning of analysis) then

error=dss_create(handle,...)

pointer_array(ID)=handle%dummy

end if

if (middle of analysis) then

handle%dummy=pointer_array(ID)

end if

error=dss_factor_real(handle,...)

if (end of program) then

error=DSS_DELETE(handle)

end if

......

end program pseudocode

 

I hope you can see my point, it's really a bit complex and not that easy to explain.

 

Best regards

Nils Lange

Leave a Comment

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