/[MITgcm]/MITgcm/eesupp/src/eedie.F
ViewVC logotype

Contents of /MITgcm/eesupp/src/eedie.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download)
Tue May 18 17:39:21 1999 UTC (25 years, 1 month ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint28, checkpoint29, checkpoint22, checkpoint23, checkpoint24, checkpoint25, checkpoint27, branch-atmos-merge-freeze, branch-atmos-merge-start, checkpoint26, branch-atmos-merge-shapiro, checkpoint33, checkpoint32, checkpoint31, checkpoint30, checkpoint34, branch-atmos-merge-zonalfilt, branch-atmos-merge-phase5, branch-atmos-merge-phase4, branch-atmos-merge-phase7, branch-atmos-merge-phase6, branch-atmos-merge-phase1, branch-atmos-merge-phase3, branch-atmos-merge-phase2
Branch point for: branch-atmos-merge
Changes since 1.3: +4 -3 lines
Added IMPLICIT NONE where missing and changed formatting from 'I' to 'I5'.

1 C $Header: /u/gcmpack/models/MITgcmUV/eesupp/src/eedie.F,v 1.3 1998/10/28 03:11:34 cnh Exp $
2
3 #include "CPP_EEOPTIONS.h"
4
5 CStartOfInterface
6 SUBROUTINE EEDIE
7 C /==========================================================\
8 C | SUBROUTINE EEDIE |
9 C | o Close execution "environment", particularly perform |
10 C | steps to terminate parallel processing. |
11 C |==========================================================|
12 C | Note: This routine can also be compiled with CPP |
13 C | directives set so that no multi-processing is initialised|
14 C | This is OK and should work fine. |
15 C \==========================================================/
16 IMPLICIT NONE
17
18 C == Global variables ==
19 #include "SIZE.h"
20 #include "EEPARAMS.h"
21 #include "EESUPPORT.h"
22 CEndOfInterface
23
24 C == Local variables ==
25 C msgBuf - I/O Buffer
26 C nThreadsDone - Used to count number of completed threads.
27 C I - Loop counter.
28 CHARACTER*(MAX_LEN_MBUF) msgBuf
29 INTEGER nThreadsDone
30 INTEGER I
31 #ifdef ALLOW_USE_MPI
32 C mpiRC - Error code reporting variable used
33 C with MPI.
34 INTEGER mpiRC
35 #endif /* ALLOW_USE_MPI */
36
37 C-- Check that all the threads have ended
38 C No thread should reach this loop before all threads have set
39 C threadIsComplete to TRUE. If they do then either there is a bug
40 C in the code or the behaviour of the parallel compiler directives
41 C are not right for this code. In the latter case different
42 C directives may be available or the compiler itself may have a
43 C bug or you may need a different parallel compiler for main.F
44 nThreadsDone = 0
45 DO I = 1, nThreads
46 IF ( threadIsComplete(I) ) nThreadsDone = nThreadsDone+1
47 ENDDO
48 IF ( nThreadsDone .LT. nThreads ) THEN
49 WRITE(msgBuf,'(A,I5,A,I5,A)')
50 & 'S/R EEDIE: Only ',nThreadsDone,
51 & ' threads have completed, ',nThreads,
52 & ' are expected for this configuration!'
53 WRITE(0,*) msgBuf
54 WRITE(0,*)
55 & 'Possibly you have different setenv PARALLEL and nThreads?'
56 eeEndError = .TRUE.
57 fatalError = .TRUE.
58 ENDIF
59
60 #ifdef ALLOW_USE_MPI
61 C--
62 C-- MPI style multiple-process termination
63 C-- ======================================
64 #ifndef ALWAYS_USE_MPI
65 IF ( usingMPI ) THEN
66 #endif
67 CALL MPI_FINALIZE ( mpiRC )
68 IF ( mpiRC .NE. MPI_SUCCESS ) THEN
69 eeEndError = .TRUE.
70 fatalError = .TRUE.
71 WRITE(msgBuf,'(A,I5)')
72 & 'S/R FIN_PROCS: MPI_FINALIZE return code',
73 & mpiRC
74 CALL PRINT_ERROR( msgBuf, 1 )
75 ENDIF
76 C
77 #ifndef ALWAYS_USE_MPI
78 ENDIF
79 #endif
80 #endif /* ALLOW_USE_MPI */
81
82
83 RETURN
84 END

  ViewVC Help
Powered by ViewVC 1.1.22