1 |
C $Header$ |
C $Header$ |
2 |
|
C $Name$ |
3 |
|
|
4 |
#include "CPP_EEOPTIONS.h" |
#include "CPP_EEOPTIONS.h" |
5 |
|
|
22 |
C | directives set so that no multi-processing is initialise.| |
C | directives set so that no multi-processing is initialise.| |
23 |
C | This is OK and should work fine. | |
C | This is OK and should work fine. | |
24 |
C \==========================================================/ |
C \==========================================================/ |
25 |
|
IMPLICIT NONE |
26 |
|
|
27 |
C === Global data === |
C === Global data === |
28 |
#include "SIZE.h" |
#include "SIZE.h" |
48 |
numberOfProcs = 1 |
numberOfProcs = 1 |
49 |
myProcId = 0 |
myProcId = 0 |
50 |
pidIO = myProcId |
pidIO = myProcId |
51 |
myProcessStr = '??????' |
myProcessStr = '------' |
52 |
C Set a dummy value for myThid because we aren't multi-threading |
C Set a dummy value for myThid because we are not multi-threading |
53 |
C yet. |
C yet. |
54 |
myThid = 1 |
myThid = 1 |
55 |
#ifdef ALLOW_USE_MPI |
#ifdef ALLOW_USE_MPI |
65 |
CALL MPI_INIT( mpiRC ) |
CALL MPI_INIT( mpiRC ) |
66 |
IF ( mpiRC .NE. MPI_SUCCESS ) THEN |
IF ( mpiRC .NE. MPI_SUCCESS ) THEN |
67 |
eeBootError = .TRUE. |
eeBootError = .TRUE. |
68 |
WRITE(msgBuffer,'(A,I)') |
WRITE(msgBuffer,'(A,I5)') |
69 |
& 'S/R INI_PROCS: MPI_INIT return code', |
& 'S/R INI_PROCS: MPI_INIT return code', |
70 |
& mpiRC |
& mpiRC |
71 |
CALL PRINT_ERROR( msgBuffer , myThid) |
CALL PRINT_ERROR( msgBuffer , myThid) |
72 |
GOTO 999 |
GOTO 999 |
73 |
ENDIF |
ENDIF |
74 |
|
C-- MPI has now been initialized but now we need to either |
75 |
|
C ask for a communicator or pretend that we have: |
76 |
|
C Pretend that we have asked for a communicator |
77 |
|
MPI_COMM_MODEL = MPI_COMM_WORLD |
78 |
|
C Ask coupler interface for a communicator |
79 |
|
c hook call MITCOMPONENT_init( 'MITgcmUV', MPI_COMM_MODEL ) |
80 |
|
|
81 |
C-- Get my process number |
C-- Get my process number |
82 |
CALL MPI_COMM_RANK( MPI_COMM_WORLD, mpiMyId, mpiRC ) |
CALL MPI_COMM_RANK( MPI_COMM_MODEL, mpiMyId, mpiRC ) |
83 |
IF ( mpiRC .NE. MPI_SUCCESS ) THEN |
IF ( mpiRC .NE. MPI_SUCCESS ) THEN |
84 |
eeBootError = .TRUE. |
eeBootError = .TRUE. |
85 |
WRITE(msgBuffer,'(A,I)') |
WRITE(msgBuffer,'(A,I5)') |
86 |
& 'S/R INI_PROCS: MPI_COMM_RANK return code', |
& 'S/R INI_PROCS: MPI_COMM_RANK return code', |
87 |
& mpiRC |
& mpiRC |
88 |
CALL PRINT_ERROR( msgBuffer , myThid) |
CALL PRINT_ERROR( msgBuffer , myThid) |
101 |
|
|
102 |
C-- Synchronise all processes |
C-- Synchronise all processes |
103 |
C Strictly this is superfluous, but by using it we can guarantee to |
C Strictly this is superfluous, but by using it we can guarantee to |
104 |
C find out about processes that didn't start up. |
C find out about processes that did not start up. |
105 |
CALL MPI_BARRIER( MPI_COMM_WORLD, mpiRC ) |
CALL MPI_BARRIER( MPI_COMM_MODEL, mpiRC ) |
106 |
IF ( mpiRC .NE. MPI_SUCCESS ) THEN |
IF ( mpiRC .NE. MPI_SUCCESS ) THEN |
107 |
eeBootError = .TRUE. |
eeBootError = .TRUE. |
108 |
WRITE(msgBuffer,'(A,I)') |
WRITE(msgBuffer,'(A,I5)') |
109 |
& 'S/R INI_PROCS: MPI_BARRIER return code', |
& 'S/R INI_PROCS: MPI_BARRIER return code', |
110 |
& mpiRC |
& mpiRC |
111 |
CALL PRINT_ERROR( msgBuffer , myThid) |
CALL PRINT_ERROR( msgBuffer , myThid) |
113 |
ENDIF |
ENDIF |
114 |
|
|
115 |
C-- Get number of MPI processes |
C-- Get number of MPI processes |
116 |
CALL MPI_COMM_SIZE ( MPI_COMM_WORLD, mpiNProcs, mpiRC ) |
CALL MPI_COMM_SIZE ( MPI_COMM_MODEL, mpiNProcs, mpiRC ) |
117 |
IF ( mpiRC .NE. MPI_SUCCESS ) THEN |
IF ( mpiRC .NE. MPI_SUCCESS ) THEN |
118 |
eeBootError = .TRUE. |
eeBootError = .TRUE. |
119 |
WRITE(msgBuffer,'(A,I)') |
WRITE(msgBuffer,'(A,I5)') |
120 |
& 'S/R INI_PROCS: MPI_COMM_SIZE return code', |
& 'S/R INI_PROCS: MPI_COMM_SIZE return code', |
121 |
& mpiRC |
& mpiRC |
122 |
CALL PRINT_ERROR( msgBuffer , myThid) |
CALL PRINT_ERROR( msgBuffer , myThid) |
124 |
ENDIF |
ENDIF |
125 |
numberOfProcs = mpiNProcs |
numberOfProcs = mpiNProcs |
126 |
|
|
127 |
C-- Can't have more processes than compile time MAX_NO_PROCS |
C-- Can not have more processes than compile time MAX_NO_PROCS |
128 |
IF ( numberOfProcs .GT. MAX_NO_PROCS ) THEN |
IF ( numberOfProcs .GT. MAX_NO_PROCS ) THEN |
129 |
eeBootError = .TRUE. |
eeBootError = .TRUE. |
130 |
WRITE(msgBuffer,'(A)') |
WRITE(msgBuffer,'(A)') |