Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

fortran - OpenMP segmentation fault after parallel region with 1 thread

I am trying to parallelise a do-loop in Fortran 90 for the code that looks as follows:

!$OMP PARALLEL DEFAULT(private) &
!$OMP& SHARED(cmesh, S) ! user-defined types with allocatable members. 
!$OMP DO
do i=1,cmesh%nelements

   Ke=0.d0
   ! skip details. Ke is populated inside another subroutine.

   do iii=1,(size(cmesh%Edof(1,:))-1) 
       do jjj=1,(size(cmesh%Edof(1,:))-1)
      
           ! add matrix Ke( real*8 (6,6) ) to elements of sparse matrix S:
           !$OMP CRITICAL
           call add( S, &
                     cmesh%dof_2_dof_free( cmesh%Edof( i, 1+iii ) ), &
                     cmesh%dof_2_dof_free( cmesh%Edof( i, 1+jjj ) ), &
                     Ke( iii, jjj ) )
           !$OMP END CRITICAL

       enddo
   enddo
enddo !i=1,cmesh%nelements
!$OMP END DO
!$OMP END PARALLEL
                    
call PARDISO( pt, 1, 1, 1, 13, cmesh%ndof_free, &
              S%a,  ! real*8, allocatable(43656)
              S%ia, ! integer*4, allocatable(1691)
              S%ja, ! integer*4, allocatable(43656)
              perm, 1, iparm, 0, &
              p_Rp, p_sol, error )

This works without OpenMP. If I enable OpenMP, the call to PARDISO throws the error:

Thread 1 stopped in mkl_pds_lp64_pardiso_c with signal SIGSEGV (Segmentation fault).

Reason/Origin: address not mapped to object (attempt to access invalid address).

even with OMP_NUM_THREADS=1. What am I doing wrong?

I compile with ifort (IFORT) 19.0.5.281 20190815.

question from:https://stackoverflow.com/questions/65545495/openmp-segmentation-fault-after-parallel-region-with-1-thread

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...