/[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.7 - (show annotations) (download)
Mon Dec 15 02:02:39 2003 UTC (20 years, 5 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint57m_post, checkpoint52l_pre, hrcube4, hrcube5, checkpoint57g_pre, checkpoint57s_post, checkpoint57b_post, checkpoint57g_post, checkpoint56b_post, checkpoint57y_post, checkpoint52j_pre, checkpoint54d_post, checkpoint54e_post, checkpoint57r_post, checkpoint57d_post, checkpoint57i_post, checkpoint52l_post, checkpoint52k_post, checkpoint55, checkpoint54, checkpoint57, checkpoint56, checkpoint53, checkpoint52f_post, checkpoint57n_post, checkpoint54f_post, checkpoint55i_post, checkpoint57l_post, checkpoint52i_pre, hrcube_1, hrcube_2, hrcube_3, checkpoint57t_post, checkpoint55c_post, checkpoint52e_pre, checkpoint57v_post, checkpoint57f_post, checkpoint52e_post, checkpoint53d_post, checkpoint57a_post, checkpoint57h_pre, checkpoint54b_post, checkpoint57h_post, checkpoint52m_post, checkpoint57y_pre, checkpoint55g_post, checkpoint57c_post, checkpoint52f_pre, checkpoint55d_post, checkpoint54a_pre, checkpoint53c_post, checkpoint55d_pre, checkpoint57c_pre, checkpoint55j_post, checkpoint54a_post, checkpoint55h_post, checkpoint57e_post, checkpoint55b_post, checkpoint53a_post, checkpoint55f_post, checkpoint52d_post, checkpoint53g_post, checkpoint57p_post, checkpint57u_post, checkpoint57q_post, eckpoint57e_pre, checkpoint52i_post, checkpoint52h_pre, checkpoint56a_post, checkpoint53f_post, checkpoint57h_done, checkpoint52j_post, checkpoint57j_post, checkpoint57f_pre, checkpoint52n_post, checkpoint53b_pre, checkpoint56c_post, checkpoint57a_pre, checkpoint55a_post, checkpoint57o_post, checkpoint57k_post, checkpoint53b_post, checkpoint57w_post, checkpoint57x_post, checkpoint53d_pre, checkpoint55e_post, checkpoint54c_post
Changes since 1.6: +5 -2 lines
allow multi-components set-up with a coupler interface and using MPI.

1 C $Header: /u/gcmpack/MITgcm/eesupp/src/eedie.F,v 1.6 2001/04/10 22:35:24 heimbach Exp $
2 C $Name: $
3
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 IMPLICIT NONE
18
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 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 nThreadsDone = 0
46 DO I = 1, nThreads
47 IF ( threadIsComplete(I) ) nThreadsDone = nThreadsDone+1
48 ENDDO
49 IF ( nThreadsDone .LT. nThreads ) THEN
50 WRITE(msgBuf,'(A,I5,A,I5,A)')
51 & 'S/R EEDIE: Only ',nThreadsDone,
52 & ' threads have completed, ',nThreads,
53 & ' are expected for this configuration!'
54 WRITE(*,*) msgBuf
55 WRITE(*,*)
56 & 'Possibly you have different setenv PARALLEL and nThreads?'
57 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 #ifdef COMPONENT_MODULE
69 IF ( useCoupler) CALL MPI_BARRIER( MPI_COMM_WORLD, mpiRC )
70 #endif
71 CALL MPI_FINALIZE ( mpiRC )
72 IF ( mpiRC .NE. MPI_SUCCESS ) THEN
73 eeEndError = .TRUE.
74 fatalError = .TRUE.
75 WRITE(msgBuf,'(A,I5)')
76 & 'S/R FIN_PROCS: MPI_FINALIZE return code',
77 & mpiRC
78 CALL PRINT_ERROR( msgBuf, 1 )
79 ENDIF
80 C
81 #ifndef ALWAYS_USE_MPI
82 ENDIF
83 #endif
84 #endif /* ALLOW_USE_MPI */
85
86
87 RETURN
88 END

  ViewVC Help
Powered by ViewVC 1.1.22