openmp长指令列表fortran77的语法 [英] Syntax for openmp long directive list fortran77

查看:203
本文介绍了openmp长指令列表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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