/[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.5 - (hide annotations) (download)
Sun Feb 4 14:38:43 2001 UTC (23 years, 5 months ago) by cnh
Branch: MAIN
CVS Tags: pre38tag1, c37_adj, pre38-close, checkpoint37, checkpoint36, checkpoint35
Branch point for: pre38
Changes since 1.4: +2 -1 lines
Made sure each .F and .h file had
the CVS keywords Header and Name at its start.
Most had header but very few currently have Name, so
lots of changes!

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

  ViewVC Help
Powered by ViewVC 1.1.22