Gromacs
2018.8
|
#include "gmxpre.h"
#include "pme-gpu-internal.h"
#include "config.h"
#include <list>
#include <string>
#include "gromacs/ewald/ewald-utils.h"
#include "gromacs/gpu_utils/gpu_utils.h"
#include "gromacs/math/invertmatrix.h"
#include "gromacs/math/units.h"
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/logger.h"
#include "gromacs/utility/stringutil.h"
#include "pme-grid.h"
#include "pme-internal.h"
This file contains internal function implementations for performing the PME calculations on GPU.
Functions | |
static PmeGpuKernelParamsBase * | pme_gpu_get_kernel_params_base_ptr (const PmeGpu *pmeGpu) |
Wrapper for getting a pointer to the plain C++ part of the GPU kernel parameters structure. More... | |
gmx::ArrayRef< gmx::RVec > | pme_gpu_get_forces (PmeGpu *pmeGpu) |
Returns the GPU gathering staging forces buffer. More... | |
void | pme_gpu_get_energy_virial (const PmeGpu *pmeGpu, real *energy, matrix virial) |
Returns the output virial and energy of the PME solving. More... | |
void | pme_gpu_update_input_box (PmeGpu *pmeGpu, const matrix box) |
Updates the unit cell parameters. Does not check if update is necessary - that is done in pme_gpu_prepare_computation(). More... | |
void | pme_gpu_reinit_computation (const PmeGpu *pmeGpu) |
The PME GPU reinitialization function that is called both at the end of any PME computation and on any load balancing. More... | |
static void | pme_gpu_reinit_grids (PmeGpu *pmeGpu) |
(Re-)initializes all the PME GPU data related to the grid size and cut-off. More... | |
static void | pme_gpu_copy_common_data_from (const gmx_pme_t *pme) |
Copies everything useful from the PME CPU to the PME GPU structure. The goal is to minimize interaction with the PME CPU structure in the GPU code. More... | |
static bool | pme_gpu_check_restrictions (const gmx_pme_t *pme, std::string *error) |
Finds out if PME with given inputs is possible to run on GPU. More... | |
static void | pme_gpu_init (gmx_pme_t *pme, gmx_device_info_t *gpuInfo) |
Initializes the PME GPU data at the beginning of the run. More... | |
void | pme_gpu_transform_spline_atom_data (const PmeGpu *pmeGpu, const pme_atomcomm_t *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 | pme_gpu_get_real_grid_sizes (const PmeGpu *pmeGpu, gmx::IVec *gridSize, gmx::IVec *paddedGridSize) |
Get the normal/padded grid dimensions of the real-space PME grid on GPU. Only used in tests. More... | |
void | pme_gpu_reinit (gmx_pme_t *pme, gmx_device_info_t *gpuInfo) |
(Re-)initializes the PME GPU data at the beginning of the run or on DLB. More... | |
void | pme_gpu_destroy (PmeGpu *pmeGpu) |
Destroys the PME GPU data at the end of the run. More... | |
void | pme_gpu_reinit_atoms (PmeGpu *pmeGpu, const int nAtoms, const real *charges) |
Reallocates the local atoms data (charges, coordinates, etc.). Copies the charges to the GPU. More... | |
|
static |
Finds out if PME with given inputs is possible to run on GPU.
[in] | pme | The PME structure. |
[out] | error | The error message if the input is not supported on GPU. |
|
static |
Copies everything useful from the PME CPU to the PME GPU structure. The goal is to minimize interaction with the PME CPU structure in the GPU code.
[in] | pme | The PME structure. |
void pme_gpu_destroy | ( | PmeGpu * | pmeGpu | ) |
Destroys the PME GPU data at the end of the run.
[in] | pmeGpu | The PME GPU structure. |
Returns the output virial and energy of the PME solving.
[in] | pmeGpu | The PME GPU structure. |
[out] | energy | The output energy. |
[out] | virial | The output virial matrix. |
gmx::ArrayRef<gmx::RVec> pme_gpu_get_forces | ( | PmeGpu * | pmeGpu | ) |
Returns the GPU gathering staging forces buffer.
[in] | pmeGpu | The PME GPU structure. |
|
static |
Wrapper for getting a pointer to the plain C++ part of the GPU kernel parameters structure.
[in] | pmeGpu | The PME GPU structure. |
void pme_gpu_get_real_grid_sizes | ( | const PmeGpu * | pmeGpu, |
gmx::IVec * | gridSize, | ||
gmx::IVec * | paddedGridSize | ||
) |
Get the normal/padded grid dimensions of the real-space PME grid on GPU. Only used in tests.
[in] | pmeGpu | The PME GPU structure. |
[out] | gridSize | Pointer to the grid dimensions to fill in. |
[out] | paddedGridSize | Pointer to the padded grid dimensions to fill in. |
|
static |
Initializes the PME GPU data at the beginning of the run.
[in,out] | pme | The PME structure. |
[in,out] | gpuInfo | The GPU information structure. |
void pme_gpu_reinit | ( | gmx_pme_t * | pme, |
gmx_device_info_t * | gpuInfo | ||
) |
(Re-)initializes the PME GPU data at the beginning of the run or on DLB.
[in,out] | pme | The PME structure. |
[in,out] | gpuInfo | The GPU information structure. |
gmx::NotImplementedError | if this generally valid PME structure is not valid for GPU runs. |
Reallocates the local atoms data (charges, coordinates, etc.). Copies the charges to the GPU.
[in] | pmeGpu | The PME GPU structure. |
[in] | nAtoms | The number of particles. |
[in] | charges | The pointer to the host-side array of particle charges. |
This is a function that should only be called in the beginning of the run and on domain decomposition. Should be called before the pme_gpu_set_io_ranges.
void pme_gpu_reinit_computation | ( | const PmeGpu * | pmeGpu | ) |
The PME GPU reinitialization function that is called both at the end of any PME computation and on any load balancing.
[in] | pmeGpu | The PME GPU structure. |
|
static |
(Re-)initializes all the PME GPU data related to the grid size and cut-off.
[in] | pmeGpu | The PME GPU structure. |
void pme_gpu_transform_spline_atom_data | ( | const PmeGpu * | pmeGpu, |
const pme_atomcomm_t * | 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.
[in] | pmeGpu | The PME GPU structure. |
[out] | atc | The PME CPU atom data structure (with a single-threaded layout). |
[in] | type | The spline data type (values or derivatives). |
[in] | dimIndex | Dimension index. |
[in] | transform | Layout transform type |
void pme_gpu_update_input_box | ( | PmeGpu * | pmeGpu, |
const matrix | box | ||
) |
Updates the unit cell parameters. Does not check if update is necessary - that is done in pme_gpu_prepare_computation().
[in] | pmeGpu | The PME GPU structure. |
[in] | box | The unit cell box. |