As my basic arithmetic is getting a bit shaky I thought I'd write a little program to ensure I can still count from 1 to 10, relying on old-fashioned rote-learning through repetition. I then decided to parallelise my program with OpenMP - time is money, after all.
But with the following the compiler complains about a dodgy EXIT statement in the inner-most DO loop:
PROGRAM CountInParallel !$ USE OMP_LIB IMPLICIT NONE INTEGER :: itask INTEGER :: i !**** !$OMP PARALLEL DEFAULT(NONE) PRIVATE(itask) ! One thread defines twenty tasks. !$OMP SINGLE DO itask = 1, 20 ! The task is to count up to ten. !$OMP TASK PRIVATE(i) i = 1 DO IF (i > 10) EXIT ! error #7566 here !$ IF (.TRUE.) THEN !$OMP CRITICAL(some_output) !$ PRINT *, omp_get_thread_num(), itask, i !$OMP END CRITICAL(some_output) !$ ELSE PRINT *, itask, i !$ END IF i = i + 1 END DO !$OMP END TASK END DO !$OMP END SINGLE !$OMP END PARALLEL END PROGRAM CountInParallelI don't think its whinging is justified - from my reading of the OpenMP spec that sort of restriction exists for loop constructs but not for task constructs. Thoughts?
(The docs that come with 12.0.4 don't have the parentheses in the syntax of the !$OMP CRITICAL directive - see ms-help://MS.VSCC.v80/intel.forprodocs/intel.fprocompilerdocs/main_for/optaps/common/optaps_par_dirs.htm under VS2005's doc explorer)have slightly incorrect syntax for the