(git:27c966b)
Loading...
Searching...
No Matches
grid_gpu_internal_header.h File Reference
#include <algorithm>
#include <assert.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../common/grid_basis_set.h"
#include "../common/grid_constants.h"
#include "grid_gpu_context.h"

Go to the source code of this file.

Data Structures

struct  grid_gpu_backend::orbital
 Orbital angular momentum. More...
struct  grid_gpu_backend::ldiffs_value
 Differences in angular momentum. More...
struct  grid_gpu_backend::smem_task< T >
 data needed for calculating the coefficients, forces, and stress More...
struct  grid_gpu_backend::smem_task_reduced< T, T3 >
 data needed for collocate and integrate kernels More...
class  grid_gpu_backend::smem_parameters

Namespaces

namespace  grid_gpu_backend

Macros

#define GRID_DEVICE   __device__
#define GRID_GPU_CHECK_LAUNCH()
 Aborts with the location if the last kernel launch failed, e.g. because of an invalid launch configuration.

Functions

__host__ __device__ __inline__ int grid_gpu_backend::ncoset (const int l)
 Number of Cartesian orbitals up to given angular momentum quantum.
__host__ __device__ __inline__ int grid_gpu_backend::coset (int lx, int ly, int lz)
 Maps three angular momentum components to a single zero based index.
__device__ __inline__ orbital grid_gpu_backend::up (const int i, const orbital &a)
 Increase i'th component of given orbital angular momentum.
__inline__ __device__ orbital grid_gpu_backend::down (const int i, const orbital &a)
 Decrease i'th component of given orbital angular momentum.
__inline__ __device__ int grid_gpu_backend::idx (const orbital a)
 Return coset index of given orbital angular momentum.
__device__ __inline__ double grid_gpu_backend::power (const double x, const int expo)
template<typename T = double>
__device__ __inline__ void grid_gpu_backend::prep_term (const orbital a, const orbital b, const T value, const int n, T *cab)
 Adds given value to matrix element cab[idx(b)][idx(a)].
static void grid_gpu_backend::init_constant_memory ()
 Initializes the device's constant memory.
__inline__ __device__ unsigned int grid_gpu_backend::block_index ()
__inline__ __device__ unsigned int grid_gpu_backend::thread_global_index ()
__inline__ __host__ __device__ double3 grid_gpu_backend::compute_coordinates (const double *__restrict__ dh_, const double x, const double y, const double z)
template<typename T, typename T3, bool orthorhombic_>
__inline__ T grid_gpu_backend::compute_cube_properties (const T radius, const T *const __restrict__ dh_, const T *const __restrict__ dh_inv_, const T3 &rp, T3 &roffset, int3 &cubecenter, int3 &lb_cube, int3 &cube_size)
__inline__ __device__ void grid_gpu_backend::compute_window_size (const int3 grid_size, const int border_mask, const int3 &border_width, int3 &window_size, int3 &window_shift)
__inline__ __device__ int grid_gpu_backend::wrap_grid_index (const int idx, const int full_size)
 Wraps a cube-local coordinate into the periodic full grid along one axis. Single point of entry shared by collocate_kernel and integrate_kernel.
template<typename T, typename T3, bool distributed__>
__device__ __inline__ void grid_gpu_backend::setup_task_cube_center (const kernel_params &dev_, smem_task_reduced< T, T3 > &task)
 Shifts task.cube_center into the local grid's coordinate system and, for distributed grids, derives the border window. Single point of entry shared by collocate_kernel and integrate_kernel so the two cannot drift apart on which axis maps to which.
__device__ __inline__ void grid_gpu_backend::decode_pair (int t, int &p, int &q)
 Factorized cab <-> cxyz transformations.
__device__ __inline__ int grid_gpu_backend::line_index (const int dir, const int m, const int p, const int q, const bool on_a, const int other, const int n1)
template<typename T, bool TRANSPOSE>
__device__ __inline__ void grid_gpu_backend::move_center (const int la, const int lb, const int n1, const int dir, const bool on_a, const T dr, T *cab)
 Moves the expansion center of the a (on_a) or b cartesian index of cab along direction dir, in place:
template<typename T>
__device__ __inline__ void grid_gpu_backend::cab_to_cxyz_factorized (const smem_task< T > &task, T *__restrict__ cab, T *__restrict__ cxyz)
 Transforms the coefficients C_ab into C_xyz, cxyz[c] = prefactor sum_{a, b} alpha[a][b][c] cab[b][a] (see cxyz_to_cab_factorized). cab is overwritten.
template<typename T>
__device__ __inline__ void grid_gpu_backend::cxyz_to_cab_factorized (const smem_task< T > &task, const T *__restrict__ cxyz, T *__restrict__ cab)
 Transforms the coefficients C_xyz into C_ab, with the 3D multi-indices a, b, c,.
template<typename T, typename T3>
__device__ __inline__ void grid_gpu_backend::fill_smem_task_reduced (const kernel_params &dev, const int task_id, smem_task_reduced< T, T3 > &task)
 Copies a task from global to shared memory.
template<typename T>
__device__ __inline__ void grid_gpu_backend::fill_smem_task_coef (const kernel_params &dev, const int task_id, smem_task< T > &task)
 Copies a task from global to shared memory and does precomputations.
int grid_gpu_backend::sphi_work_size (const int lmax, const int max_nsgf_set)
 Size (in doubles) of the work arrays of the two step spherical <-> cartesian transformations of calculate_coefficients_two_steps and compute_hab_two_steps: [max_nsgf_set][ld] and [ld][ld] with ld = ncoset(lmax).
template<typename Kernel>
size_t grid_gpu_backend::max_dynamic_smem (Kernel kernel, const size_t budget)
 Largest dynamic shared memory the kernel can be launched with when its static and dynamic shared memory together must fit in budget bytes. The static part (e.g. shared task structures) is taken from the compiled kernel and rounded up to 16 bytes for the alignment of the dynamic array placed after it.
template<typename T>
__inline__ __device__ T * grid_gpu_backend::allocate_workspace (const kernel_params &dev_)
template<typename T, typename T3>
__device__ __inline__ T grid_gpu_backend::calculate_ymix_ymax_boundaries (smem_task_reduced< T, T3 > &task, const int z, int &ymin, int &ymax)
template<typename T, typename T3>
__device__ __inline__ void grid_gpu_backend::calculate_xmin_xmax_boundaries (smem_task_reduced< T, T3 > &task, const int y, const T kremain, int &xmin, int &xmax)

Variables

constexpr int grid_gpu_backend::grid_gpu_max_l = 18
__constant__ orbital grid_gpu_backend::coset_inv [1330]
constexpr size_t grid_gpu_backend::sphi_two_step_max_smem = 48 * 1024

Macro Definition Documentation

◆ GRID_DEVICE

#define GRID_DEVICE   __device__

Definition at line 25 of file grid_gpu_internal_header.h.

◆ GRID_GPU_CHECK_LAUNCH

#define GRID_GPU_CHECK_LAUNCH ( )
Value:
OFFLOAD_CHECK(offloadGetLastError())

Aborts with the location if the last kernel launch failed, e.g. because of an invalid launch configuration.

Definition at line 862 of file grid_gpu_internal_header.h.