DSS solver not thread safe?

DSS solver not thread safe?

Hi,

I have been experimenting with OMP and was getting funny crashes (access violation) from calls to dss_solve_real.

The back substitutions were inside an OMP parallel loop, and from what I can read from the documentation the dss routines should be thread-safe, but this appears not to be the case for me.

My question is now: has anyone succesfully done these backsubstitutions in parallel succesfully?

I have included a sample program that crashes in case i am doing something wrong. Im using MKL ver 10.0.3.021 and intel fortran 10.1.019.

Thanks for any pointers,
Henrik

----- Sample program
program dss_bug
use mkl_dss
use omp_Lib

implicit none
! matrix
integer, parameter :: nRows = 5, nNonZero = 9
real(8), dimension(nNonZero) :: rValues
real(8), dimension(nRows, 4) :: rhs, solution, correct
integer, dimension(nNonZero) :: columns
integer, dimension(nRows+1) :: rowIndex
real(8), dimension(4) :: Norm
type(MKL_DSS_HANDLE) :: handle
integer :: i, IAM, error

rowIndex = (/ 1, 6, 7, 8, 9, 10 /)
columns = (/ 1, 2, 3, 4, 5, 2, 3, 4, 5 /)
rValues = (/ 9.0, 1.5, 6.0, .75, 3.0, 0.5, 12.0, .625, 16.0 /)
rhs(:,1) = (/ 1, 2, 3, 4, 5 /)
rhs(:,2) = rhs(:,1) + 1
rhs(:,3) = rhs(:,2) + 1
rhs(:,4) = rhs(:,3) + 1

! initialize solver
error = dss_create(handle, MKL_DSS_DEFAULTS)
error = dss_define_structure( handle, MKL_DSS_SYMMETRIC, rowIndex, nRows, nRows, columns, nNonZero )
error = dss_reorder(handle, MKL_DSS_AUTO_ORDER, (/0/))
error = dss_factor_real(handle, MKL_DSS_DEFAULTS, rValues)
error = dss_solve_real( handle, MKL_DSS_DEFAULTS, rhs, 4, correct)
!$OMP PARALLEL
!$OMP DO SCHEDULE(STATIC,1)
do i = 1, 10000
IAM = OMP_GET_THREAD_NUM()+1
! write(*,*) "thread: ", IAM, " of ", OMP_GET_NUM_THREADS()
error = dss_solve_real( handle, MKL_DSS_DEFAULTS, rhs(:,IAM), 1, solution(:,IAM))
norm(IAM) = sqrt(dot_product(solution(:,IAM)-correct(:,IAM), solution(:,IAM)-correct(:,IAM)))
if (norm(IAM) > 1.0) write(*,*) "FAIL! : ", IAM
end do
!$OMP END DO
!$OMP END PARALLEL
end program dss_bug

1 envío / 0 nuevos
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.