Gromacs  2024.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Typedefs | Enumerations | Functions | Variables
pmetestcommon.h File Reference
#include <array>
#include <map>
#include <optional>
#include <vector>
#include "gromacs/ewald/pme.h"
#include "gromacs/ewald/pme_gpu_internal.h"
#include "gromacs/math/gmxcomplex.h"
#include "gromacs/mdtypes/state_propagator_data_gpu.h"
#include "gromacs/utility/message_string_collector.h"
#include "gromacs/utility/range.h"
#include "gromacs/utility/unique_cptr.h"
#include "testutils/test_device.h"
+ Include dependency graph for pmetestcommon.h:
+ This graph shows which files directly or indirectly include this file:


Describes common routines and types for PME tests.

Aleksei Iupinov
Mark Abraham


class  gmx::ArrayRef< typename >
 STL-like interface to a C array of T (or part of a std container of T). More...


typedef gmx::unique_cptr
< gmx_pme_t, gmx_pme_destroy
 A safe pointer type for PME.
typedef std::vector< realgmx::test::ChargesVector
typedef std::vector< RVec > gmx::test::CoordinatesVector
typedef ArrayRef< RVec > gmx::test::ForcesVector
typedef std::vector< IVec > gmx::test::GridLineIndicesVector
 Gridline indices.
typedef ArrayRef< const realgmx::test::SplineParamsDimVector
 Spline parameters (theta or dtheta). A reference to a single dimension's spline data; this means (atomCount * pmeOrder) values or derivatives.
typedef std::array
< SplineParamsDimVector, DIM > 
 Spline parameters (theta or dtheta) in all 3 dimensions.
template<typename ValueType >
using gmx::test::SparseGridValuesInput = std::map< IVec, ValueType >
 Non-zero grid values for test input; keys are 3d indices (IVec)
typedef SparseGridValuesInput
< real
 Non-zero real grid values.
typedef SparseGridValuesInput
< t_complex > 
 Non-zero complex grid values.
template<typename ValueType >
using gmx::test::SparseGridValuesOutput = std::map< std::string, ValueType >
 Non-zero grid values for test output; keys are string representations of the cells' 3d indices (IVec); this allows for better sorting.
typedef SparseGridValuesOutput
< real
 Non-zero real grid values.
typedef SparseGridValuesOutput
< t_complex > 
 Non-zero complex grid values.
typedef std::array< real, DIM
*DIM > 
 TODO: make proper C++ matrix for the whole Gromacs, get rid of this.


enum  gmx::test::CodePath : int { gmx::test::CodePath::CPU, gmx::test::CodePath::GPU, gmx::test::CodePath::Count }
 Hardware code path being tested. More...
enum  gmx::test::PmeSolveAlgorithm : int { gmx::test::PmeSolveAlgorithm::Coulomb, gmx::test::PmeSolveAlgorithm::LennardJones, gmx::test::PmeSolveAlgorithm::Count }
 PME solver type. More...


MessageStringCollector gmx::test::getSkipMessagesIfNecessary (const t_inputrec &inputRec, CodePath mode)
 Returns message describing why PME in this mode is not supported for this inputRec, or empty of messages when PME is supported.
uint64_t gmx::test::getSplineModuliDoublePrecisionUlps (int splineOrder)
 For double precision checks, the recursive interpolation and use of trig functions in make_dft_mod require a lot more flops, and thus opportunity for deviation between implementations.
PmeSafePointer gmx::test::pmeInitWrapper (const t_inputrec *inputRec, const CodePath mode, const DeviceContext *deviceContext, const DeviceStream *deviceStream, const PmeGpuProgram *pmeGpuProgram, const Matrix3x3 &box, const real ewaldCoeff_q, const real ewaldCoeff_lj)
 PME initialization.
PmeSafePointer gmx::test::pmeInitEmpty (const t_inputrec *inputRec)
 Simple PME initialization based on inputrec only.
