19 #include <deal.II/base/config.h> 21 #include <deal.II/base/exceptions.h> 23 #ifdef DEAL_II_COMPILER_CUDA_AWARE 24 # include <cusolverDn.h> 25 # include <cusolverSp.h> 26 # include <cusparse.h> 30 DEAL_II_NAMESPACE_OPEN
84 malloc(T *&pointer,
const unsigned int n_elements)
86 cudaError_t cuda_error_code =
87 cudaMalloc(&pointer, n_elements *
sizeof(T));
98 cudaError_t cuda_error_code = cudaFree(pointer);
106 template <
typename Number>
118 template <
typename Number>
122 const cudaError_t error_code = cudaFree(device_ptr);
129 template <
typename T>
133 cudaError_t cuda_error_code = cudaMemcpy(vector_host.data(),
135 vector_host.size() *
sizeof(T),
136 cudaMemcpyDeviceToHost);
144 template <
typename T>
148 cudaError_t cuda_error_code = cudaMemcpy(pointer_dev,
150 vector_host.size() *
sizeof(T),
151 cudaMemcpyHostToDevice);
157 DEAL_II_NAMESPACE_CLOSE
Number * allocate_device_data(const std::size_t size)
void malloc(T *&pointer, const unsigned int n_elements)
void copy_to_dev(const std::vector< T > &vector_host, T *pointer_dev)
cusparseHandle_t cusparse_handle
cusolverSpHandle_t cusolver_sp_handle
#define AssertCuda(error_code)
void copy_to_host(const T *pointer_dev, std::vector< T > &vector_host)
void delete_device_data(Number *device_ptr) noexcept
cusolverDnHandle_t cusolver_dn_handle
#define AssertNothrowCuda(error_code)