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

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

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


Revision 1.10 - (hide annotations) (download)
Sat Sep 25 23:09:54 2010 UTC (14 years ago) by mlosch
Branch: MAIN
CVS Tags: checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62w, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint63g, checkpoint63, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63a, checkpoint63b, checkpoint63c
Changes since 1.9: +4 -1 lines
add hooks for new packages OASIS, the package will follow
(hooks exclude the seaice pkg for now)

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

  ViewVC Help
Powered by ViewVC 1.1.22