Properly finalize MPI on mdrun -version. Fixes #1313
[gromacs.git] / include / gmx_wallcycle.h
blobb261b3abfe89f8a22abc625a8115c3149a297c06
1 /*
2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2008, The GROMACS development team,
6 * check out http://www.gromacs.org for more information.
7 * Copyright (c) 2012,2013, by the GROMACS development team, led by
8 * David van der Spoel, Berk Hess, Erik Lindahl, and including many
9 * others, as listed in the AUTHORS file in the top-level source
10 * directory and at http://www.gromacs.org.
12 * GROMACS is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public License
14 * as published by the Free Software Foundation; either version 2.1
15 * of the License, or (at your option) any later version.
17 * GROMACS is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with GROMACS; if not, see
24 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
25 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 * If you want to redistribute modifications to GROMACS, please
28 * consider that scientific software is very special. Version
29 * control is crucial - bugs must be traceable. We will be happy to
30 * consider code for inclusion in the official distribution, but
31 * derived work must not be called official GROMACS. Details are found
32 * in the README & COPYING files - if they are missing, get the
33 * official version at http://www.gromacs.org.
35 * To help us fund GROMACS development, we humbly ask that you cite
36 * the research papers on the package. Check out http://www.gromacs.org.
40 #ifndef _gmx_wallcycle_h
41 #define _gmx_wallcycle_h
43 #include <stdio.h>
44 #include "visibility.h"
45 #include "typedefs.h"
46 #include "types/commrec.h"
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
52 enum {
53 ewcRUN, ewcSTEP, ewcPPDURINGPME, ewcDOMDEC, ewcDDCOMMLOAD,
54 ewcDDCOMMBOUND, ewcVSITECONSTR, ewcPP_PMESENDX, ewcNS, ewcLAUNCH_GPU_NB,
55 ewcMOVEX, ewcGB, ewcFORCE, ewcMOVEF, ewcPMEMESH,
56 ewcPME_REDISTXF, ewcPME_SPREADGATHER, ewcPME_FFT, ewcPME_FFTCOMM, ewcPME_SOLVE,
57 ewcPMEWAITCOMM, ewcPP_PMEWAITRECVF, ewcWAIT_GPU_NB_NL, ewcWAIT_GPU_NB_L, ewcNB_XF_BUF_OPS,
58 ewcVSITESPREAD, ewcTRAJ, ewcUPDATE, ewcCONSTR, ewcMoveE, ewcROT, ewcROTadd,
59 ewcTEST, ewcNR
62 enum {
63 ewcsDD_REDIST, ewcsDD_GRID, ewcsDD_SETUPCOMM,
64 ewcsDD_MAKETOP, ewcsDD_MAKECONSTR, ewcsDD_TOPOTHER,
65 ewcsNBS_GRID_LOCAL, ewcsNBS_GRID_NONLOCAL,
66 ewcsNBS_SEARCH_LOCAL, ewcsNBS_SEARCH_NONLOCAL,
67 ewcsBONDED, ewcsNONBONDED, ewcsEWALD_CORRECTION,
68 ewcsNB_X_BUF_OPS, ewcsNB_F_BUF_OPS,
69 ewcsNR
72 gmx_bool wallcycle_have_counter(void);
73 /* Returns if cycle counting is supported */
75 GMX_LIBMD_EXPORT
76 gmx_wallcycle_t wallcycle_init(FILE *fplog, int resetstep, t_commrec *cr,
77 int nthreads_pp, int nthreads_pme);
78 /* Returns the wall cycle structure.
79 * Returns NULL when cycle counting is not supported.
82 GMX_LIBMD_EXPORT
83 void wallcycle_start(gmx_wallcycle_t wc, int ewc);
84 /* Starts the cycle counter (and increases the call count) */
86 void wallcycle_start_nocount(gmx_wallcycle_t wc, int ewc);
87 /* Starts the cycle counter without increasing the call count */
89 GMX_LIBMD_EXPORT
90 double wallcycle_stop(gmx_wallcycle_t wc, int ewc);
91 /* Stop the cycle count for ewc, returns the last cycle count */
93 GMX_LIBMD_EXPORT
94 void wallcycle_reset_all(gmx_wallcycle_t wc);
95 /* Resets all cycle counters to zero */
97 void wallcycle_sum(t_commrec *cr, gmx_wallcycle_t wc);
98 /* Sum the cycles over the nodes in cr->mpi_comm_mysim */
100 void wallcycle_print(FILE *fplog, int nnodes, int npme, double realtime,
101 gmx_wallcycle_t wc, wallclock_gpu_t *gpu_t);
102 /* Print the cycle and time accounting */
104 GMX_LIBMD_EXPORT
105 gmx_large_int_t wcycle_get_reset_counters(gmx_wallcycle_t wc);
106 /* Return reset_counters from wc struct */
108 GMX_LIBMD_EXPORT
109 void wcycle_set_reset_counters(gmx_wallcycle_t wc, gmx_large_int_t reset_counters);
110 /* Set reset_counters */
112 /* Uncomment the next line to get extra cycle counters of sub parts */
113 /* #define GMX_CYCLE_SUBCOUNTERS */
115 #ifdef GMX_CYCLE_SUBCOUNTERS
117 void wallcycle_sub_start(gmx_wallcycle_t wc, int ewcs);
118 /* Set the start sub cycle count for ewcs */
120 void wallcycle_sub_stop(gmx_wallcycle_t wc, int ewcs);
121 /* Stop the sub cycle count for ewcs */
123 #else
124 /* Define the counter call to nothing to avoid any effect on performance */
125 #define wallcycle_sub_start(wc, ewcs)
126 #define wallcycle_sub_stop(wc, ewcs)
127 #endif
129 #ifdef __cplusplus
131 #endif
133 #endif /* _gmx_wallcycle_h */