Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

Mixed coarray/OpenMP code with STOP statement in parallel region

$
0
0

According to OpenMP 4.5, a Fortran STOP statement is allowed inside a structured block. The code below works (as expected) when only one coarray image is used; but it hangs if more than 1 coarray image is executed.

Now, if ERROR STOP is used instead of STOP, the code works as expected. Am I missing something (or doing something illicit) here?

SUBROUTINE S(I)
IMPLICIT NONE
INTEGER :: I,J
REAL(KIND=8) R
IF (I==20) THEN
    STOP                  ! This causes the code to hang...
    !ERROR STOP           ! This works...
ELSE
    R = 0.
    DO J=100*I,5000000
        R = COS(R+J*COS(R))
    END DO
    WRITE(*,*) I,R
END IF
END SUBROUTINE S


PROGRAM MAIN
IMPLICIT NONE
INTEGER  :: I

!$OMP PARALLEL DEFAULT(NONE) PRIVATE(I)
!$OMP DO ORDERED SCHEDULE(MONOTONIC:STATIC,1)
DO I=1,500
    CALL S(I)
END DO
!$OMP END DO
!$OMP END PARALLEL

WRITE(*,*) THIS_IMAGE()

END PROGRAM MAIN

 


Viewing all articles
Browse latest Browse all 5691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>