/[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.3 - (hide annotations) (download)
Wed Oct 28 03:11:34 1998 UTC (25 years, 11 months ago) by cnh
Branch: MAIN
CVS Tags: checkpoint17, checkpoint19, checkpoint18, checkpoint20, checkpoint21, checkpoint16
Changes since 1.2: +8 -6 lines
Changes to support
 - g77 compilation under Linux
 - LR(1) form of 64-bit is D or E for constants
 - Modified adjoint of exch with adjoint variables
   acuumulated.

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

  ViewVC Help
Powered by ViewVC 1.1.22