gpt4 book ai didi

fortran - openmp 长指令列表 fortran77 的语法

转载 作者:行者123 更新时间:2023-12-03 23:23:41 25 4
gpt4 key购买 nike

问题:一长串指令 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 编译上述程序,它运行良好。我已经检查了串行版本并且得到了相同的结果
ifort -openmp -parallel -o ./solve 

但是当我尝试使用 gfortran 进行编译时,它不起作用。
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

This proposed solution对我不起作用(可能是因为我使用的是 fortran77)

最佳答案

您的问题简单地归结为固定格式源 Fortran 代码的 OpenMP 延续语法是这样的:

c$omp parallel blah
c$omp+private( blah )
c$omp+reduction( blah )

好吧,更准确地说,以下所有 3 种指令形式都是等效的:
c$omp
!$omp
*$omp

但无论如何,必须使用第 6 列中的额外字符拆分跨多行的指令,如已显示。该字符可以是空格或零以外的任何字符。 (感谢 Hristo Iliev 在这方面纠正了我。最初错误地指出继续字符应该是 + )

添加各种必要的 c$omp+续行应该可以解决您的问题

这应该是这样的:
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

关于fortran - openmp 长指令列表 fortran77 的语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33704732/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com