- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
[fortran]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 CountInParallel
[/fortran]I 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
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
(The following works around the EXIT statement issue through use of DO WHILE (..)).
[fortran]PROGRAM CountInParallelDeluxe
!$ 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) FIRSTPRIVATE(itask)
i = 1
DO WHILE (i <= 10)
!$ 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 CountInParallelDeluxe
[/fortran]Some digging into detail (looking at the LOC's of the various itask's etc) makes me think that the 12.0.4 compiler is getting confused, but I quite happily admit that I have no idea what I'm doing here!Thoughts ** 2 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Both of your examples appear to be Intel OpenMP compiler bugs. We'll investigate and follow up.
Thank you,
Patrick
Intel Developer Support
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Patrick
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Patrick Kennedy
Intel Developer Suport
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Patrick
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page