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

Contents of /MITgcm/eesupp/src/eedie.F

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


Revision 1.1 - (show annotations) (download)
Wed Apr 22 19:15:30 1998 UTC (26 years ago) by cnh
Branch: MAIN
Branch point for: cnh
Initial revision

1 C $Id$
2
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 C are not right for this code. In the latter case different directives
41 C may be available or the compiler itself may have a bug or you may
42 C need a different parallel compiler for main.F
43 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 & ' threads have completed, ',nThreads,' are expected for this configuration!'
51 WRITE(0,*) msgBuf
52 WRITE(0,*) 'Possibly you have different values of setenv PARALLEL and nThreads?'
53 eeEndError = .TRUE.
54 fatalError = .TRUE.
55 ENDIF
56
57 #ifdef ALLOW_USE_MPI
58 C--
59 C-- MPI style multiple-process termination
60 C-- ======================================
61 #ifndef ALWAYS_USE_MPI
62 IF ( usingMPI ) THEN
63 #endif
64 CALL MPI_FINALIZE ( mpiRC )
65 IF ( mpiRC .NE. MPI_SUCCESS ) THEN
66 eeEndError = .TRUE.
67 fatalError = .TRUE.
68 WRITE(msgBuf,'(A,I)')
69 & 'S/R FIN_PROCS: MPI_FINALIZE return code',
70 & mpiRC
71 CALL PRINT_ERROR( msgBuf, 1 )
72 ENDIF
73 C
74 #ifndef ALWAYS_USE_MPI
75 ENDIF
76 #endif
77 #endif /* ALLOW_USE_MPI */
78
79
80 RETURN
81 END

  ViewVC Help
Powered by ViewVC 1.1.22