Fortran中的OpenMP错误

时间:2014-03-31 08:54:17

标签: parallel-processing fortran openmp

我试图并行执行内部双循环(连续执行没有问题):

DO J=1,NY
    DO I=1,NX

        A2=0.0d0

        A1=S(I,J)
        A2=dble(S(IP(I),J)+S(IM(I),J)+S(I,JP(J))+S(I,JM(J)))

        EL=0.0d0

        !$OMP parallel DO SHARED(LAMDA,S,COUL) PRIVATE(I1,J1) reduction(+:EL) 

        DO J1=1,NY
            DO I1=1,NX

                IF ((J1/=J.OR.I1/=I).AND.(J1/=J.OR.I1/=IP(I)).AND.(J1/=J.OR.I1/=IM(I)).AND.(J1/=JP(J).OR.I1/=I).AND.(J1/=JM(J).OR.I1/=I)) THEN 

                    IF (ABS(FLOAT(I)-FLOAT(I1)) <= ABS(FLOAT(I)+LEN-FLOAT(I1))) THEN 
                        ID= INT(ABS(FLOAT(I)-FLOAT(I1)))
                    ELSE 
                        ID= INT(ABS(FLOAT(I)+LEN-FLOAT(I1)))
                    END IF

                    IF (ABS(FLOAT(J)-FLOAT(J1)) <= ABS(FLOAT(J)+LEN-FLOAT(J1))) THEN 
                        JD= INT(ABS(FLOAT(J)-FLOAT(J1)))
                    ELSE 
                        JD= INT(ABS(FLOAT(J)+LEN-FLOAT(J1)))
                    END IF

                    EL=EL + LAMDA*COUL(ID,JD)*dble(S(I1,J1))

                END IF

            END DO
        END DO

        !$OMP END PARALLEL DO 

...

其中COUL(ID,JD)是先前在代码中计算的矩阵,LAMDA参数和矩阵S,IP等具有所有已知值。

当我编译它(英特尔Fortran)时,我得到以下奇怪的错误:

error #7655: A variable is required in this OpenMP* context.   [3.0D0]
error #7656: Subobjects are not allowed in this OpenMP* clause; a named variable must be specified.

有人对这些错误有任何疑问吗?有趣的是,我编写了一个简单的程序来执行这些循环,并且它与上述OpenMP语句并行工作正常。

0 个答案:

没有答案