Alien  1.3.0
Developer documentation
Loading...
Searching...
No Matches
SYCLDistStructInfo.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 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 <cstdlib>
11#include <unordered_set>
12
14#include <alien/kernels/simple_csr/CSRStructInfo.h>
15#include <alien/kernels/simple_csr/DistStructInfo.h>
16
17
18#include <alien/kernels/sycl/SYCLPrecomp.h>
19
20namespace Alien {
21
22/*---------------------------------------------------------------------------*/
23namespace SYCLInternal {
24
25
26class ALIEN_EXPORT SYCLDistStructInfo
28{
29 public:
30 //static constexpr int PKSIZE = 256 ;
31 using BaseType = SimpleCSRInternal::DistStructInfo;
32 using ProfileType = BEllPackStructInfo<PKSIZE,int>;
33
34 SYCLDistStructInfo()
35 : BaseType()
36 {}
37
38 SYCLDistStructInfo(const SYCLDistStructInfo& src)
39 {
40 BaseType::copy(src);
41 }
42
43
44 SYCLDistStructInfo& operator=(const SYCLDistStructInfo& src)
45 {
46 BaseType::copy(src);
47 return *this;
48 }
49
50 void computeUpperDiagOffset(const ProfileType& profile) const
51 {
52 auto nrows = profile.getNRows();
53 auto const* kcol = profile.kcol();
54 auto const* lrow_size = profile.localRowSize();
55 m_upper_diag_offset.resize(nrows);
56 for (std::size_t irow = 0; irow < nrows; ++irow)
57 {
58 int begin = kcol[irow] ;
59 int end = kcol[irow] + lrow_size[irow] ;
60 int index = begin;
61 for (int k = begin; k < end; ++k)
62 {
63 if (m_cols[k] < irow)
64 ++index;
65 else
66 break;
67 }
68 m_upper_diag_offset[irow] = index;
69 }
70 }
71
72 ConstArrayView<Integer> getUpperDiagOffset(const ProfileType& profile) const
73 {
74 if (m_upper_diag_offset.size() == 0)
75 computeUpperDiagOffset(profile);
76 return m_upper_diag_offset.constView();
77 }
78
79 int const* dcol(const ProfileType& profile) const
80 {
81 getUpperDiagOffset(profile);
82 return this->m_upper_diag_offset.data();
83 }
84
85};
86
87} // end namespace SYCLInternal
88
89} // end namespace Alien
90/*---------------------------------------------------------------------------*/
91/*---------------------------------------------------------------------------*/
MatrixDistribution.h.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Definition BackEnd.h:17