Gromacs  2025-dev-20240710-afbd73d
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Functions | Variables
simd_kernel.h File Reference
#include "gmxpre.h"
#include "config.h"
#include "gromacs/pbcutil/ishift.h"
#include "gromacs/simd/simd.h"
#include "gromacs/simd/simd_math.h"
#include "gromacs/simd/vector_operations.h"
#include "kernel_common.h"
#include "nbnxm_simd.h"
#include "simd_coulomb_functions.h"
#include "simd_diagonal_masker.h"
#include "simd_energy_accumulator.h"
#include "simd_lennardjones_functions.h"
#include "simd_load_store_functions.h"
#include "simd_kernel_inner.h"
+ Include dependency graph for simd_kernel.h:


Declares and defines the NBNxM SIMD pair interaction kernel function.

This definition is in an include file and not in a source file to enable parallel compilation of different template instantiations in different compilation units. The compilation units and a kernel lookup table are currently manually generated offline by a python script (not at build time) any time something changes in the interface.

This kernel makes uses of many, templated, helper classes, so this file can contain only the skeleton of the outer part of the kernel. The inner loop of the SIMD kernel is defined in simd_kernel_inner.h, which is currently included six times in the simdKernelInner() function to optimize performance for different properties on pair list entries.

Many, but not all, combinations of the Cartesian product of the different possible values of all template parameters are instantiated for this kernel. In particular, vdwCutoffCheck is only enabled with Ewald type electrostatics and only certain combinations of ljCombinationRule and vdwModifier are used.

Which kernel layouts are instantiated depends on the extent of SIMD support of the architecture and on which layouts are assumed to produce the best peformance. Currently we have two kernel layouts:

Berk Hess


class  gmx::anonymous_namespace{simd_kernel.h}::EnergyAccumulatorGetter< haveEnergyGroups, computeEnergies >
 General template for EnergyAccumulator getter, only specializations are used. More...
class  gmx::anonymous_namespace{simd_kernel.h}::EnergyAccumulatorGetter< false, false >
 Specialized EnergyAccumulator getter for no energy output. More...
class  gmx::anonymous_namespace{simd_kernel.h}::EnergyAccumulatorGetter< false, true >
 Specialized EnergyAccumulator getter for single energy group output. More...
class  gmx::anonymous_namespace{simd_kernel.h}::EnergyAccumulatorGetter< true, true >
 Specialized EnergyAccumulator getter for multiple energy groups output. More...


template<KernelLayout kernelLayout, KernelCoulombType coulombType, VdwCutoffCheck vdwCutoffCheck, LJCombinationRule ljCombinationRule, InteractionModifiers vdwModifier, LJEwald ljEwald, EnergyOutput energyOutput>
void gmx::nbnxmKernelSimd (const NbnxnPairlistCpu *nbl, const nbnxn_atomdata_t *nbat, const interaction_const_t *ic, const rvec *shift_vec, nbnxn_atomdata_output_t *out)
 The actual NBNxM SIMD kernel. More...


static constexpr bool gmx::sc_calculateShiftForces = true
 Whether we calculate shift forces, always true, because it's cheap anyhow.
static EnergyAccumulator
< false, false > 
 Energy accumulator without data members can be static.