- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
Could someone please confirm whether I have found a compiler bug for
the OpenMP collapse clause?
I have attached two test programs that use the OpenMP collapse clause
to divide iterations from two loops. I find that the OpenMP collapse
clause works as I expect when the loop limits are hard-coded values
(see program value_limits.F90), but not when I use loop limits that
are determined from an array (see program array_limits.F90) -- the
array containing the loop limits is shared, but is not modified within
the nested loops. When I run the affected program array_limits.F90
the number of executed loop iterations is undefined -- sometimes it is
1 iteration and sometimes it seems to tend to infinity. A subset of
the code from the affected program array_limits.F90 is shown below:
limits(1) = 1
limits(2) = 3
!$omp parallel default(none) private(i,j) shared(limits)
!$omp do collapse(2) schedule(static)
do j = limits(1),limits(2)
do i = limits(1),limits(2)
print *, 'Thread', omp_get_thread_num(), " of", &
omp_get_num_threads(), " has i", i, " and j", j
end do
end do
!$omp end do
!$omp end parallel
I have been using an x86_64 version of Intel compiler version 12.0.2
with Linux Kernel 2.6.18-194.el5.
The attachments are: value_limits.F90, array_limits.F90, Makefile,
README.
Thanks for any feedback,
Chris
Could someone please confirm whether I have found a compiler bug for
the OpenMP collapse clause?
I have attached two test programs that use the OpenMP collapse clause
to divide iterations from two loops. I find that the OpenMP collapse
clause works as I expect when the loop limits are hard-coded values
(see program value_limits.F90), but not when I use loop limits that
are determined from an array (see program array_limits.F90) -- the
array containing the loop limits is shared, but is not modified within
the nested loops. When I run the affected program array_limits.F90
the number of executed loop iterations is undefined -- sometimes it is
1 iteration and sometimes it seems to tend to infinity. A subset of
the code from the affected program array_limits.F90 is shown below:
limits(1) = 1
limits(2) = 3
!$omp parallel default(none) private(i,j) shared(limits)
!$omp do collapse(2) schedule(static)
do j = limits(1),limits(2)
do i = limits(1),limits(2)
print *, 'Thread', omp_get_thread_num(), " of", &
omp_get_num_threads(), " has i", i, " and j", j
end do
end do
!$omp end do
!$omp end parallel
I have been using an x86_64 version of Intel compiler version 12.0.2
with Linux Kernel 2.6.18-194.el5.
The attachments are: value_limits.F90, array_limits.F90, Makefile,
README.
Thanks for any feedback,
Chris
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My own experience agrees with yours, that the collapse is reliable only for the case where the outer loop count is known at compile time. Thanks for submitting a test case; maybe this can get some attention.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It works fine with gfortran... I mean, it worked.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page