24#ifndef MORPHEUS_DENSEVECTOR_CUDA_WORKSPACE_IMPL_HPP
25#define MORPHEUS_DENSEVECTOR_CUDA_WORKSPACE_IMPL_HPP
27#include <Morpheus_Macros.hpp>
28#if defined(MORPHEUS_ENABLE_CUDA)
30#include <impl/Morpheus_CudaUtils.hpp>
32#ifdef MORPHEUS_ENABLE_TPL_CUBLAS
45 template <
typename ValueType>
46 void allocate(
size_t N) {
48 if ((bytes > _nbytes) && (_nbytes > 0)) {
54 template <
typename ValueType>
56 return reinterpret_cast<ValueType*
>(_workspace);
63 void _malloc(
size_t bytes) {
64 if (_workspace ==
nullptr) {
66 if (cudaSuccess != cudaMalloc(&_workspace, bytes)) {
67 std::cout <<
"Malloc Failed on Device" << std::endl;
74 if (_workspace !=
nullptr) {
75 if (cudaSuccess == cudaFree(_workspace)) {
83#ifdef MORPHEUS_ENABLE_TPL_CUBLAS
90 if (_handle !=
nullptr) {
91 if (cublasDestroy(_handle) != CUBLAS_STATUS_SUCCESS) {
98 if (_handle ==
nullptr) {
99 if (cublasCreate(&_handle) != CUBLAS_STATUS_SUCCESS) {
100 printf(
"CUBLAS initialization failed\n");
103 cublasSetPointerMode(_handle, CUBLAS_POINTER_MODE_DEVICE);
107 cublasHandle_t handle() {
return _handle; }
110 cublasHandle_t _handle;
Definition: Cuda/Morpheus_Workspace.hpp:85
Definition: Cuda/Morpheus_Workspace.hpp:39
Generic Morpheus interfaces.
Definition: dummy.cpp:24
A wrapper that checks if the provided type is a scalar type.
Definition: Morpheus_TypeTraits.hpp:85