24#ifndef MORPHEUS_DENSEVECTOR_HIP_COPY_IMPL_HPP
25#define MORPHEUS_DENSEVECTOR_HIP_COPY_IMPL_HPP
27#include <Morpheus_Macros.hpp>
28#if defined(MORPHEUS_ENABLE_HIP)
30#include <Morpheus_SpaceTraits.hpp>
31#include <Morpheus_FormatTraits.hpp>
32#include <Morpheus_FormatTags.hpp>
33#include <Morpheus_Spaces.hpp>
35#include <impl/Morpheus_HIPUtils.hpp>
36#include <impl/DenseVector/Kernels/Morpheus_Copy_Impl.hpp>
41template <
typename ExecSpace,
typename KeyType,
typename SourceType,
42 typename DestinationType>
44 const KeyType keys,
const SourceType& src, DestinationType& dst,
45 typename std::enable_if_t<
46 Morpheus::is_dense_vector_format_container_v<KeyType> &&
47 Morpheus::is_dense_vector_format_container_v<SourceType> &&
48 Morpheus::is_dense_vector_format_container_v<DestinationType> &&
49 Morpheus::has_custom_backend_v<ExecSpace> &&
50 Morpheus::has_hip_execution_space_v<ExecSpace> &&
52 DestinationType>>* =
nullptr) {
53 using size_type =
typename KeyType::size_type;
54 using index_type =
typename KeyType::value_type;
55 using value_type =
typename SourceType::value_type;
57 if (keys.size() == 0)
return;
59 const size_t BLOCK_SIZE = 256;
60 const size_t NUM_BLOCKS = (keys.size() + BLOCK_SIZE - 1) / BLOCK_SIZE;
62 Kernels::copy_by_key_kernel<value_type, index_type, size_type>
63 <<<NUM_BLOCKS, BLOCK_SIZE, 0>>>(keys.size(), keys.data(), src.data(),
66#if defined(DEBUG) || defined(MORPHEUS_DEBUG)
67 getLastHIPError(
"copy_by_key_kernel: Kernel execution failed");
Generic Morpheus interfaces.
Definition: dummy.cpp:24
constexpr bool has_access_v
Short-hand to has_access.
Definition: Morpheus_SpaceTraits.hpp:713