Alien  1.3.0
Developer documentation
Loading...
Searching...
No Matches
MatrixAccessor.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2024 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7
8#pragma once
9
10#include <alien/data/IMatrix.h>
12#include <span>
13
14#include <alien/handlers/scalar/BaseProfiledMatrixBuilder.h>
15
16namespace Alien
17{
18
19 template <typename Scalar>
20 class HCSRMatrix;
21
22 namespace SYCL
23 {
24
25 template <typename ValueT, typename IndexT>
26 class ALIEN_EXPORT ProfiledMatrixBuilderT
27 {
28 public:
29 using ResetFlag = ProfiledMatrixOptions::ResetFlag;
30
31 public:
33
34 typedef ValueT ValueType ;
35
36 class Impl ;
37
38 class View ;
39
40 class ConstView ;
41
42 class HostView ;
43
44
45 public:
46 ProfiledMatrixBuilderT(IMatrix& matrix, ResetFlag reset_values);
47
48 virtual ~ProfiledMatrixBuilderT();
49
50 ProfiledMatrixBuilderT(const ProfiledMatrixBuilderT&) = delete;
51 ProfiledMatrixBuilderT(ProfiledMatrixBuilderT&&) = delete;
52 ProfiledMatrixBuilderT& operator=(const ProfiledMatrixBuilderT&) = delete;
53 ProfiledMatrixBuilderT& operator=(ProfiledMatrixBuilderT&&) = delete;
54
55 public:
56 inline MatrixElement operator()(const Integer iIndex, const Integer jIndex)
57 {
58 return MatrixElement(iIndex, jIndex, *this);
59 }
60
61 View view(SYCLControlGroupHandler& cgh) ;
62
63 ConstView constView(SYCLControlGroupHandler& cgh) const ;
64
65 HostView hostView() const ;
66
67 void finalize();
68
69 private:
70 bool isLocal(Integer jIndex) const
71 {
72 return (jIndex >= m_local_offset) && (jIndex < m_next_offset);
73 }
74
75 void _startTimer() {}
76 void _stopTimer() {}
77
78 private:
79 IMatrix& m_matrix;
80 HCSRMatrix<ValueType>* m_matrix_impl;
81 std::unique_ptr<Impl> m_impl;
82
83 Integer m_local_offset = 0;
84 Integer m_local_size = 0;
85 Integer m_next_offset= 0;
86 ConstArrayView<Integer> m_row_starts;
87 ConstArrayView<Integer> m_cols;
88 ConstArrayView<Integer> m_local_row_size;
89 ArrayView<ValueType> m_values;
90 bool m_finalized = false;
91 };
92
93
94 /*---------------------------------------------------------------------------*/
95 /*---------------------------------------------------------------------------*/
96
97 typedef ProfiledMatrixBuilderT<Real,Integer> ProfiledMatrixBuilder ;
98
99 } // namespace SYCL
100
101}
102
IMatrix.h.
MatrixElement.h.
Interface for all matrices.
Definition IMatrix.h:51
Tool to manipulate a matrix entry while building the matrix.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Definition BackEnd.h:17