/[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.8 - (hide annotations) (download)
Thu Dec 22 00:56:49 2005 UTC (19 years, 6 months ago) by ce107
Branch: MAIN
CVS Tags: checkpoint58b_post, checkpoint59, checkpoint58, checkpoint58f_post, checkpoint58d_post, checkpoint58a_post, checkpoint57z_post, checkpoint58y_post, checkpoint58t_post, checkpoint58m_post, checkpoint60, checkpoint61, checkpoint58w_post, checkpoint58o_post, checkpoint58p_post, checkpoint58q_post, checkpoint58e_post, mitgcm_mapl_00, checkpoint58r_post, checkpoint58n_post, checkpoint59q, checkpoint59p, checkpoint59r, checkpoint59e, checkpoint59d, checkpoint59g, checkpoint59f, checkpoint59a, checkpoint59c, checkpoint59b, checkpoint59m, checkpoint59l, checkpoint59o, checkpoint59n, checkpoint59i, checkpoint59h, checkpoint59k, checkpoint58k_post, checkpoint58v_post, checkpoint58l_post, checkpoint61f, checkpoint58g_post, checkpoint58x_post, checkpoint59j, checkpoint58h_post, checkpoint58j_post, checkpoint61e, checkpoint58i_post, checkpoint58c_post, checkpoint58u_post, checkpoint58s_post, checkpoint61g, checkpoint61d, checkpoint61b, checkpoint61c, checkpoint61a, checkpoint61l, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i
Changes since 1.7: +7 -1 lines
Added calls to initialize and finalize the HPM Toolkit for performance
counters (currently working under AIX and Linux/PPC). One sets the
environment variable HPM_EVENT_SET to a value 1(default)-4 for Power3 systems
and 0-60(default) for Power4. All sections timed by calls to timer_start
and timer_stop would also be monitored for the specified event set. If the
number of monitored sections is more than 100 then the environment variable
HPM_NUM_INST_PTS needs to be adjusted appropriately. In the case of multi-
threaded code there cannot be more than 99 timed sections and HPM_NUM_INST_PTS
should be adjusted to 100*(#_of_threads -1). At the end of the code's
execution the HPM Toolkit generates a set of files hpm*.viz and perfhpm*.*
that can be further analyzed. For more information look at
http://www.research.ibm.com/actc/projects/hardwareperf2.shtml
Currently needs to have declared HPMTINC and HPMTLIB in the optfile for
the include and library linking strings needed to use HPMT.

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

  ViewVC Help
Powered by ViewVC 1.1.22