Gromacs
2019.3
|
#include "gmxpre.h"
#include <stdlib.h>
#include <cassert>
#include <string>
#include "gromacs/gpu_utils/gpu_utils.h"
#include "gromacs/gpu_utils/ocl_compiler.h"
#include "gromacs/mdlib/nbnxn_consts.h"
#include "gromacs/mdlib/nbnxn_gpu.h"
#include "gromacs/mdlib/nbnxn_gpu_jit_support.h"
#include "gromacs/mdtypes/interaction_const.h"
#include "gromacs/mdtypes/md_enums.h"
#include "gromacs/pbcutil/ishift.h"
#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/stringutil.h"
#include "nbnxn_ocl_types.h"
Defines functions that support JIT compilation (e.g. for OpenCL)
Macros | |
#define | STRINGIFY_PARAM(c) #c |
Stringifies the input argument. | |
#define | STRINGIFY_MACRO(c) STRINGIFY_PARAM(c) |
Stringifies the result of expansion of a macro argument. | |
Functions | |
static std::string | makeDefinesForKernelTypes (bool bFastGen, int eeltype, int vdwtype) |
Returns a string with the compiler defines required to avoid all flavour generation. More... | |
void | nbnxn_gpu_compile_kernels (gmx_nbnxn_ocl_t *nb) |
Compiles nbnxn kernels for OpenCL GPU given by mygpu . More... | |
Variables | |
static const char * | kernel_electrostatic_family_definitions [] |
Array of the defines needed to generate a specific eel flavour. More... | |
static const char * | kernel_VdW_family_definitions [] |
Array of the defines needed to generate a specific vdw flavour. More... | |
|
static |
Returns a string with the compiler defines required to avoid all flavour generation.
For example if flavour eelOclRF with evdwOclFSWITCH, the output will be such that the corresponding kernel flavour is generated: -DGMX_OCL_FASTGEN (will replace flavour generator nbnxn_ocl_kernels.clh with nbnxn_ocl_kernels_fastgen.clh) -DEL_RF (The eelOclRF flavour) -DEELNAME=_ElecRF (The first part of the generated kernel name ) -DLJ_EWALD_COMB_GEOM (The evdwOclFSWITCH flavour) -DVDWNAME=_VdwLJEwCombGeom (The second part of the generated kernel name )
prune/energy are still generated as originally. It is only the the flavour-level that has changed, so that only the required flavour for the simulation is compiled.
If eeltype is single-range Ewald, then we need to add the twin-cutoff flavour kernels to the JIT, because PME tuning might need it. This path sets -DGMX_OCL_FASTGEN_ADD_TWINCUT, which triggers the use of nbnxn_ocl_kernels_fastgen_add_twincut.clh. This hard-codes the generation of extra kernels that have the same base flavour, and add the required -DVDW_CUTOFF_CHECK and "TwinCut" to the kernel name.
If FastGen is not active, then nothing needs to be returned. The JIT defaults to compiling all kernel flavours.
[in] | bFastGen | Whether FastGen should be used |
[in] | eeltype | Electrostatics kernel flavour for FastGen |
[in] | vdwtype | VDW kernel flavour for FastGen |
std::bad_alloc | if out of memory |
void nbnxn_gpu_compile_kernels | ( | gmx_nbnxn_ocl_t * | nb | ) |
Compiles nbnxn kernels for OpenCL GPU given by mygpu
.
With OpenCL, a call to this function must not precede nbnxn_gpu_init() (which also calls it).
Doing bFastGen means only the requested kernels are compiled, significantly reducing the total compilation time. If false, all OpenCL kernels are compiled.
A fatal error results if compilation fails.
[in,out] | nb | Manages OpenCL non-bonded calculations; compiled kernels returned in dev_info members |
Does not throw
|
static |
Array of the defines needed to generate a specific eel flavour.
The twin-cutoff entries are not normally used, because those setups are not available to the user. FastGen takes care of generating both single- and twin-cutoff versions because PME tuning might need both.
|
static |
Array of the defines needed to generate a specific vdw flavour.