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

openmp & mkl: getri inside $omp do trouble

teanku
Beginner
778 Views

Hello!

I'm using IVF Compiler 11.0.066 and MKL 10.1

So, I have this subroutine which is called from parallel $omp do cycle. In this subroutine I calculate inverse of a matrix, like this:

    call getrf(Matrix, ipiv)
    call getri(Matrix, ipiv)
 

everything works great in sequential execution, but when there are more than one thread application crashes at call getri(Matrix, ipiv) with exceptions like "heap corruption" or "access violation"

when I modify this code like this:

    call getrf(Matrix, ipiv)
    !$omp critical
    call getri(Matrix, ipiv)
    !$omp end critical

everything works in parallel execution, but obviously this is a bad solution

why this is happening and how should I change my code to make it work without $critical section?

0 Kudos
5 Replies
teanku
Beginner
778 Views

and the save problem with syevd, which I need to calculate eigenvalues/eigenvectors :(

0 Kudos
TimP
Honored Contributor III
778 Views

Did you try suggestions in references on this subject, including adjustments to shell stacksize and OMP_STACKSIZE, as well as ifort -heap-arrays?  

0 Kudos
Gennady_F_Intel
Moderator
778 Views

in the case   #pragma omp parallel, have you use private clauses for input arrays?

 

 

0 Kudos
teanku
Beginner
778 Views

Gennady Fedorov (Intel) wrote:

in the case   #pragma omp parallel, have you use private clauses for input arrays?

It is my understanding that every local variable in subroutine which being called from parallel section is private anyway, no?

roughly, my code looks like

[fortran] $omp parallel default(shared)&
!$omp private(private_vars)

!$omp do schedule(static,1)
do i=1,10
call work(private_vars,shared_vars)
end do
!$omp end do
!$omp end parallel


subroutine work(private_vars, shared_vars)
...
!local variables
real Matrix(n,n)
integer ipiv(n)

call getrf(Matrix, ipiv)
call getri(Matrix, ipiv)
end subroutine work

[/fortran]

0 Kudos
teanku
Beginner
778 Views

I managed to avoid this problem by using FORTRAN77 interface for getrf/getri/syevd

anyway this is strange when usage of F90/95 interfaces leads to appcrash

 

0 Kudos
Reply