Doxygen 1.9.1
Toolkit for Adaptive Stochastic Modeling and Non-Intrusive ApproximatioN: Tasmanian v8.2 (development)
tsgAcceleratedDataStructures.hpp File Reference

Data structures for interacting with CUDA and MAGMA environments. More...

#include "tsgAcceleratedHandles.hpp"
Include dependency graph for tsgAcceleratedDataStructures.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  TasGrid::GpuVector< T >
 Template class that wraps around a single GPU array, providing functionality that mimics std::vector. More...
 
struct  TasGrid::GpuEngine
 Wrapper class around calls GPU accelerated linear algebra libraries. More...
 
class  TasGrid::AccelerationDomainTransform
 Implements the domain transform algorithms in case the user data is provided on the GPU. More...
 
struct  TasGrid::AccelerationContext
 Wrapper class around GPU device ID, acceleration type and GpuEngine. More...
 

Namespaces

 TasGrid
 Encapsulates the Tasmanian Sparse Grid module.
 
 TasGrid::TasGpu
 Wrappers around custom CUDA kernels to handle domain transforms and basis evaluations, the kernels are instantiated in tsgCudaKernels.cu.
 
 TasGrid::AccelerationMeta
 Common methods for manipulating acceleration options and reading CUDA environment properties.
 

Functions

template<typename T >
void TasGrid::TasGpu::dtrans2can (AccelerationContext const *acc, bool use01, int dims, int num_x, int pad_size, const double *gpu_trans_a, const double *gpu_trans_b, const T *gpu_x_transformed, T *gpu_x_canonical)
 Uses custom kernel to convert transformed points to canonical points, all arrays live on the CUDA device. More...
 
template<typename T >
void TasGrid::TasGpu::devalpwpoly (AccelerationContext const *acc, int order, TypeOneDRule rule, int num_dimensions, int num_x, int num_basis, const T *gpu_x, const T *gpu_nodes, const T *gpu_support, T *gpu_y)
 Evaluate the basis functions for a local polynomial grid using the DENSE algorithm. More...
 
template<typename T >
void TasGrid::TasGpu::devalpwpoly_sparse (AccelerationContext const *acc, int order, TypeOneDRule rule, int dims, int num_x, const T *gpu_x, const GpuVector< T > &gpu_nodes, const GpuVector< T > &gpu_support, const GpuVector< int > &gpu_hpntr, const GpuVector< int > &gpu_hindx, const GpuVector< int > &gpu_hroots, GpuVector< int > &gpu_spntr, GpuVector< int > &gpu_sindx, GpuVector< T > &gpu_svals)
 Evaluate the basis functions for a local polynomial grid using the SPARSE algorithm. More...
 
template<typename T >
void TasGrid::TasGpu::devalseq (AccelerationContext const *acc, int dims, int num_x, const std::vector< int > &max_levels, const T *gpu_x, const GpuVector< int > &num_nodes, const GpuVector< int > &points, const GpuVector< T > &nodes, const GpuVector< T > &coeffs, T *gpu_result)
 Evaluate the basis for a Sequence grid. More...
 
template<typename T >
void TasGrid::TasGpu::devalfor (AccelerationContext const *acc, int dims, int num_x, const std::vector< int > &max_levels, const T *gpu_x, const GpuVector< int > &num_nodes, const GpuVector< int > &points, T *gpu_wreal, typename GpuVector< T >::value_type *gpu_wimag)
 Evaluate the basis for a Fourier grid. More...
 
template<typename T >
void TasGrid::TasGpu::devalglo (AccelerationContext const *acc, bool is_nested, bool is_clenshawcurtis0, int dims, int num_x, int num_p, int num_basis, T const *gpu_x, GpuVector< T > const &nodes, GpuVector< T > const &coeff, GpuVector< T > const &tensor_weights, GpuVector< int > const &nodes_per_level, GpuVector< int > const &offset_per_level, GpuVector< int > const &map_dimension, GpuVector< int > const &map_level, GpuVector< int > const &active_tensors, GpuVector< int > const &active_num_points, GpuVector< int > const &dim_offsets, GpuVector< int > const &map_tensor, GpuVector< int > const &map_index, GpuVector< int > const &map_reference, T *gpu_result)
 Evaluate the basis for Global grid. More...
 
