Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
MachineShMemWinMemoryAllocator.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/* MachineShMemWinMemoryAllocator.h (C) 2000-2026 */
9/* */
10/* Memory allocator using the MachineShMemWinBase class. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_INTERNAL_MACHINESHMEMWINMEMORYALLOCATOR_H
13#define ARCANE_CORE_INTERNAL_MACHINESHMEMWINMEMORYALLOCATOR_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
19#include "arccore/common/IMemoryAllocator.h"
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24namespace Arcane
25{
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
31
32/*---------------------------------------------------------------------------*/
33/*---------------------------------------------------------------------------*/
34
35class ARCANE_CORE_EXPORT MachineShMemWinMemoryAllocator
36: public IMemoryAllocator
37{
38
39 public:
40
41 explicit MachineShMemWinMemoryAllocator(IParallelMng* pm);
42
43 public:
44
45 bool hasRealloc(MemoryAllocationArgs) const override { return true; }
46 AllocatedMemoryInfo allocate(MemoryAllocationArgs, Int64 new_size) override;
47 AllocatedMemoryInfo reallocate(MemoryAllocationArgs, AllocatedMemoryInfo current_ptr, Int64 new_size) override;
48 void deallocate(MemoryAllocationArgs, AllocatedMemoryInfo ptr) override;
49 Int64 adjustedCapacity(MemoryAllocationArgs, Int64 wanted_capacity, Int64) const override
50 {
51 return wanted_capacity;
52 }
54 {
55 return 0;
56 }
57 bool isCollective() const override
58 {
59 return true;
60 }
61
62 public:
63
64 static ConstArrayView<Int32> machineRanks(AllocatedMemoryInfo ptr);
65 static void barrier(AllocatedMemoryInfo ptr);
66 static Span<std::byte> segmentView(AllocatedMemoryInfo ptr);
67 static Span<std::byte> segmentView(AllocatedMemoryInfo ptr, Int32 rank);
68
69 private:
70
71 static MachineShMemWinBase* _windowBase(AllocatedMemoryInfo ptr);
72
73 private:
74
75 IParallelMng* m_pm;
76};
77
78/*---------------------------------------------------------------------------*/
79/*---------------------------------------------------------------------------*/
80
81} // End namespace Arcane
82
83/*---------------------------------------------------------------------------*/
84/*---------------------------------------------------------------------------*/
85
86#endif
Declarations of Arcane's general types.
Information about an allocated memory region.
Constant view of an array of type T.
Interface of the parallelism manager for a subdomain.
Class allowing the creation of a shared memory window between the subdomains of the same node.
bool isCollective() const override
Indicates whether calls to the allocator must be performed collectively.
bool hasRealloc(MemoryAllocationArgs) const override
Indicates whether the allocator supports realloc semantics.
size_t guaranteedAlignment(MemoryAllocationArgs) const override
Value of the alignment guaranteed by the allocator.
Int64 adjustedCapacity(MemoryAllocationArgs, Int64 wanted_capacity, Int64) const override
Adjusts the capacity based on the element size.
Class containing information to specialize allocations.
View of an array of elements of type T.
Definition Span.h:635
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int64_t Int64
Signed integer type of 64 bits.
std::int32_t Int32
Signed integer type of 32 bits.