2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2014,2015,2017,2018,2019, by the GROMACS development team.
5 * Copyright (c) 2020,2021, by the GROMACS development team, led by
6 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
7 * and including many others, as listed in the AUTHORS file in the
8 * top-level source directory and at http://www.gromacs.org.
10 * GROMACS is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public License
12 * as published by the Free Software Foundation; either version 2.1
13 * of the License, or (at your option) any later version.
15 * GROMACS is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with GROMACS; if not, see
22 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
23 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 * If you want to redistribute modifications to GROMACS, please
26 * consider that scientific software is very special. Version
27 * control is crucial - bugs must be traceable. We will be happy to
28 * consider code for inclusion in the official distribution, but
29 * derived work must not be called official GROMACS. Details are found
30 * in the README & COPYING files - if they are missing, get the
31 * official version at http://www.gromacs.org.
33 * To help us fund GROMACS development, we humbly ask that you cite
34 * the research papers on the package. Check out http://www.gromacs.org.
36 #ifndef GMX_GPU_UTILS_MACROS_H
37 #define GMX_GPU_UTILS_MACROS_H
41 #include "gromacs/utility/basedefinitions.h" // for gmx_unused
43 /* These macros that let us define inlineable null implementations so
44 that non-GPU Gromacs can run with no overhead without conditionality
45 everywhere a GPU function is called. */
46 #define REAL_FUNC_QUALIFIER
47 #define REAL_FUNC_ARGUMENT(arg) arg
48 #define REAL_FUNC_TERM
49 #define REAL_FUNC_TERM_WITH_RETURN(arg)
51 #define NULL_FUNC_QUALIFIER gmx_unused static
52 #define NULL_FUNC_ARGUMENT(arg) arg gmx_unused
53 #define NULL_FUNC_TERM \
56 #define NULL_FUNC_TERM_WITH_RETURN(arg) \
63 /* Doxygen build appreciates always having argument names, and doesn't
64 * care about duplicate function definitions. */
65 # define GPU_FUNC_QUALIFIER REAL_FUNC_QUALIFIER
66 # define GPU_FUNC_ARGUMENT REAL_FUNC_ARGUMENT
67 # define GPU_FUNC_TERM REAL_FUNC_TERM
68 # define GPU_FUNC_TERM_WITH_RETURN(arg) REAL_FUNC_TERM_WITH_RETURN(arg)
69 # define CUDA_FUNC_QUALIFIER REAL_FUNC_QUALIFIER
70 # define CUDA_FUNC_ARGUMENT REAL_FUNC_ARGUMENT
71 # define CUDA_FUNC_TERM REAL_FUNC_TERM
72 # define CUDA_FUNC_TERM_WITH_RETURN(arg) REAL_FUNC_TERM_WITH_RETURN(arg)
73 # define OPENCL_FUNC_QUALIFIER REAL_FUNC_QUALIFIER
74 # define OPENCL_FUNC_ARGUMENT REAL_FUNC_ARGUMENT
75 # define OPENCL_FUNC_TERM REAL_FUNC_TERM
76 # define OPENCL_FUNC_TERM_WITH_RETURN(arg) REAL_FUNC_TERM_WITH_RETURN(arg)
77 # define SYCL_FUNC_QUALIFIER REAL_FUNC_QUALIFIER
78 # define SYCL_FUNC_ARGUMENT REAL_FUNC_ARGUMENT
79 # define SYCL_FUNC_TERM REAL_FUNC_TERM
80 # define SYCL_FUNC_TERM_WITH_RETURN(arg) REAL_FUNC_TERM_WITH_RETURN(arg)
84 /* GPU support is enabled, so these functions will have real code defined somewhere */
86 # define GPU_FUNC_QUALIFIER REAL_FUNC_QUALIFIER
87 # define GPU_FUNC_ARGUMENT REAL_FUNC_ARGUMENT
88 # define GPU_FUNC_TERM REAL_FUNC_TERM
89 # define GPU_FUNC_TERM_WITH_RETURN(arg) REAL_FUNC_TERM_WITH_RETURN(arg)
91 # define GPU_FUNC_QUALIFIER NULL_FUNC_QUALIFIER
92 # define GPU_FUNC_ARGUMENT NULL_FUNC_ARGUMENT
93 # define GPU_FUNC_TERM NULL_FUNC_TERM
94 # define GPU_FUNC_TERM_WITH_RETURN(arg) NULL_FUNC_TERM_WITH_RETURN(arg)
97 /* Enable and disable platform-specific function implementations */
99 # define OPENCL_FUNC_QUALIFIER REAL_FUNC_QUALIFIER
100 # define OPENCL_FUNC_ARGUMENT REAL_FUNC_ARGUMENT
101 # define OPENCL_FUNC_TERM REAL_FUNC_TERM
102 # define OPENCL_FUNC_TERM_WITH_RETURN(arg) REAL_FUNC_TERM_WITH_RETURN(arg)
104 # define OPENCL_FUNC_QUALIFIER NULL_FUNC_QUALIFIER
105 # define OPENCL_FUNC_ARGUMENT NULL_FUNC_ARGUMENT
106 # define OPENCL_FUNC_TERM NULL_FUNC_TERM
107 # define OPENCL_FUNC_TERM_WITH_RETURN(arg) NULL_FUNC_TERM_WITH_RETURN(arg)
111 # define CUDA_FUNC_QUALIFIER REAL_FUNC_QUALIFIER
112 # define CUDA_FUNC_ARGUMENT REAL_FUNC_ARGUMENT
113 # define CUDA_FUNC_TERM REAL_FUNC_TERM
114 # define CUDA_FUNC_TERM_WITH_RETURN(arg) REAL_FUNC_TERM_WITH_RETURN(arg)
116 # define CUDA_FUNC_QUALIFIER NULL_FUNC_QUALIFIER
117 # define CUDA_FUNC_ARGUMENT NULL_FUNC_ARGUMENT
118 # define CUDA_FUNC_TERM NULL_FUNC_TERM
119 # define CUDA_FUNC_TERM_WITH_RETURN(arg) NULL_FUNC_TERM_WITH_RETURN(arg)
123 # define SYCL_FUNC_QUALIFIER REAL_FUNC_QUALIFIER
124 # define SYCL_FUNC_ARGUMENT REAL_FUNC_ARGUMENT
125 # define SYCL_FUNC_TERM REAL_FUNC_TERM
126 # define SYCL_FUNC_TERM_WITH_RETURN(arg) REAL_FUNC_TERM_WITH_RETURN(arg)
128 # define SYCL_FUNC_QUALIFIER NULL_FUNC_QUALIFIER
129 # define SYCL_FUNC_ARGUMENT NULL_FUNC_ARGUMENT
130 # define SYCL_FUNC_TERM NULL_FUNC_TERM
131 # define SYCL_FUNC_TERM_WITH_RETURN(arg) NULL_FUNC_TERM_WITH_RETURN(arg)
134 #endif // ifdef DOXYGEN
136 #endif // GMX_GPU_UTILS_MACROS_H