Openmp and Fortran, crashing code

混江龙づ霸主 提交于 2019-12-12 05:27:53

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!