24#ifndef MORPHEUS_DENSEVECTOR_HIP_WORKSPACE_IMPL_HPP
25#define MORPHEUS_DENSEVECTOR_HIP_WORKSPACE_IMPL_HPP
27#include <Morpheus_Macros.hpp>
28#if defined(MORPHEUS_ENABLE_HIP)
30#include <impl/Morpheus_HIPUtils.hpp>
32#ifdef MORPHEUS_ENABLE_TPL_HIPBLAS
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 (hipSuccess != hipMalloc(&_workspace, bytes)) {
67 std::cout <<
"Malloc Failed on Device" << std::endl;
74 if (_workspace !=
nullptr) {
75 if (hipSuccess == hipFree(_workspace)) {
83#ifdef MORPHEUS_ENABLE_TPL_HIPBLAS
90 if (_handle !=
nullptr) {
91 if (hipblasDestroy(_handle) != HIPBLAS_STATUS_SUCCESS) {
98 if (_handle ==
nullptr) {
99 if (hipblasCreate(&_handle) != HIPBLAS_STATUS_SUCCESS) {
100 printf(
"HIPBLAS initialization failed\n");
103 hipblasSetPointerMode(_handle, HIPBLAS_POINTER_MODE_DEVICE);
107 hipblasHandle_t handle() {
return _handle; }
110 hipblasHandle_t _handle;
Definition: HIP/Morpheus_Workspace.hpp:39
Definition: HIP/Morpheus_Workspace.hpp:85
Generic Morpheus interfaces.
Definition: dummy.cpp:24
A wrapper that checks if the provided type is a scalar type.
Definition: Morpheus_TypeTraits.hpp:85