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

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

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


Revision 1.8 - (hide annotations) (download)
Thu Oct 11 19:15:18 2012 UTC (11 years, 7 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint65, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, HEAD
Changes since 1.7: +9 -6 lines
- add S/R to flush IO unit (if intrinsic S/R flush is available)
- flush standard & error msg unit before MPI termination
- if debugMode, flush IO unit after printing msg

1 jmc 1.8 C $Header: /u/gcmpack/MITgcm/eesupp/src/all_proc_die.F,v 1.7 2012/09/01 22:43:55 jmc Exp $
2 jmc 1.1 C $Name: $
3    
4     #include "CPP_EEOPTIONS.h"
5    
6     CBOP
7     C !ROUTINE: ALL_PROC_DIE
8    
9     C !INTERFACE:
10 jmc 1.6 SUBROUTINE ALL_PROC_DIE( myThArg )
11 jmc 1.1
12     C !DESCRIPTION:
13     C *==========================================================*
14     C | SUBROUTINE ALL_PROC_DIE
15     C | o when all process call this routine, die cleanly:
16     C | set Error-Flag and call MPI finalise
17     C *==========================================================*
18     C | used before a STOP:
19     C | - Only implemented for MPI multi-proc.
20     C | - if some Proc do not call this S/R, MPI will hang.
21     C *==========================================================*
22    
23     C !USES:
24     IMPLICIT NONE
25    
26     C == Global variables ==
27     #include "SIZE.h"
28     #include "EEPARAMS.h"
29     #include "EESUPPORT.h"
30    
31     C !INPUT/OUTPUT PARAMETERS:
32 jmc 1.6 C myThArg :: thread argument (= my Thread Id number
33     C :: or = 0 if called within single-thread section)
34     INTEGER myThArg
35 jmc 1.1 CEOP
36    
37     C !FUNCTIONS
38     INTEGER ILNBLNK
39     EXTERNAL ILNBLNK
40    
41     C == Local variables ==
42     C msgBuf :: I/O Buffer
43 jmc 1.6 C myThid :: my Thread Id number
44 jmc 1.1 CHARACTER*(MAX_LEN_MBUF) msgBuf
45 jmc 1.6 INTEGER myThid
46 jmc 1.1 #ifdef ALLOW_USE_MPI
47     C mpiRC :: Error code reporting variable used with MPI.
48     INTEGER mpiRC
49     #endif /* ALLOW_USE_MPI */
50    
51 jmc 1.6 myThid = MAX(myThArg,1)
52 jmc 1.1 C-- Print message
53     WRITE(msgBuf,'(A)') 'S/R ALL_PROC_DIE: ending the run'
54     CALL PRINT_ERROR( msgBuf, myThid )
55    
56 jmc 1.6 _BEGIN_MASTER(myThid)
57    
58 jmc 1.1 C-- Finishes
59     eeEndError = .TRUE.
60     fatalError = .TRUE.
61 jmc 1.8
62     C- Flush IO-unit before MPI termination
63     CALL MDS_FLUSH( errorMessageUnit, myThid )
64     c#ifdef ALLOW_USE_MPI
65     CALL MDS_FLUSH( standardMessageUnit, myThid )
66     c#endif /* ALLOW_USE_MPI */
67    
68 jmc 1.1 #ifdef ALLOW_USE_MPI
69 jmc 1.7 C- Note: since MPI_INIT is always called, better to also always terminate MPI
70     C (even if usingMPI=F) --> comment out test on usingMPI
71     c IF ( usingMPI ) THEN
72 jmc 1.3 C better to avoid this call if multi-components set-up ; otherwise will
73     C hang here since procs of other comp. are not calling MPI_finalize now.
74     IF ( .NOT.( useCoupler
75     & .OR. useNEST_PARENT
76     & .OR. useNEST_CHILD )
77     & ) THEN
78 mlosch 1.4 #ifdef ALLOW_OASIS
79     IF ( useOASIS ) CALL OASIS_ABORT
80 jmc 1.5 #endif /* ALLOW_OASIS */
81 jmc 1.1 CALL MPI_FINALIZE ( mpiRC )
82     IF ( mpiRC .NE. MPI_SUCCESS ) THEN
83     WRITE(msgBuf,'(A,I5)')
84     & 'S/R FIN_PROCS: MPI_FINALIZE return code', mpiRC
85     CALL PRINT_ERROR( msgBuf, myThid )
86     ENDIF
87 jmc 1.3 ENDIF
88 jmc 1.7 c ENDIF
89 jmc 1.6 #endif /* ALLOW_USE_MPI */
90    
91     C- Some systems do not always flush the IO buffer to disk.
92     C To fix this, can either close these files (implies not to write
93 jmc 1.8 C anything after) or flush the io-unit (done above).
94 jmc 1.6 c CLOSE( errorMessageUnit )
95 jmc 1.7 #ifdef ALLOW_USE_MPI
96     C- Note: comment out if usingMPI ... since we always open standardMessageUnit
97     C when ALLOW_USE_MPI is defined, better to flush/close also if usingMPI=F
98     cc IF ( usingMPI ) THEN
99 jmc 1.6 c CLOSE( standardMessageUnit )
100 jmc 1.7 cc ENDIF
101     #endif /* ALLOW_USE_MPI */
102 jmc 1.6
103 jmc 1.5 _END_MASTER(myThid)
104 jmc 1.6
105     IF ( myThArg.GE.1 ) THEN
106     _BARRIER
107 jmc 1.1 ENDIF
108    
109     RETURN
110     END

  ViewVC Help
Powered by ViewVC 1.1.22