openmp 长指令列表 fortran77 的语法 [英] Syntax for openmp long directive list fortran77
问题描述
问题:指令 openmp fortran77 的长列表
PROBLEM : Long list of directives openmp fortran77
c$omp parallel default(shared) private(i,k,i1,i2,i3,i4,i5,
$ i6,x0,y0,z0,vnx0,vny0,vnz0,qs0)
c$omp do
Task to be performed
c$omp end do
c$omp end parallel
我正在尝试使用 ifort 编译上述程序,它工作正常.我已经检查了串行版本,我得到了相同的结果
I'm trying to compile the above program using ifort and it works fine. I have checked with the serial version and I get the same result
ifort -openmp -parallel -o ./solve
但是当我尝试使用 gfortran 编译时它不起作用.
But when I try to compile using gfortran it doesn't work.
gfortran -fopenmp
我收到以下错误
quinckedrop.f:2341.57:
*$omp parallel default(shared) private(i,k,i1,i2,i3,i4,i5
1
Error: Syntax error in OpenMP variable list at (1)
quinckedrop.f:2342.6:
$ ,i6,x0,y0,z0,vnx0,vny0,vnz0,qs0)
1
Error: Bad continuation line at (1)
quinckedrop.f:2342.15:
$ ,i6,x0,y0,z0,vnx0,vny0,vnz0,qs0)
1
Error: Invalid character in name at (1)
quinckedrop.f:2381.72:
*$omp end parallel
1
Error: Unexpected !$OMP END PARALLEL statement at (1)
quinckedrop.f:2768.6:
$ private(i,k,i1,i2,i3,i4,i5,i6,x0,y0,z0,vnx0,vny0,vnz0)
1
Error: Bad continuation line at (1)
quinckedrop.f:2768.21:
$ private(i,k,i1,i2,i3,i4,i5,i6,x0,y0,z0,vnx0,vny0,vnz0)
1
Error: PRIVATE statement at (1) is only allowed in the specification part of a module
quinckedrop.f:4302.6:
$ private(i,k,i1,i2,i3,i4,i5,i6,x0,y0,z0)
1
Error: Bad continuation line at (1)
quinckedrop.f:4302.21:
$ private(i,k,i1,i2,i3,i4,i5,i6,x0,y0,z0)
1
Error: PRIVATE statement at (1) is only allowed in the specification part of a module
quinckedrop.f:5738.6:
$ private(i,k,i1,i2,i3,i4,i5,i6,x0,y0,z0
1
Error: Bad continuation line at (1)
quinckedrop.f:5738.21:
$ private(i,k,i1,i2,i3,i4,i5,i6,x0,y0,z0
1
Error: PRIVATE statement at (1) is only allowed in the specification part of a module
这个建议的解决方案对我不起作用(可能是因为我使用的是 fortran77)
This proposed solution doesn't work for me (may be because I am using fortran77)
推荐答案
您的问题简单归结为固定格式源 Fortran 代码的 OpenMP 延续语法是这样的:
Your problem simply boils down to that the OpenMP continuation syntax for fixed format sources Fortran code is like this:
c$omp parallel blah
c$omp+private( blah )
c$omp+reduction( blah )
嗯,更准确地说,以下三种指令形式都是等价的:
Well, to be more precise, all the 3 following forms for directives are equivalent:
c$omp
!$omp
*$omp
但在任何情况下,跨多行的指令必须使用第 6 列中的额外字符进行拆分,如前所述.该字符可以是除空格或零以外的任何字符.(感谢 Hristo Iliev 纠正了我.最初错误地指出继续字符应该是 +
)
But in any case, a directive spread across several lines must be split using an extra character in the 6th column, as already shown. This character can be anything but a space or a zero. (thanks to Hristo Iliev for having corrected me in that. Initially mistakenly stated that the continuation character was supposed to be a +
)
添加各种必要的 c$omp+
续行应该可以解决您的问题
Adding the various necessary c$omp+
continuation lines should just solve your problem
这应该是这样的:
c$omp parallel default(shared) private(i,k,i1,i2,i3,i4,i5,
c$omp+ i6,x0,y0,z0,vnx0,vny0,vnz0,qs0)
c$omp do
Task to be performed
c$omp end do
c$omp end parallel
这篇关于openmp 长指令列表 fortran77 的语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!