[MITgcm-support] OpenMP Model Code.

John Stark jods at soc.soton.ac.uk
Wed Oct 8 07:06:15 EDT 2003


Hi,

There was at least one error in my previous code. In MAIN_PDIRECTIVES1.h
the call to OMP_SET_NUM_THREADS should go before the parallel section
like so:

[ MAIN_PDIRECTIVES1.h ]
#ifdef USE_OMP_THREADING
      call OMP_SET_NUM_THREADS(nThreads)
C$OMP PARALLEL
C$OMP&  SHARED(nThreads) ,
C$OMP&  PRIVATE(I, myThid)
c    we could use the NUM_THREADS(nThreads) directive 
C    but doesn't seem to be supported in all systems. 

c Model uses thread ids from 1,2... whereas openmp uses 0,1...
      myThid = OMP_GET_THREAD_NUM() + 1
#define CODE_IS_THREADED
#endif

John



More information about the MITgcm-support mailing list