Morpheus 1.0.0
Dynamic matrix type and algorithms for sparse matrices
Loading...
Searching...
No Matches
Morpheus_Convert_Impl.hpp
1
24#ifndef MORPHEUS_CONVERT_IMPL_HPP
25#define MORPHEUS_CONVERT_IMPL_HPP
26
27#include <Morpheus_FormatTags.hpp>
28
29#include <fwd/Morpheus_Fwd_CooMatrix.hpp>
30
31#include <impl/DenseVector/Serial/Morpheus_Convert_Impl.hpp>
32#include <impl/DenseVector/OpenMP/Morpheus_Convert_Impl.hpp>
33#include <impl/DenseVector/Cuda/Morpheus_Convert_Impl.hpp>
34#include <impl/DenseVector/HIP/Morpheus_Convert_Impl.hpp>
35#include <impl/DenseVector/Kokkos/Morpheus_Convert_Impl.hpp>
36
37#include <impl/DenseMatrix/Serial/Morpheus_Convert_Impl.hpp>
38#include <impl/DenseMatrix/OpenMP/Morpheus_Convert_Impl.hpp>
39#include <impl/DenseMatrix/Cuda/Morpheus_Convert_Impl.hpp>
40#include <impl/DenseMatrix/HIP/Morpheus_Convert_Impl.hpp>
41#include <impl/DenseMatrix/Kokkos/Morpheus_Convert_Impl.hpp>
42
43#include <impl/Coo/Serial/Morpheus_Convert_Impl.hpp>
44#include <impl/Coo/OpenMP/Morpheus_Convert_Impl.hpp>
45#include <impl/Coo/Cuda/Morpheus_Convert_Impl.hpp>
46#include <impl/Coo/HIP/Morpheus_Convert_Impl.hpp>
47#include <impl/Coo/Kokkos/Morpheus_Convert_Impl.hpp>
48
49#include <impl/Csr/Serial/Morpheus_Convert_Impl.hpp>
50#include <impl/Csr/OpenMP/Morpheus_Convert_Impl.hpp>
51#include <impl/Csr/Cuda/Morpheus_Convert_Impl.hpp>
52#include <impl/Csr/HIP/Morpheus_Convert_Impl.hpp>
53#include <impl/Csr/Kokkos/Morpheus_Convert_Impl.hpp>
54
55#include <impl/Dia/Serial/Morpheus_Convert_Impl.hpp>
56#include <impl/Dia/OpenMP/Morpheus_Convert_Impl.hpp>
57#include <impl/Dia/Cuda/Morpheus_Convert_Impl.hpp>
58#include <impl/Dia/HIP/Morpheus_Convert_Impl.hpp>
59#include <impl/Dia/Kokkos/Morpheus_Convert_Impl.hpp>
60
61namespace Morpheus {
62namespace Impl {
63
64// convert src -> coo_matrix -> dst
65template <typename ExecSpace, typename SourceType, typename DestinationType>
66void convert(const SourceType& src, DestinationType& dst,
67 typename std::enable_if_t<
68 is_matrix_container_v<SourceType> &&
69 is_matrix_container_v<DestinationType> &&
70 !is_dynamic_matrix_format_container_v<SourceType> &&
71 !is_dynamic_matrix_format_container_v<DestinationType> &&
72 !is_coo_matrix_format_container_v<SourceType> &&
73 !is_coo_matrix_format_container_v<DestinationType> &&
74 !has_same_format_v<SourceType, DestinationType>>* = nullptr) {
75 using ValueType = typename SourceType::value_type;
76 using IndexType = typename SourceType::index_type;
77 using ArrayLayout = typename SourceType::array_layout;
78 using MemorySpace = typename SourceType::memory_space;
79 using Backend = typename ExecSpace::backend;
80
81 using Coo = CooMatrix<ValueType, IndexType, ArrayLayout,
83 Coo tmp;
84
85 Impl::convert<ExecSpace>(src, tmp);
86 Impl::convert<ExecSpace>(tmp, dst);
87}
88
89} // namespace Impl
90} // namespace Morpheus
91
92#endif // MORPHEUS_CONVERT_IMPL_HPP
Generic Morpheus interfaces.
Definition: dummy.cpp:24
A type that binds together the execution, memory space and backend.
Definition: Morpheus_Spaces.hpp:39