2 # This file is part of the GROMACS molecular simulation package.
4 # Copyright (c) 2012,2013,2014,2015,2018,2019, by the GROMACS development team, led by
5 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 # and including many others, as listed in the AUTHORS file in the
7 # top-level source directory and at http://www.gromacs.org.
9 # GROMACS is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public License
11 # as published by the Free Software Foundation; either version 2.1
12 # of the License, or (at your option) any later version.
14 # GROMACS is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # Lesser General Public License for more details.
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with GROMACS; if not, see
21 # http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 # If you want to redistribute modifications to GROMACS, please
25 # consider that scientific software is very special. Version
26 # control is crucial - bugs must be traceable. We will be happy to
27 # consider code for inclusion in the official distribution, but
28 # derived work must not be called official GROMACS. Details are found
29 # in the README & COPYING files - if they are missing, get the
30 # official version at http://www.gromacs.org.
32 # To help us fund GROMACS development, we humbly ask that you cite
33 # the research papers on the package. Check out http://www.gromacs.org.
36 file(GLOB OPENCL_NB_SOURCES *.cpp)
37 set(NBNXM_SOURCES ${NBNXM_SOURCES} ${OPENCL_NB_SOURCES} PARENT_SCOPE)
41 "-DEL_CUTOFF\;-DEELNAME=_ElecCut"
42 "-DEL_RF\;-DEELNAME=_ElecRF"
43 "-DEL_EWALD_TAB\;-DEELNAME=_ElecEwQSTab"
44 "-DEL_EWALD_TAB\;-DVDW_CUTOFF_CHECK\;-DEELNAME=_ElecEwQSTabTwinCut"
45 "-DEL_EWALD_ANA\;-DEELNAME=_ElecEw"
46 "-DEL_EWALD_ANA\;-DVDW_CUTOFF_CHECK\;-DEELNAME=_ElecEwTwinCut")
49 "-DLJ_COMB_GEOM\;-DVDWNAME=_VdwLJCombGeom"
50 "-DLJ_COMB_LB\;-DVDWNAME=_VdwLJCombLB"
51 "-DLJ_FORCE_SWITCH\;-DVDWNAME=_VdwLJFsw"
52 "-DLJ_POT_SWITCH\;-DVDWNAME=_VdwLJPsw"
53 "-DLJ_EWALD_COMB_GEOM\;-DVDWNAME=_VdwLJEwCombGeom"
54 "-DLJ_EWALD_COMB_LB\;-DVDWNAME=_VdwLJEwCombLB")
56 set(OCL_COMPILER "${CLANG_TIDY_EXE}")
57 # TODO: remove readability-isolate-declaration when the nbnxm OpenCL kernels get modernized
58 set(CLANG_TIDY_ARGS "-quiet;-checks=*,-readability-isolate-declaration,-readability-implicit-bool-conversion,-llvm-header-guard,-hicpp-signed-bitwise,-clang-analyzer-deadcode.DeadStores,-google-readability-todo;--;${CMAKE_C_COMPILER}")
60 set(OCL_COMPILER "${CMAKE_C_COMPILER}")
62 foreach(ELEC_DEF IN LISTS ELEC_DEFS)
63 foreach(VDW_DEF IN LISTS VDW_DEFS)
64 foreach(VENDOR AMD NVIDIA INTEL)
65 if(VENDOR STREQUAL INTEL)
70 string(REGEX REPLACE ".*=" "" ELEC_NAME "${ELEC_DEF}")
71 string(REGEX REPLACE ".*=" "" VDW_NAME "${VDW_DEF}")
72 set(OBJ_FILE nbnxm_ocl_kernel${ELEC_NAME}${VDW_NAME}_${VENDOR}.o)
73 add_custom_command(OUTPUT ${OBJ_FILE} COMMAND ${OCL_COMPILER}
74 ${CMAKE_CURRENT_SOURCE_DIR}/nbnxm_ocl_kernels.cl ${CLANG_TIDY_ARGS}
75 -Xclang -finclude-default-header -D_${VENDOR}_SOURCE_
76 -DGMX_OCL_FASTGEN ${ELEC_DEF} ${VDW_DEF}
77 -DNBNXN_GPU_CLUSTER_SIZE=${CLUSTER_SIZE} -DIATYPE_SHMEM
78 -c -I ${CMAKE_SOURCE_DIR}/src -std=cl1.2
79 -Weverything -Wno-conversion -Wno-missing-variable-declarations -Wno-used-but-marked-unused
80 -Wno-cast-align -Wno-incompatible-pointer-types
83 list(APPEND NBNXM_OCL_KERNELS ${OBJ_FILE})
87 add_custom_target(ocl_nbnxm_kernels DEPENDS ${NBNXM_OCL_KERNELS})