1 |
C $Header: /u/gcmpack/models/MITgcmUV/eesupp/src/ini_jam.F,v 1.2 2000/03/24 18:51:56 adcroft Exp $ |
2 |
|
3 |
#include "CPP_EEOPTIONS.h" |
4 |
|
5 |
#define USE_JAM_INIT |
6 |
|
7 |
SUBROUTINE INI_JAM |
8 |
|
9 |
C Initialise JAM based communication |
10 |
IMPLICIT NONE |
11 |
|
12 |
#ifdef LETS_MAKE_JAM |
13 |
|
14 |
C == Global data == |
15 |
#include "SIZE.h" |
16 |
#include "EEPARAMS.h" |
17 |
#include "EESUPPORT.h" |
18 |
|
19 |
#include "JAM_INFO.h" |
20 |
#include "MPI_INFO.h" |
21 |
|
22 |
#ifdef ALLOW_MPI |
23 |
#include "mpif.h" |
24 |
#endif |
25 |
|
26 |
C == Local variables == |
27 |
Real*8 dummyVal |
28 |
INTEGER rc |
29 |
CHARACTER*(MAX_LEN_FNAM) fnam |
30 |
#ifdef JAM_WITH_TWO_PROCS_PER_NODE |
31 |
INTEGER myTwoProcRank |
32 |
#endif |
33 |
|
34 |
C Names used in JAM exch testing for MPI based exchange |
35 |
mpi_northId = mpiPidN |
36 |
mpi_southId = mpiPidS |
37 |
|
38 |
#ifdef USE_JAM_INIT |
39 |
C JAM initialisation. This should work with or without |
40 |
C MPI. If we dont use MPI we have to start procs. by hand |
41 |
C though! |
42 |
#ifndef JAM_WITH_TWO_PROCS_PER_NODE |
43 |
CALL JAM_collective_init |
44 |
#else /* ! JAM_WITH_TWO_PROCS_PER_NODE */ |
45 |
myTwoProcRank = MOD(myProcId,2) |
46 |
IF ( myTwoProcRank .EQ. 0 ) THEN |
47 |
myTwoProcRank = 1 |
48 |
ELSE |
49 |
myTwoProcRank = 0 |
50 |
ENDIF |
51 |
CALL JAM_collective_init( myTwoProcRank ) |
52 |
#endif /* JAM_WITH_TWO_PROCS_PER_NODE */ |
53 |
|
54 |
CALL GET_JAM_self_address( jam_pid ) |
55 |
CALL GET_JAM_partition_size( jam_np ) |
56 |
jam_exchKey = 100 |
57 |
dummyVal = 0. |
58 |
CALL JAM_barrier_start( dummyVal ) |
59 |
CALL JAM_barrier_done( dummyVal ) |
60 |
|
61 |
C Set up connectivity |
62 |
jam_northId = jam_pid+1 |
63 |
IF ( jam_northId .EQ. jam_np ) jam_northId = 0 |
64 |
jam_southId = jam_pid-1 |
65 |
IF ( jam_southId .LT. 0 ) jam_southId = jam_np-1 |
66 |
|
67 |
numberOfProcs = jam_np |
68 |
myProcId = jam_pid |
69 |
|
70 |
#ifdef JAM_WITH_TWO_PROCS_PER_NODE |
71 |
C The following fixes the instance where MPI and |
72 |
C James JAM arrive at a different id for this process |
73 |
C *note* this assumes nPx=1 (no parallization in X) |
74 |
myPid = jam_pid |
75 |
pidN = mod(jam_pid+1,jam_np) |
76 |
pidS = mod(jam_pid-1+jam_np,jam_np) |
77 |
pidW = jam_pid |
78 |
pidE = jam_pid |
79 |
myYGlobalLo = sNy*nSy*jam_pid+1 |
80 |
myXGlobalLo = 1 |
81 |
#endif |
82 |
|
83 |
#endif |
84 |
#endif /* LETS_MAKE_JAM */ |
85 |
|
86 |
RETURN |
87 |
END |