void TasGrid::TasGpu::fillDataGPU (AccelerationContext const *acc, double value, long long N, long long stride, double data[])
 Fills the data with the provided real number at the given stride.
 
template<typename T >
void TasGrid::TasGpu::load_n (AccelerationContext const *acc, T const *cpu_data, size_t num_entries, T *gpu_data)
 Similar to copy_n, copies the data from the CPU to the GPU.
 
template<typename T , typename U >
Utils::use_if<!std::is_same< U, T >::value > TasGrid::TasGpu::load_n (AccelerationContext const *acc, U const *cpu_data, size_t num_entries, T *gpu_data)
 Similar to copy_n, copies the data from the CPU to the GPU.
 
TypeAcceleration TasGrid::AccelerationMeta::getIOAccelerationString (const char *name)
 Convert the string (coming from C or Python) into an enumerated type. More...
 
std::map< std::string, TypeAcceleration > TasGrid::AccelerationMeta::getStringToAccelerationMap ()
 Creates a map with std::string rule names (used by C/Python/CLI) mapped to TypeAcceleration enums.
 
const char * TasGrid::AccelerationMeta::getIOAccelerationString (TypeAcceleration accel)
 Convert the enumerated type to a string, the inverse of getIOAccelerationString() More...
 
int TasGrid::AccelerationMeta::getIOAccelerationInt (TypeAcceleration accel)
 Convert the integer (coming from Fortran) into an enumerated type. More...
 
TypeAcceleration TasGrid::AccelerationMeta::getIOIntAcceleration (int accel)
 Convert the enumerated type to an integer, the inverse of getIOAccelerationInt() More...
 
bool TasGrid::AccelerationMeta::isAccTypeGPU (TypeAcceleration accel)
 Returns true if accele is cuda, cublas or magma. More...
 
bool TasGrid::AccelerationMeta::isAvailable (TypeAcceleration accel)
 Identifies whether the acceleration mode is available.
 
TypeAcceleration TasGrid::AccelerationMeta::getAvailableFallback (TypeAcceleration accel)
 Implements fallback logic, if accel has been enabled through CMake then this returns accel, otherwise it returns the "next-best-thing". More...
 
int TasGrid::AccelerationMeta::getNumGpuDevices ()
 Return the number of visible GPU devices. More...
 
void TasGrid::AccelerationMeta::setDefaultGpuDevice (int deviceID)
 Selects the active device for this CPU thread, not supported for DPC++. More...
 
unsigned long long TasGrid::AccelerationMeta::getTotalGPUMemory (int deviceID)
 Return the memory available in the device (in units of bytes). More...
 
std::string TasGrid::AccelerationMeta::getGpuDeviceName (int deviceID)
 Returns the name of the selected GPU device, empty string if no device is available or the index is out of bounds. More...
 
template<typename T >
void TasGrid::AccelerationMeta::recvGpuArray (AccelerationContext const *, size_t num_entries, const T *gpu_data, std::vector< T > &cpu_data)
 Copy a device array to the main memory, used for testing only, always favor using GpuVector (if possible). More...
 
template<typename T >
void TasGrid::AccelerationMeta::delGpuArray (AccelerationContext const *, T *x)
 Deallocate device array, used primarily for testing, always favor using GpuVector (if possible). More...
 
void * TasGrid::AccelerationMeta::createCublasHandle ()
 Creates a new cuBlas handle, used in unit-testing only.
 
void TasGrid::AccelerationMeta::deleteCublasHandle (void *)
 Destroys the cuBlas handle, used in unit-testing only.
 

Detailed Description

Data structures for interacting with CUDA and MAGMA environments.

Author
Miroslav Stoyanov

Classes and namespaces that wrap around basic CUDA and MAGMA functionality, the classes allow RAII style of memory management for CUDA GPU arrays, as well as handy encapsulation of the cuBlas/cuSparse/MAGMA handles and streams.