- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear All,
I try to use OpenMP "NOWAIT" directive, in the following code source. But I have this error message :
Error 1 Error: Syntax error, found 'NOWAIT' when expecting one of: ; C:\...\prod.f90 142
Error 2 Compilation Aborted (code 1) C:\...\prod.f90 1
I don't understand what is the problem!
Best regards,
Didace
subroutine prod(a,n)
use const_m
use omp_lib
implicit none
integer, intent(in) :: n
integer :: i, j
complex*16, dimension(n,n), intent(inout) :: a
complex*16, dimension(:), allocatable :: v
allocate(v(n))
do i=1,n
!$OMP PARALLEL DO DEFAULT(SHARED) SCHEDULE(DYNAMIC,n/OMP_GET_MAX_THREADS()) PRIVATE(j)
do j=i1,n
v(j) = a(i,j)
enddo
!$OMP END PARALLEL DO NOWAIT
enddo
deallocate(v)
end subroutine prod
I try to use OpenMP "NOWAIT" directive, in the following code source. But I have this error message :
Error 1 Error: Syntax error, found 'NOWAIT' when expecting one of:
Error 2 Compilation Aborted (code 1) C:\...\prod.f90 1
I don't understand what is the problem!
Best regards,
Didace
subroutine prod(a,n)
use const_m
use omp_lib
implicit none
integer, intent(in) :: n
integer :: i, j
complex*16, dimension(n,n), intent(inout) :: a
complex*16, dimension(:), allocatable :: v
allocate(v(n))
do i=1,n
!$OMP PARALLEL DO DEFAULT(SHARED) SCHEDULE(DYNAMIC,n/OMP_GET_MAX_THREADS()) PRIVATE(j)
do j=i1,n
v(j) = a(i,j)
enddo
!$OMP END PARALLEL DO NOWAIT
enddo
deallocate(v)
end subroutine prod
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think it should be something, like:
!$OMP PARALLEL DO DEFAULT(SHARED) SCHEDULE(DYNAMIC,n/OMP_GET_MAX_THREADS()) PRIVATE(j) NOWAIT
and without the line:
!$OMP END PARALLEL DO NOWAIT
On the other hand, if that's exactly the program, you were writing, such a construction does not make much sense (or even would not work), as you have to finish all threads before deallocating v.
Nowait makes sense if you have a few loops executed one after the another and they are not strictly connected, something like (I'll use C, as I'm more skilled with it):
#pragma omp parallel
{
#pragma omp for nowait
for (i = 0; i < N; i++)
...
#pragma omp for
for (j = 0; j < N; j++)
...
} /* end of the parallel block */
I hope this will help. Regards.
!$OMP PARALLEL DO DEFAULT(SHARED) SCHEDULE(DYNAMIC,n/OMP_GET_MAX_THREADS()) PRIVATE(j) NOWAIT
and without the line:
!$OMP END PARALLEL DO NOWAIT
On the other hand, if that's exactly the program, you were writing, such a construction does not make much sense (or even would not work), as you have to finish all threads before deallocating v.
Nowait makes sense if you have a few loops executed one after the another and they are not strictly connected, something like (I'll use C, as I'm more skilled with it):
#pragma omp parallel
{
#pragma omp for nowait
for (i = 0; i < N; i++)
...
#pragma omp for
for (j = 0; j < N; j++)
...
} /* end of the parallel block */
I hope this will help. Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I show examples of what I believe is working NOWAIT at
http://sites.google.com/site/tprincesite/levine-callahan-dongarra-vectors
Referring to openmp.org and other reputable examples, NOWAIT is always issued prior to the end of a PARALLEL.
I use it only in Fortran; I didn't find it reliable in C or C++, and I think it gains more with the combination of gfortran and libiomp than with other combinations on Intel CPUs.
Depending on the ifort version, Intel Thread Checker may complain about any/all use of NOWAIT.
I don't think you can draw any conclusions from a case like you have written, where an optimizing compiler could change the outer loop to
do i=n,n
and DYNAMIC could defeat any effort to maintain NUMA locality.
http://sites.google.com/site/tprincesite/levine-callahan-dongarra-vectors
Referring to openmp.org and other reputable examples, NOWAIT is always issued prior to the end of a PARALLEL.
I use it only in Fortran; I didn't find it reliable in C or C++, and I think it gains more with the combination of gfortran and libiomp than with other combinations on Intel CPUs.
Depending on the ifort version, Intel Thread Checker may complain about any/all use of NOWAIT.
I don't think you can draw any conclusions from a case like you have written, where an optimizing compiler could change the outer loop to
do i=n,n
and DYNAMIC could defeat any effort to maintain NUMA locality.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi!
I your code you simply placed NOWAIT where it is not allowed to be placed.
You can add NOWAIT to the work-sharing constructs to indicate that a barrier is not needed. For parallel regions, however, NOWAITis forbidden as a parallel execution always involves a barrier that cannot be removed.
As you're using "parallel do" you essentially get a compound parallel region that only contains a single work-sharing construct.
Cheers,
-michael
I your code you simply placed NOWAIT where it is not allowed to be placed.
You can add NOWAIT to the work-sharing constructs to indicate that a barrier is not needed. For parallel regions, however, NOWAITis forbidden as a parallel execution always involves a barrier that cannot be removed.
As you're using "parallel do" you essentially get a compound parallel region that only contains a single work-sharing construct.
Cheers,
-michael
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