Morpheus 1.0.0
Dynamic matrix type and algorithms for sparse matrices
Loading...
Searching...
No Matches
DenseVector/OpenMP/Morpheus_Copy_Impl.hpp
1
24#ifndef MORPHEUS_DENSEVECTOR_OPENMP_COPY_IMPL_HPP
25#define MORPHEUS_DENSEVECTOR_OPENMP_COPY_IMPL_HPP
26
27#include <Morpheus_Macros.hpp>
28#if defined(MORPHEUS_ENABLE_OPENMP)
29
30#include <Morpheus_SpaceTraits.hpp>
31#include <Morpheus_FormatTraits.hpp>
32#include <Morpheus_FormatTags.hpp>
33#include <Morpheus_Spaces.hpp>
34
35#include <impl/Morpheus_OpenMPUtils.hpp>
36
37namespace Morpheus {
38namespace Impl {
39
40template <typename ExecSpace, typename KeyType, typename SourceType,
41 typename DestinationType>
42void copy_by_key(
43 const KeyType keys, const SourceType& src, DestinationType& dst,
44 typename std::enable_if_t<
45 Morpheus::is_dense_vector_format_container_v<KeyType> &&
46 Morpheus::is_dense_vector_format_container_v<SourceType> &&
47 Morpheus::is_dense_vector_format_container_v<DestinationType> &&
48 Morpheus::has_custom_backend_v<ExecSpace> &&
49 Morpheus::has_openmp_execution_space_v<ExecSpace> &&
50 Morpheus::has_access_v<ExecSpace, KeyType, SourceType,
51 DestinationType>>* = nullptr) {
52 using size_type = typename KeyType::size_type;
53#pragma omp parallel for
54 for (size_type i = 0; i < keys.size(); i++) {
55 dst[i] = src[keys[i]];
56 }
57}
58
59} // namespace Impl
60} // namespace Morpheus
61
62#endif // MORPHEUS_ENABLE_OPENMP
63#endif // MORPHEUS_DENSEVECTOR_OPENMP_COPY_IMPL_HPP
Generic Morpheus interfaces.
Definition: dummy.cpp:24
constexpr bool has_access_v
Short-hand to has_access.
Definition: Morpheus_SpaceTraits.hpp:713