/[MITgcm]/MITgcm/pkg/compon_communic/mitcplr_all_check.F
ViewVC logotype

Contents of /MITgcm/pkg/compon_communic/mitcplr_all_check.F

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


Revision 1.1 - (show annotations) (download)
Mon Dec 2 21:35:45 2013 UTC (10 years, 5 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, 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, checkpoint65, HEAD
add S/R to check and stop if any proc has an error (similar to
 eesupp/src/stop_if_error.F but across Comm_World and single thread)

1 C $Header: /u/gcmpack/MITgcm/pkg/compon_communic/mitcplr_initcomp.F,v 1.2 2007/10/08 23:58:21 jmc Exp $
2 C $Name: $
3
4 CBOP
5 C !INTERFACE:
6 SUBROUTINE MITCPLR_ALL_CHECK( errFlag, errMsg )
7
8 C !DESCRIPTION:
9 C *==========================================================*
10 C | SUBROUTINE MITCPLR_ALL_CHECK
11 C | o Stop every Processes in World if flag is true
12 C *==========================================================*
13 C | Gather error-flag from all processes in World and
14 C | stop if one is in error. This assumes that every-one
15 C | (all coupler procs and all components) call this routine
16 C *==========================================================*
17
18 IMPLICIT NONE
19
20 C Predefined constants/arrays
21 #include "CPLR_SIG.h"
22 C MPI variables
23 #include "mpif.h"
24
25 C !INPUT/OUTPUT PARAMETERS:
26 C errFlag :: stop if this logical flag is true
27 C errMsg :: error message to print in case it stops
28 LOGICAL errFlag
29 CHARACTER*(*) errMsg
30
31 C !LOCAL VARIABLES:
32 C msgBuf :: I/O Buffer
33 C errCount :: error counter
34 c CHARACTER*(MAX_LEN_MBUF) msgBuf
35 INTEGER errCount, errLoc, mpiRC
36 CEOP
37
38 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
39
40 C-- Collect error from all Procs
41 errLoc = 0
42 IF ( errFlag ) THEN
43 errLoc = 1
44 ENDIF
45 CALL MPI_Allreduce( errLoc, errCount, 1, MPI_INTEGER, MPI_SUM,
46 & MPI_COMM_WORLD, mpiRC )
47
48 IF ( errCount.GE.1 ) THEN
49 C-- Print message
50 IF ( errFlag .AND. errMsg.NE.' ' ) THEN
51 WRITE(LogUnit,'(2A)') ' *** ERROR *** ', errMsg
52 ENDIF
53 WRITE(LogUnit,'(A,I8,A)')
54 & 'FATAL ERROR for ', errCount, ' Proc(s) ==> Stop here'
55 C-- Finishes
56 c CALL ALL_PROC_DIE( myThid )
57 CALL MPI_FINALIZE( mpiRC )
58 STOP 'ABNORMAL END: S/R MITCPLR_ALL_CHECK'
59 ENDIF
60
61 RETURN
62 END

  ViewVC Help
Powered by ViewVC 1.1.22