/[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.5 - (hide annotations) (download)
Tue Aug 30 21:50:29 2011 UTC (12 years, 9 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63c
Changes since 1.4: +4 -2 lines
only master thread does MPI call.

1 jmc 1.5 C $Header: /u/gcmpack/MITgcm/eesupp/src/all_proc_die.F,v 1.4 2010/09/25 23:09:54 mlosch 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     SUBROUTINE ALL_PROC_DIE( myThid )
11    
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     C myThid :: my Thread Id number
33     INTEGER myThid
34     CEOP
35    
36     C !FUNCTIONS
37     INTEGER ILNBLNK
38     EXTERNAL ILNBLNK
39    
40     C == Local variables ==
41     C msgBuf :: I/O Buffer
42     CHARACTER*(MAX_LEN_MBUF) msgBuf
43     #ifdef ALLOW_USE_MPI
44     C mpiRC :: Error code reporting variable used with MPI.
45     INTEGER mpiRC
46     #endif /* ALLOW_USE_MPI */
47    
48     C-- Print message
49     WRITE(msgBuf,'(A)') 'S/R ALL_PROC_DIE: ending the run'
50     CALL PRINT_ERROR( msgBuf, myThid )
51    
52     C-- Finishes
53     eeEndError = .TRUE.
54     fatalError = .TRUE.
55     #ifdef ALLOW_USE_MPI
56     #ifndef ALWAYS_USE_MPI
57     IF ( usingMPI ) THEN
58     #endif
59 jmc 1.5 _BEGIN_MASTER(myThid)
60 jmc 1.3 C better to avoid this call if multi-components set-up ; otherwise will
61     C hang here since procs of other comp. are not calling MPI_finalize now.
62     IF ( .NOT.( useCoupler
63     & .OR. useNEST_PARENT
64     & .OR. useNEST_CHILD )
65     & ) THEN
66 mlosch 1.4 #ifdef ALLOW_OASIS
67     IF ( useOASIS ) CALL OASIS_ABORT
68 jmc 1.5 #endif /* ALLOW_OASIS */
69 jmc 1.1 CALL MPI_FINALIZE ( mpiRC )
70     IF ( mpiRC .NE. MPI_SUCCESS ) THEN
71     WRITE(msgBuf,'(A,I5)')
72     & 'S/R FIN_PROCS: MPI_FINALIZE return code', mpiRC
73     CALL PRINT_ERROR( msgBuf, myThid )
74     ENDIF
75 jmc 1.3 ENDIF
76 jmc 1.5 _END_MASTER(myThid)
77 jmc 1.1 #ifndef ALWAYS_USE_MPI
78     ENDIF
79     #endif
80     #endif /* ALLOW_USE_MPI */
81    
82     RETURN
83     END

  ViewVC Help
Powered by ViewVC 1.1.22