24#ifndef MORPHEUS_CSR_OPENMP_MULTIPLY_IMPL_HPP
25#define MORPHEUS_CSR_OPENMP_MULTIPLY_IMPL_HPP
27#include <Morpheus_Macros.hpp>
28#if defined(MORPHEUS_ENABLE_OPENMP)
30#include <Morpheus_SpaceTraits.hpp>
31#include <Morpheus_FormatTraits.hpp>
32#include <Morpheus_FormatTags.hpp>
33#include <Morpheus_Spaces.hpp>
37template <
typename ExecSpace,
typename Matrix,
typename Vector>
39 const Matrix& A,
const Vector& x, Vector& y,
const bool init,
40 typename std::enable_if_t<
41 Morpheus::is_csr_matrix_format_container_v<Matrix> &&
42 Morpheus::is_dense_vector_format_container_v<Vector> &&
43 Morpheus::has_custom_backend_v<ExecSpace> &&
44 Morpheus::has_openmp_execution_space_v<ExecSpace> &&
45 Morpheus::has_access_v<ExecSpace, Matrix, Vector>>* =
nullptr) {
46 using size_type =
typename Matrix::size_type;
47 using index_type =
typename Matrix::index_type;
48 using value_type =
typename Matrix::value_type;
50#pragma omp parallel for
51 for (size_type i = 0; i < A.nrows(); i++) {
52 value_type sum = init ? value_type(0) : y[i];
53 for (index_type jj = A.crow_offsets(i); jj < A.crow_offsets(i + 1); jj++) {
54 sum += A.cvalues(jj) * x[A.ccolumn_indices(jj)];
Generic Morpheus interfaces.
Definition: dummy.cpp:24