Gromacs  2024.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Enumerations | Functions | Variables
pmetestcommon.cpp File Reference
#include "gmxpre.h"
#include "pmetestcommon.h"
#include <cstring>
#include <algorithm>
#include "gromacs/domdec/domdec.h"
#include "gromacs/ewald/pme_coordinate_receiver_gpu.h"
#include "gromacs/ewald/pme_gather.h"
#include "gromacs/ewald/pme_gpu_calculate_splines.h"
#include "gromacs/ewald/pme_gpu_constants.h"
#include "gromacs/ewald/pme_gpu_internal.h"
#include "gromacs/ewald/pme_gpu_staging.h"
#include "gromacs/ewald/pme_grid.h"
#include "gromacs/ewald/pme_internal.h"
#include "gromacs/ewald/pme_redistribute.h"
#include "gromacs/ewald/pme_solve.h"
#include "gromacs/ewald/pme_spread.h"
#include "gromacs/fft/parallel_3dfft.h"
#include "gromacs/gpu_utils/gpu_utils.h"
#include "gromacs/math/boxmatrix.h"
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/topology/topology.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/logger.h"
#include "gromacs/utility/stringutil.h"
#include "testutils/test_hardware_environment.h"
#include "testutils/testasserts.h"
#include "testutils/testinit.h"
+ Include dependency graph for pmetestcommon.cpp:

Description

Implements common routines for PME tests.

Author
Aleksei Iupinov a.yup.nosp@m.inov.nosp@m.@gmai.nosp@m.l.co.nosp@m.m
Mark Abraham mark..nosp@m.j.ab.nosp@m.raham.nosp@m.@gma.nosp@m.il.co.nosp@m.m

Enumerations

enum  gmx::test::PmeLayoutTransform { GpuToHost, HostToGpu }
 A binary enum for spline data layout transformation.
 

Functions

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.
 
std::unique_ptr
< 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...
 
static realgmx::test::pmeGetRealGridInternal (const gmx_pme_t *pme)
 Getting local PME real grid pointer for test I/O.
 
static void gmx::test::pmeGetRealGridSizesInternal (const gmx_pme_t *pme, CodePath mode, IVec &gridSize, IVec &paddedGridSize)
 Getting local PME real grid dimensions.
 
static t_complex * gmx::test::pmeGetComplexGridInternal (const gmx_pme_t *pme)
 Getting local PME complex grid pointer for test I/O.
 
static void gmx::test::pmeGetComplexGridSizesInternal (const gmx_pme_t *pme, IVec &gridSize, IVec &paddedGridSize)
 Getting local PME complex grid dimensions.
 
template<typename ValueType >
static void gmx::test::pmeGetGridAndSizesInternal (const gmx_pme_t *, CodePath, ValueType *&, IVec &, IVec &)=delete
 Getting the PME grid memory buffer and its sizes - template definition.
 
template<>
void gmx::test::pmeGetGridAndSizesInternal< real > (const gmx_pme_t *pme, CodePath mode, real *&grid, IVec &gridSize, IVec &paddedGridSize)
 Getting the PME real grid memory buffer and its sizes.
 
template<>
void gmx::test::pmeGetGridAndSizesInternal< t_complex > (const gmx_pme_t *pme, CodePath, t_complex *&grid, IVec &gridSize, IVec &paddedGridSize)
 Getting the PME complex grid memory buffer and its sizes.
 
void gmx::test::pmePerformSplineAndSpread (gmx_pme_t *pme, CodePath mode, bool computeSplines, bool spreadCharges)
 PME spline calculation and charge spreading. More...
 
static realgmx::test::pmeGetSplineDataInternal (const gmx_pme_t *pme, PmeSplineDataType type, int dimIndex)
 Getting the internal spline data buffer pointer.
 
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.
 
static int gmx::test::getSplineParamFullIndex (int order, int splineIndex, int dimIndex, int atomIndex, int atomsPerWarp)
 Gets a unique index to an element in a spline parameter buffer. More...
 
static void gmx::test::pme_gpu_transform_spline_atom_data (const PmeGpu *pmeGpu, const PmeAtomComm *atc, PmeSplineDataType type, int dimIndex, PmeLayoutTransform transform)
 Rearranges the atom spline data between the GPU and host layouts. Only used for test purposes so far, likely to be horribly slow. More...
 
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...
 
size_t gmx::test::pmeGetGridPlainIndexInternal (const IVec &index, const IVec &paddedGridSize, GridOrdering gridOrdering)
 Getting plain index into the complex 3d grid.
 
template<typename ValueType >
static void gmx::test::pmeSetGridInternal (const gmx_pme_t *pme, CodePath mode, GridOrdering gridOrdering, const SparseGridValuesInput< ValueType > &gridValues)
 Setting real or complex grid.
 
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.
 
template<typename ValueType >
static SparseGridValuesOutput
< ValueType > 
gmx::test::pmeGetGridInternal (const gmx_pme_t *pme, CodePath mode, GridOrdering gridOrdering)
 Getting real or complex grid - only non zero values.
 
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.
 
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...
 
ArrayRef< const
PmeTestHardwareContext > 
gmx::test::getPmeTestHardwareContexts ()
 Return a view of the current PME test hardware contexts.
 
void gmx::test::registerTestsDynamically ()
 Declaration of function used to dynamically register GoogleTest tests. More...
 

Variables

const std::map< std::string,
Matrix3x3 > 
gmx::test::c_inputBoxes
 A couple of valid inputs for boxes. More...
 
std::vector< int > gmx::test::c_inputPmeOrders { 3, 4, 5 }
 Valid PME orders for testing.