我使用CygWin / gfortran(gcc 7.4.0)编译了一个代码,并且在一个来源中显示了错误:
gfortran -c -O2 -fopenmp `FoX/FoX-config --fcflags` -DGFORTRAN -DFC_HAVE_FLUSH -DFC_HAVE_ABORT /home/gpkmo/siesta-4.0.2/Src/delk.F
/home/gpkmo/siesta-4.0.2/Src/delk.F:164:63:
!$OMP PARALLEL DEFAULT(NONE) SHARED(no,np,nvmax,iaorb,iphorb,
1
Error: Syntax error in OpenMP variable list at (1)
/home/gpkmo/siesta-4.0.2/Src/delk.F:165:6:
!$ & isa,numVs,listVsptr,listVs,dVol,maxloc,maxloc2,
1
Error: Bad continuation line at (1)
/home/gpkmo/siesta-4.0.2/Src/delk.F:165:6:
!$ & isa,numVs,listVsptr,listVs,dVol,maxloc,maxloc2,
1
Error: Unclassifiable statement at (1)
/home/gpkmo/siesta-4.0.2/Src/delk.F:598:72:
!$OMP END PARALLEL
1
Error: Unexpected !$OMP END PARALLEL statement at (1)
make: *** [arch.make:19: delk.o] Error 1
常见的源代码部分如下:
163 C Allocate local memory
164 !$OMP PARALLEL DEFAULT(NONE) SHARED(no,np,nvmax,iaorb,iphorb,
165 !$ & isa,numVs,listVsptr,listVs,dVol,maxloc,maxloc2,
166 !$ & nvmaxl,triang,lenx,leny,lenxy,parallellocal,omp_ilc,
167 !$ & omp_ilocal,omp_iorb,omp_DscfL,omp_delkmats,omp_Clocal,
168 !$ & omp_Vlocal,
169 !$ & omp_phia,r2cut,indxuo,dxa,nsp,xdop,xdsp,NeedDscfL,listdl,
170 !$ & numdl,listdlptr,directphi,endpht,lstpht,listp2,phi,nodes,node)
171 !$ & PRIVATE(i,ia,ic,ii,ijl,il,imp,ind,iop,ip,iphi,is,isp,irealim,
172 !$ & iu,iul,ix,j,jc,jl,last,lasta,lastop,nc,nlocal,nphiloc,Vij,
173 !$ & r2sp,dxsp,VClocal,ilc,ilocal,iorb,DscfL,delkmats,Clocal,
174 !$ & Vlocal,
175 !$ & phia,nth,tid)
176 #ifdef _OMP_
177 NTH = omp_get_num_threads( )
178 TID = omp_get_thread_num( ) + 1
请注意,此代码在Linux / gfortran中运行良好!我已经为此unk.F尝试过unix2dos和dos2unix工具,但对我没有帮助。
答案 0 :(得分:0)
在我编写的OpenMP代码中,&
字符位于行的末尾,每行均以!$OMP
指令开头。
对于您的代码,这将给出:
163 C Allocate local memory
164 !$OMP PARALLEL DEFAULT(NONE) SHARED(no,np,nvmax,iaorb,iphorb, &
165 !$OMP isa,numVs,listVsptr,listVs,dVol,maxloc,maxloc2, &
166 !$OMP nvmaxl,triang,lenx,leny,lenxy,parallellocal,omp_ilc, &
167 !$OMP omp_ilocal,omp_iorb,omp_DscfL,omp_delkmats,omp_Clocal, &
168 !$OMP omp_Vlocal, &
169 !$OMP omp_phia,r2cut,indxuo,dxa,nsp,xdop,xdsp,NeedDscfL,listdl, &
170 !$OMP numdl,listdlptr,directphi,endpht,lstpht,listp2,phi,nodes,node) &
171 !$OMP PRIVATE(i,ia,ic,ii,ijl,il,imp,ind,iop,ip,iphi,is,isp,irealim, &
172 !$OMP iu,iul,ix,j,jc,jl,last,lasta,lastop,nc,nlocal,nphiloc,Vij, &
173 !$OMP r2sp,dxsp,VClocal,ilc,ilocal,iorb,DscfL,delkmats,Clocal, &
174 !$OMP Vlocal, &
175 !$OMP phia,nth,tid)
176 #ifdef _OMP_
177 NTH = omp_get_num_threads( )
178 TID = omp_get_thread_num( ) + 1
这只是一个暂定答复,但是代码太长,无法在评论中发布。
语法遵循Nick Maclaren http://people.ds.cam.ac.uk/nmm1/openmp/paper_2.pdf课程的第7页