Alien  1.3.0
Developer documentation
Loading...
Searching...
No Matches
HCSRVector.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
9#pragma once
10
13#include <alien/data/ISpace.h>
14#include <alien/kernels/sycl/SYCLBackEnd.h>
15#include <alien/kernels/sycl/SYCLPrecomp.h>
16#include <iostream>
17
18/*---------------------------------------------------------------------------*/
19
20namespace Alien
21{
22
23/*---------------------------------------------------------------------------*/
24namespace HCSRInternal
25{
26
27 template <typename ValueT>
28 class VectorInternal;
29}
30
31template <typename ValueT>
32class HCSRVector : public IVectorImpl
33{
34 public:
35 typedef ValueT ValueType;
36 typedef Integer IndexType;
37 typedef HCSRInternal::VectorInternal<ValueType> InternalType ;
38
41
43 HCSRVector(const MultiVectorImpl* multi_impl) ;
44
45 void allocate() ;
46
47 void resize(Integer alloc_size) ;
48
49 void clear() override
50 {
51 ;
52 }
53
54 void init(const VectorDistribution& dist,
55 const bool need_allocate) override ;
56
57 const VectorDistribution& distribution() const override
58 {
59 if (this->m_multi_impl)
61 else
62 return m_own_distribution;
63 }
64
65 Arccore::Integer scalarizedLocalSize() const override
66 {
67 if (this->m_multi_impl)
69 else
70 return m_own_distribution.localSize();
71 }
72
73 Arccore::Integer scalarizedGlobalSize() const override
74 {
75 if (this->m_multi_impl)
77 else
78 return m_own_distribution.globalSize();
79 }
80
81 Arccore::Integer scalarizedOffset() const override
82 {
83 if (this->m_multi_impl)
85 else
86 return m_own_distribution.offset();
87 }
88
89 Arccore::Integer allocSize() const {
90 return m_local_size ;
91 }
92
93 Arccore::Integer getAllocSize() const {
94 return m_local_size ;
95 }
96
97 ValueType const* dataPtr() const ;
98 void initDevicePointers(int** rows, ValueType** values) const ;
99 void freeDevicePointers(int* rows, ValueType* values) const ;
100
101 void copyValuesTo(ValueType* values) const;
102
103 InternalType* internal() {
104 return m_internal.get() ;
105 }
106
107 InternalType const* internal() const {
108 return m_internal.get() ;
109 }
110
111 private:
112 Alien::BackEnd::Memory::eType m_mem_kind = Alien::BackEnd::Memory::Device;
113 std::unique_ptr<InternalType> m_internal ;
114 Integer m_local_size = 0;
115 VectorDistribution m_own_distribution;
116};
117
118/*---------------------------------------------------------------------------*/
119
120} // namespace Alien
121
122/*---------------------------------------------------------------------------*/
ISpace.h.
IVectorImpl.h.
VBlockOffsets.h.
void clear() override
Wipe out internal data.
Definition HCSRVector.h:49
void init(const VectorDistribution &dist, const bool need_allocate) override
Initialize vector datas.
const VectorDistribution & distribution() const override
Get the distribution of the vector.
Definition HCSRVector.h:57
HCSRVector()
Constructeur sans association ? un MultiImpl.
HCSRVector(const MultiVectorImpl *multi_impl)
Constructeur avec association ? un MultiImpl.
Arccore::Integer scalarizedOffset() const override
Get the "scalarized" offset.
Definition HCSRVector.h:81
Arccore::Integer scalarizedGlobalSize() const override
Get the "scalarized" global size.
Definition HCSRVector.h:73
Arccore::Integer scalarizedLocalSize() const override
Get the "scalarized" local size.
Definition HCSRVector.h:65
virtual Arccore::Integer scalarizedOffset() const
Get the "scalarized" offset.
const MultiVectorImpl * m_multi_impl
Pointer on vectors implementations.
virtual const VectorDistribution & distribution() const
Get the distribution of the vector.
IVectorImpl(const MultiVectorImpl *multi_impl, BackEndId backend="")
Constructor.
virtual Arccore::Integer scalarizedGlobalSize() const
Get the "scalarized" global size.
virtual Arccore::Integer scalarizedLocalSize() const
Get the "scalarized" local size.
Computes a vector distribution.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Definition BackEnd.h:17