< StatePropagatorDataGpu > 
gmx::test::makeStatePropagatorDataGpu (const gmx_pme_t &pme, const DeviceContext *deviceContext, const DeviceStream *deviceStream)
 Make a GPU state-propagator manager.
void gmx::test::pmeInitAtoms (gmx_pme_t *pme, StatePropagatorDataGpu *stateGpu, const CodePath mode, const CoordinatesVector &coordinates, const ChargesVector &charges)
 PME initialization with atom data. More...
void gmx::test::pmePerformSplineAndSpread (gmx_pme_t *pme, CodePath mode, bool computeSplines, bool spreadCharges)
 PME spline calculation and charge spreading. More...
void gmx::test::pmePerformSolve (const gmx_pme_t *pme, CodePath mode, PmeSolveAlgorithm method, real cellVolume, GridOrdering gridOrdering, bool computeEnergyAndVirial)
 PME solving.
void gmx::test::pmePerformGather (gmx_pme_t *pme, CodePath mode, ForcesVector &forces)
 PME force gathering.
void gmx::test::pmeFinalizeTest (const gmx_pme_t *pme, CodePath mode)
 PME test finalization before fetching the outputs.
void gmx::test::pmeSetSplineData (const gmx_pme_t *pme, CodePath mode, const SplineParamsDimVector &splineValues, PmeSplineDataType type, int dimIndex)
 Setting atom spline values/derivatives to be used in spread/gather. More...
void gmx::test::pmeSetGridLineIndices (gmx_pme_t *pme, CodePath mode, const GridLineIndicesVector &gridLineIndices)
 Setting gridline indices to be used in spread/gather. More...
void gmx::test::pmeSetRealGrid (const gmx_pme_t *pme, CodePath mode, const SparseRealGridValuesInput &gridValues)
 Setting real grid to be used in gather.
void gmx::test::pmeSetComplexGrid (const gmx_pme_t *pme, CodePath mode, GridOrdering gridOrdering, const SparseComplexGridValuesInput &gridValues)
 Setting complex grid to be used in solve.
SplineParamsDimVector gmx::test::pmeGetSplineData (const gmx_pme_t *pme, CodePath mode, PmeSplineDataType type, int dimIndex)
 Getting the single dimension's spline values or derivatives.
GridLineIndicesVector gmx::test::pmeGetGridlineIndices (const gmx_pme_t *pme, CodePath mode)
 Getting the gridline indices.
SparseRealGridValuesOutput gmx::test::pmeGetRealGrid (const gmx_pme_t *pme, CodePath mode)
 Getting the real grid (spreading output of pmePerformSplineAndSpread())
SparseComplexGridValuesOutput gmx::test::pmeGetComplexGrid (const gmx_pme_t *pme, CodePath mode, GridOrdering gridOrdering)
 Getting the complex grid output of pmePerformSolve()
PmeOutput gmx::test::pmeGetReciprocalEnergyAndVirial (const gmx_pme_t *pme, CodePath mode, PmeSolveAlgorithm method)
 Getting the reciprocal energy and virial.
ArrayRef< const
PmeTestHardwareContext > 
gmx::test::getPmeTestHardwareContexts ()
 Return a view of the current PME test hardware contexts.
std::string gmx::test::makeRefDataFileName ()
 Construct a refdata filename for a test. More...
std::string gmx::test::makeHardwareContextName (int hardwareContextIndex)
 Make a terse description of the hardware context suitable for use in naming the test case. More...
void gmx::test::registerDynamicalPmeSplineSpreadTests (Range< int > contextIndexRange)
 Functions that dynamically register test cases. More...
void gmx::test::registerDynamicalPmeSolveTests (const Range< int > hardwareContextIndexRange)
void gmx::test::registerDynamicalPmeGatherTests (const Range< int > hardwareContextIndexRange)


constexpr int64_t gmx::test::c_splineModuliSinglePrecisionUlps = 1
 Spline moduli are computed in double precision, so they're very good in single precision.