OMP ON NEC SX-8

General OpenMP discussion

OMP ON NEC SX-8

Postby chrism » Mon Apr 14, 2008 5:41 am

Hi

I am writing FORTRAN/OpenMP code on a NEC-SX-8 and am trying to find out how many threads are being used in a parallel region.

I have the code like;

!$OMP PARALLEL DO
!$OMP&PRIVATE(...,nt)
!$OMP&SHARED(...)
nt=OMP_GET_NUM_THREADS()
PRINT *, 'threads= ', nt
DO A
DO B
loads of work
B CONTINUE
A CONTINUE
!$OMP END PARALLEL DO

When I compile with "sxf90 source.f -P openmp" I get the error message "OpenMP directive is appeared inappropriately".

Now when I replace the two lines between the shared directive and the first do statement with a simple print hello statement I get the same error message.

Is there a rule that states you can't put any statement between a shared directive and a do, or is there another way of doing what I want to do?

Chris
chrism
 
Posts: 2
Joined: Mon Mar 31, 2008 6:52 am

Re: OMP ON NEC SX-8

Postby chrism » Mon Apr 14, 2008 6:01 am

replace

!$OMP PARALLEL DO
!$OMP&PRIVATE
!$OMP&SHARED

with

!$OMP PARALLEL
!$OMP&PRIVATE
!$OMP&SHARED
get thread info and print
!$OMP DO
...
!$OMP END DO
!$OMP END PARALLEL


it works!
chrism
 
Posts: 2
Joined: Mon Mar 31, 2008 6:52 am

Re: OMP ON NEC SX-8

Postby ejd » Mon Apr 14, 2008 9:04 am

If you look at the OMP V2.5 spec, section 2.6.1 Parallel loop construct, it states:
Summary
The parallel loop construct is a shortcut for specifying a parallel construct containing one loop construct and no other statements.

If you then look at section 2.5.1 Loop Construct, you will see:
The syntax of the loop construct is as follows:
!$omp do [clause[[,] clause] ... ]
do-loop
[!$omp end do [nowait] ]

So the answer is, you may not have any statements between the "parallel do" directive and the do-loop (which is defined in the text as a do-construct according to the Fortran standard).
ejd
 
Posts: 1025
Joined: Wed Jan 16, 2008 7:21 am


Return to Using OpenMP

Who is online

Users browsing this forum: No registered users and 5 guests