Update copyright statements and change license to LGPL
[alexxy/gromacs.git] / include / gmx_wallcycle.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
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, 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.
11  *
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.
16  *
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.
21  *
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.
26  *
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.
34  *
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.
37  */
38
39
40 #ifndef _gmx_wallcycle_h
41 #define _gmx_wallcycle_h
42
43 #include <stdio.h>
44 #include "visibility.h"
45 #include "typedefs.h"
46 #include "types/commrec.h"
47
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51
52 enum { ewcRUN, ewcSTEP, ewcPPDURINGPME, ewcDOMDEC, ewcDDCOMMLOAD,
53        ewcDDCOMMBOUND, ewcVSITECONSTR, ewcPP_PMESENDX, ewcNS, ewcLAUNCH_GPU_NB,
54        ewcMOVEX, ewcGB, ewcFORCE, ewcMOVEF, ewcPMEMESH,
55        ewcPME_REDISTXF, ewcPME_SPREADGATHER, ewcPME_FFT, ewcPME_FFTCOMM, ewcPME_SOLVE,
56        ewcPMEWAITCOMM, ewcPP_PMEWAITRECVF, ewcWAIT_GPU_NB_NL, ewcWAIT_GPU_NB_L, ewcNB_XF_BUF_OPS,
57        ewcVSITESPREAD, ewcTRAJ, ewcUPDATE, ewcCONSTR, ewcMoveE, ewcROT, ewcROTadd,
58        ewcTEST, ewcNR };
59
60 enum { ewcsDD_REDIST, ewcsDD_GRID, ewcsDD_SETUPCOMM,
61        ewcsDD_MAKETOP, ewcsDD_MAKECONSTR, ewcsDD_TOPOTHER,
62        ewcsNBS_GRID_LOCAL, ewcsNBS_GRID_NONLOCAL,
63        ewcsNBS_SEARCH_LOCAL, ewcsNBS_SEARCH_NONLOCAL,
64        ewcsBONDED, ewcsNONBONDED, ewcsEWALD_CORRECTION,
65        ewcsNB_X_BUF_OPS, ewcsNB_F_BUF_OPS,
66        ewcsNR };
67
68 gmx_bool wallcycle_have_counter(void);
69 /* Returns if cycle counting is supported */
70
71 GMX_LIBMD_EXPORT
72 gmx_wallcycle_t wallcycle_init(FILE *fplog, int resetstep, t_commrec *cr, 
73                                int nthreads_pp, int nthreads_pme);
74 /* Returns the wall cycle structure.
75  * Returns NULL when cycle counting is not supported.
76  */
77
78 GMX_LIBMD_EXPORT
79 void wallcycle_start(gmx_wallcycle_t wc, int ewc);
80 /* Starts the cycle counter (and increases the call count) */
81
82 void wallcycle_start_nocount(gmx_wallcycle_t wc, int ewc);
83 /* Starts the cycle counter without increasing the call count */
84
85 GMX_LIBMD_EXPORT
86 double wallcycle_stop(gmx_wallcycle_t wc, int ewc);
87 /* Stop the cycle count for ewc, returns the last cycle count */
88
89 GMX_LIBMD_EXPORT
90 void wallcycle_reset_all(gmx_wallcycle_t wc);
91 /* Resets all cycle counters to zero */
92
93 void wallcycle_sum(t_commrec *cr, gmx_wallcycle_t wc);
94 /* Sum the cycles over the nodes in cr->mpi_comm_mysim */
95
96 void wallcycle_print(FILE *fplog, int nnodes, int npme, double realtime,
97                             gmx_wallcycle_t wc, wallclock_gpu_t *gpu_t);
98 /* Print the cycle and time accounting */
99
100 GMX_LIBMD_EXPORT
101 gmx_large_int_t wcycle_get_reset_counters(gmx_wallcycle_t wc);
102 /* Return reset_counters from wc struct */
103
104 GMX_LIBMD_EXPORT
105 void wcycle_set_reset_counters(gmx_wallcycle_t wc, gmx_large_int_t reset_counters);
106 /* Set reset_counters */
107
108 /* Uncomment the next line to get extra cycle counters of sub parts */
109 /* #define GMX_CYCLE_SUBCOUNTERS */
110
111 #ifdef GMX_CYCLE_SUBCOUNTERS
112
113 void wallcycle_sub_start(gmx_wallcycle_t wc, int ewcs);
114 /* Set the start sub cycle count for ewcs */
115
116 void wallcycle_sub_stop(gmx_wallcycle_t wc, int ewcs);
117 /* Stop the sub cycle count for ewcs */
118
119 #else
120 /* Define the counter call to nothing to avoid any effect on performance */
121 #define wallcycle_sub_start(wc, ewcs)
122 #define wallcycle_sub_stop(wc, ewcs)
123 #endif
124
125 #ifdef __cplusplus
126 }
127 #endif
128
129 #endif /* _gmx_wallcycle_h */