--- MITgcm/eesupp/src/eedie.F 2001/04/10 22:35:24 1.6 +++ MITgcm/eesupp/src/eedie.F 2009/04/22 23:06:01 1.9 @@ -1,26 +1,33 @@ -C $Header: /home/ubuntu/mnt/e9_copy/MITgcm/eesupp/src/eedie.F,v 1.6 2001/04/10 22:35:24 heimbach Exp $ +C $Header: /home/ubuntu/mnt/e9_copy/MITgcm/eesupp/src/eedie.F,v 1.9 2009/04/22 23:06:01 jmc Exp $ C $Name: $ #include "CPP_EEOPTIONS.h" +#ifdef USE_LIBHPM +# include "f_hpm.h" +#endif -CStartOfInterface +CBOP SUBROUTINE EEDIE -C /==========================================================\ +C *==========================================================* C | SUBROUTINE EEDIE | C | o Close execution "environment", particularly perform | C | steps to terminate parallel processing. | -C |==========================================================| +C *==========================================================* C | Note: This routine can also be compiled with CPP | C | directives set so that no multi-processing is initialised| C | This is OK and should work fine. | -C \==========================================================/ +C *==========================================================* IMPLICIT NONE C == Global variables == #include "SIZE.h" #include "EEPARAMS.h" #include "EESUPPORT.h" -CEndOfInterface +CEOP + +C !FUNCTIONS + INTEGER ILNBLNK + EXTERNAL ILNBLNK C == Local variables == C msgBuf - I/O Buffer @@ -28,7 +35,7 @@ C I - Loop counter. CHARACTER*(MAX_LEN_MBUF) msgBuf INTEGER nThreadsDone - INTEGER I + INTEGER I, L #ifdef ALLOW_USE_MPI C mpiRC - Error code reporting variable used C with MPI. @@ -51,13 +58,17 @@ & 'S/R EEDIE: Only ',nThreadsDone, & ' threads have completed, ',nThreads, & ' are expected for this configuration!' - WRITE(*,*) msgBuf + L = ILNBLNK(msgBuf) + WRITE(*,*) msgBuf(1:L) WRITE(*,*) & 'Possibly you have different setenv PARALLEL and nThreads?' eeEndError = .TRUE. fatalError = .TRUE. ENDIF +#ifdef USE_LIBHPM + CALL F_HPMTERMINATE(myProcId) +#endif #ifdef ALLOW_USE_MPI C-- C-- MPI style multiple-process termination @@ -65,6 +76,9 @@ #ifndef ALWAYS_USE_MPI IF ( usingMPI ) THEN #endif +#ifdef COMPONENT_MODULE + IF ( useCoupler) CALL MPI_BARRIER( MPI_COMM_WORLD, mpiRC ) +#endif CALL MPI_FINALIZE ( mpiRC ) IF ( mpiRC .NE. MPI_SUCCESS ) THEN eeEndError = .TRUE.