Code beautification with uncrustify
[alexxy/gromacs.git] / src / gromacs / legacyheaders / nbnxn_cuda_data_mgmt.h
1 /* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
2  *
3  *
4  *                This source code is part of
5  *
6  *                 G   R   O   M   A   C   S
7  *
8  *          GROningen MAchine for Chemical Simulations
9  *
10  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12  * Copyright (c) 2001-2012, The GROMACS development team,
13  * check out http://www.gromacs.org for more information.
14  *
15  * This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public License
17  * as published by the Free Software Foundation; either version 2
18  * of the License, or (at your option) any later version.
19  *
20  * If you want to redistribute modifications, please consider that
21  * scientific software is very special. Version control is crucial -
22  * bugs must be traceable. We will be happy to consider code for
23  * inclusion in the official distribution, but derived work must not
24  * be called official GROMACS. Details are found in the README & COPYING
25  * files - if they are missing, get the official version at www.gromacs.org.
26  *
27  * To help us fund GROMACS development, we humbly ask that you cite
28  * the papers on the package - you can find them in the top README file.
29  *
30  * For more info, check our website at http://www.gromacs.org
31  *
32  * And Hey:
33  * Gallium Rubidium Oxygen Manganese Argon Carbon Silicon
34  */
35
36 #ifndef NBNXN_CUDA_DATA_MGMT_H
37 #define NBNXN_CUDA_DATA_MGMT_H
38
39 #include "types/simple.h"
40 #include "types/interaction_const.h"
41 #include "types/nbnxn_cuda_types_ext.h"
42 #include "types/hw_info.h"
43
44 #ifdef GMX_GPU
45 #define FUNC_TERM ;
46 #define FUNC_QUALIFIER
47 #else
48 #define FUNC_TERM {}
49 #define FUNC_QUALIFIER static
50 #endif
51
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55
56 /*! Initializes the data structures related to CUDA nonbonded calculations. */
57 FUNC_QUALIFIER
58 void nbnxn_cuda_init(FILE *fplog,
59                      nbnxn_cuda_ptr_t *p_cu_nb,
60                      gmx_gpu_info_t *gpu_info, int my_gpu_index,
61                      /* true of both local and non-local are don on GPU */
62                      gmx_bool bLocalAndNonlocal) FUNC_TERM
63
64 /*! Initializes simulation constant data. */
65 FUNC_QUALIFIER
66 void nbnxn_cuda_init_const(nbnxn_cuda_ptr_t           p_cu_nb,
67                            const interaction_const_t *ic,
68                            const nonbonded_verlet_t  *nbv) FUNC_TERM
69
70 /*! Initializes pair-list data for GPU, called at every pair search step. */
71 FUNC_QUALIFIER
72 void nbnxn_cuda_init_pairlist(nbnxn_cuda_ptr_t        cu_nb,
73                               const nbnxn_pairlist_t *h_nblist,
74                               int                     iloc) FUNC_TERM
75
76 /*! Initializes atom-data on the GPU, called at every pair search step. */
77 FUNC_QUALIFIER
78 void nbnxn_cuda_init_atomdata(nbnxn_cuda_ptr_t        cu_nb,
79                               const nbnxn_atomdata_t *atomdata) FUNC_TERM
80
81 /*! \brief Update parameters during PP-PME load balancing. */
82 FUNC_QUALIFIER
83 void nbnxn_cuda_pme_loadbal_update_param(nbnxn_cuda_ptr_t           cu_nb,
84                                          const interaction_const_t *ic) FUNC_TERM
85
86 /*! Uploads shift vector to the GPU if the box is dynamic (otherwise just returns). */
87 FUNC_QUALIFIER
88 void nbnxn_cuda_upload_shiftvec(nbnxn_cuda_ptr_t        cu_nb,
89                                 const nbnxn_atomdata_t *nbatom) FUNC_TERM
90
91 /*! Clears GPU outputs: nonbonded force, shift force and energy. */
92 FUNC_QUALIFIER
93 void nbnxn_cuda_clear_outputs(nbnxn_cuda_ptr_t cu_nb,
94                               int              flags) FUNC_TERM
95
96 /*! Frees all GPU resources used for the nonbonded calculations. */
97 FUNC_QUALIFIER
98 void nbnxn_cuda_free(FILE            *fplog,
99                      nbnxn_cuda_ptr_t cu_nb) FUNC_TERM
100
101 /*! Returns the GPU timings structure or NULL if GPU is not used or timing is off. */
102 FUNC_QUALIFIER
103 wallclock_gpu_t * nbnxn_cuda_get_timings(nbnxn_cuda_ptr_t cu_nb)
104 #ifdef GMX_GPU
105 ;
106 #else
107 {
108     return NULL;
109 }
110 #endif
111
112 /*! Resets nonbonded GPU timings. */
113 FUNC_QUALIFIER
114 void nbnxn_cuda_reset_timings(nbnxn_cuda_ptr_t cu_nb) FUNC_TERM
115
116 /*! Calculates the minimum size of proximity lists to improve SM load balance
117     with CUDA non-bonded kernels. */
118 FUNC_QUALIFIER
119 int nbnxn_cuda_min_ci_balanced(nbnxn_cuda_ptr_t cu_nb)
120 #ifdef GMX_GPU
121 ;
122 #else
123 {
124     return -1;
125 }
126 #endif
127
128 #ifdef __cplusplus
129 }
130 #endif
131
132 #undef FUNC_TERM
133 #undef FUNC_QUALIFIER
134
135 #endif /* NBNXN_CUDA_DATA_MGMT_H */