31 #ifndef __TASMANIAN_GPU_WRAPPERS_HPP
32 #define __TASMANIAN_GPU_WRAPPERS_HPP
59 template<
typename scalar_type>
65 template<
typename scalar_type>
69 template<
typename scalar_type>
74 gpuB.
unload(acceleration, B);
92 template<
typename scalar_type>
98 template<
typename scalar_type>
104 gpuC.
unload(acceleration, C);
113 template<
typename scalar_type>
121 const std::vector<int> &pntr,
const std::vector<int> &indx,
const std::vector<T> &vals, T C[]){
122 GpuVector<int> gpu_pntr(acceleration, pntr), gpu_indx(acceleration, indx);
123 GpuVector<T> gpu_vals(acceleration, vals), gpu_c(acceleration, M, N);
124 sparseMultiply(acceleration, M, N, K, alpha, A, gpu_pntr, gpu_indx, gpu_vals, gpu_c.
data());
125 gpu_c.
unload(acceleration, C);
Template class that wraps around a single GPU array, providing functionality that mimics std::vector.
Definition: tsgAcceleratedDataStructures.hpp:95
void unload(AccelerationContext const *acc, std::vector< T > &cpu_data) const
Copy the data from the GPU array to cpu_data, the cpu_data will be resized and overwritten.
Definition: tsgAcceleratedDataStructures.hpp:196
T * data()
Get a reference to the GPU array, which an be used as input to GPU libraries and kernels.
Definition: tsgAcceleratedDataStructures.hpp:145
T value_type
The data-type of the vector entries.
Definition: tsgAcceleratedDataStructures.hpp:220
void solveLSmultiOOC(AccelerationContext const *acceleration, int n, int m, scalar_type A[], int nrhs, scalar_type B[])
Identical to TasGpu::solveLSmultiGPU() but the arrays are on the CPU and the MAGMA out-of-core implem...
void sparseMultiplyMixed(AccelerationContext const *acceleration, int M, int N, int K, typename GpuVector< T >::value_type alpha, const GpuVector< T > &A, const std::vector< int > &pntr, const std::vector< int > &indx, const std::vector< T > &vals, T C[])
Identical to TasGpu::sparseMultiply() but the sparse matrix and the result C are in CPU memory.
Definition: tsgGpuWrappers.hpp:120
void solveLSmultiGPU(AccelerationContext const *acceleration, int n, int m, scalar_type A[], int nrhs, scalar_type B[])
Least squares solver with data sitting on the gpu device.
void solvePLU(AccelerationContext const *acceleration, char trans, int n, double const A[], int_gpu_lapack const ipiv[], double b[])
Solve A x = b using a PLU factorization.
void sparseMultiply(AccelerationContext const *acceleration, int M, int N, int K, typename GpuVector< scalar_type >::value_type alpha, const GpuVector< scalar_type > &A, const GpuVector< int > &pntr, const GpuVector< int > &indx, const GpuVector< scalar_type > &vals, scalar_type C[])
Wrapper to GPU methods that multiplies a sparse and a dense matrix.
void factorizePLU(AccelerationContext const *acceleration, int n, double A[], int_gpu_lapack ipiv[])
Factorize , arrays are on the GPU.
void denseMultiplyMixed(AccelerationContext const *acceleration, int M, int N, int K, typename GpuVector< scalar_type >::value_type alpha, GpuVector< scalar_type > const &A, scalar_type const B[], typename GpuVector< scalar_type >::value_type beta, scalar_type C[])
Identical to TasGpu::denseMultiply() but both B and C are array in CPU memory.
Definition: tsgGpuWrappers.hpp:99
void denseMultiply(AccelerationContext const *acceleration, int M, int N, int K, typename GpuVector< scalar_type >::value_type alpha, GpuVector< scalar_type > const &A, GpuVector< scalar_type > const &B, typename GpuVector< scalar_type >::value_type beta, scalar_type C[])
Wrapper to GPU BLAS that multiplies dense matrices (e.g., cuBlas, MAGMA).
void solveLSmulti(AccelerationContext const *acceleration, int n, int m, scalar_type A[], int nrhs, scalar_type B[])
Identical to TasGpu::solveLSmultiGPU() but the data starts with the CPU and gets uploaded to the GPU ...
Definition: tsgGpuWrappers.hpp:70
Encapsulates the Tasmanian Sparse Grid module.
Definition: TasmanianSparseGrid.hpp:68
int int_gpu_lapack
Defines the integer used by the LAPACK methods, usually int but DPC++ uses int64_t.
Definition: tsgEnumerates.hpp:97
Wrapper class around GPU device ID, acceleration type and GpuEngine.
Definition: tsgAcceleratedDataStructures.hpp:576
Data structures for interacting with CUDA and MAGMA environments.