Community
cancel
Showing results for 
Search instead for 
Did you mean: 
ekeom
Novice
92 Views

Syntax error when using "NOWAIT" !!!

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
0 Kudos
3 Replies
Bartlomiej
New Contributor I
92 Views

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.
TimP
Black Belt
92 Views

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.
Michael_K_Intel2
Employee
92 Views

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

Reply