问题
This is related to a previous question. I am trying to parallelize a code with mixed syntax (f77 and f90)
I've added into one of the many routines this portion in the code
!$omp parallel shared (xdif,cdiff, dg,bfvisc,r,ro,xm ) private ( l )
!$omp do
DO L=2,n-1
xdif(l)=cdiff(l)*fjc+(dg(l)+bfvisc(l))*
& (4.d0*pi*r(l)**2*ro(l)/xm(n))**2
ENDDO
!$omp end do
!$omp end parallel
After compiling (using -fopenmp
) the code runs but just for a few seconds and the only error I'm getting is: Segmentation fault (core dumped)
I didn't use the module omp_lib
(since that was suggested in an answer to the previous question) but I also try with it (using call omp_set_num_threads(4)
before the first line). And both ways I have the same problem.
What can I do?
I've been advised also to print the output with the flags -g -fbacktrace -fcheck=all -Wall
. Here it is:
At line 2828 of file mainII.f
Fortran runtime error: Index '0' of dimension 1 of array 'l1mlos' below lower bound of 1
来源:https://stackoverflow.com/questions/35232542/openmp-and-fortran-crashing-code