Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::MachineShMemWinMemoryAllocator Class Reference
Inheritance diagram for Arcane::MachineShMemWinMemoryAllocator:
Collaboration diagram for Arcane::MachineShMemWinMemoryAllocator:

Public Member Functions

 MachineShMemWinMemoryAllocator (IParallelMng *pm)
bool hasRealloc (MemoryAllocationArgs) const override
 Indicates whether the allocator supports realloc semantics.
AllocatedMemoryInfo allocate (MemoryAllocationArgs, Int64 new_size) override
 Allocates memory for new_size bytes and returns the pointer.
AllocatedMemoryInfo reallocate (MemoryAllocationArgs, AllocatedMemoryInfo current_ptr, Int64 new_size) override
 Reallocates memory for new_size bytes and returns the pointer.
void deallocate (MemoryAllocationArgs, AllocatedMemoryInfo ptr) override
 Frees the memory whose base address is ptr.
Int64 adjustedCapacity (MemoryAllocationArgs, Int64 wanted_capacity, Int64) const override
 Adjusts the capacity based on the element size.
size_t guaranteedAlignment (MemoryAllocationArgs) const override
 Value of the alignment guaranteed by the allocator.
bool isCollective () const override
 Indicates whether calls to the allocator must be performed collectively.
Public Member Functions inherited from Arcane::IMemoryAllocator
virtual ~IMemoryAllocator ()=default
 Destroys the allocator.
virtual size_t guarantedAlignment (MemoryAllocationArgs args) const
 Value of the alignment guaranteed by the allocator.
virtual void notifyMemoryArgsChanged (MemoryAllocationArgs old_args, MemoryAllocationArgs new_args, AllocatedMemoryInfo ptr)
 Notifies of a change in instance-specific arguments.
virtual void copyMemory (MemoryAllocationArgs args, AllocatedMemoryInfo destination, AllocatedMemoryInfo source)
 Copies memory between two regions.
virtual eMemoryResource memoryResource () const
 Memory resource provided by the allocator.

Static Public Member Functions

static ConstArrayView< Int32machineRanks (AllocatedMemoryInfo ptr)
static void barrier (AllocatedMemoryInfo ptr)
static Span< std::byte > segmentView (AllocatedMemoryInfo ptr)
static Span< std::byte > segmentView (AllocatedMemoryInfo ptr, Int32 rank)

Static Private Member Functions

static MachineShMemWinBase_windowBase (AllocatedMemoryInfo ptr)

Private Attributes

IParallelMngm_pm

Detailed Description

Definition at line 35 of file MachineShMemWinMemoryAllocator.h.

Constructor & Destructor Documentation

◆ MachineShMemWinMemoryAllocator()

Arcane::MachineShMemWinMemoryAllocator::MachineShMemWinMemoryAllocator ( IParallelMng * pm)
explicit

Definition at line 35 of file MachineShMemWinMemoryAllocator.cc.

Member Function Documentation

◆ _windowBase()

MachineShMemWinBase * Arcane::MachineShMemWinMemoryAllocator::_windowBase ( AllocatedMemoryInfo ptr)
staticprivate

Definition at line 183 of file MachineShMemWinMemoryAllocator.cc.

◆ adjustedCapacity()

Int64 Arcane::MachineShMemWinMemoryAllocator::adjustedCapacity ( MemoryAllocationArgs args,
Int64 wanted_capacity,
Int64 element_size ) const
inlineoverridevirtual

Adjusts the capacity based on the element size.

This method is used to optionally modify the number of allocated elements based on their size. This allows, for example, aligned allocators to ensure that the number of elements allocated is a multiple of this alignment.

Implements Arcane::IMemoryAllocator.

Definition at line 49 of file MachineShMemWinMemoryAllocator.h.

◆ allocate()

AllocatedMemoryInfo Arcane::MachineShMemWinMemoryAllocator::allocate ( MemoryAllocationArgs args,
Int64 new_size )
overridevirtual

Allocates memory for new_size bytes and returns the pointer.

The semantics are equivalent to malloc():

  • new_size can be zero, in which case the returned pointer is either null or a specific value
  • the returned pointer may be null if the memory could not be allocated.

Implements Arcane::IMemoryAllocator.

Definition at line 43 of file MachineShMemWinMemoryAllocator.cc.

References Arcane::MessagePassing::ReduceMax.

Referenced by reallocate().

Here is the caller graph for this function:

◆ barrier()

void Arcane::MachineShMemWinMemoryAllocator::barrier ( AllocatedMemoryInfo ptr)
static

Definition at line 152 of file MachineShMemWinMemoryAllocator.cc.

◆ deallocate()

void Arcane::MachineShMemWinMemoryAllocator::deallocate ( MemoryAllocationArgs args,
AllocatedMemoryInfo ptr )
overridevirtual

Frees the memory whose base address is ptr.

The pointer ptr must have been allocated via a call to allocate() or reallocate() on this instance.

The semantics of this method are equivalent to free(), and thus ptr may be null, in which case no operation is performed.

Implements Arcane::IMemoryAllocator.

Definition at line 119 of file MachineShMemWinMemoryAllocator.cc.

References Arcane::AllocatedMemoryInfo::baseAddress(), Arcane::SpanImpl< T, SizeType, Extent >::data(), Arcane::MachineShMemWinBase::segmentView(), Arcane::AllocatedMemoryInfo::size(), and Arcane::SpanImpl< T, SizeType, Extent >::size().

Here is the call graph for this function:

◆ guaranteedAlignment()

size_t Arcane::MachineShMemWinMemoryAllocator::guaranteedAlignment ( MemoryAllocationArgs args) const
inlineoverridevirtual

Value of the alignment guaranteed by the allocator.

This method ensures that an allocator has sufficient alignment for certain operations such as vectorization, for example.

If there is no guarantee, it returns 0.

Implements Arcane::IMemoryAllocator.

Definition at line 53 of file MachineShMemWinMemoryAllocator.h.

◆ hasRealloc()

bool Arcane::MachineShMemWinMemoryAllocator::hasRealloc ( MemoryAllocationArgs ) const
inlineoverridevirtual

Indicates whether the allocator supports realloc semantics.

Default C allocators (malloc/realloc/free) obviously support realloc, but this is not necessarily the case for specific allocators with memory alignment (such as posix_memalign).

Reimplemented from Arcane::IMemoryAllocator.

Definition at line 45 of file MachineShMemWinMemoryAllocator.h.

◆ isCollective()

bool Arcane::MachineShMemWinMemoryAllocator::isCollective ( ) const
inlineoverridevirtual

Indicates whether calls to the allocator must be performed collectively.

Reimplemented from Arcane::IMemoryAllocator.

Definition at line 57 of file MachineShMemWinMemoryAllocator.h.

◆ machineRanks()

ConstArrayView< Int32 > Arcane::MachineShMemWinMemoryAllocator::machineRanks ( AllocatedMemoryInfo ptr)
static

Definition at line 143 of file MachineShMemWinMemoryAllocator.cc.

◆ reallocate()

AllocatedMemoryInfo Arcane::MachineShMemWinMemoryAllocator::reallocate ( MemoryAllocationArgs args,
AllocatedMemoryInfo current_ptr,
Int64 new_size )
overridevirtual

Reallocates memory for new_size bytes and returns the pointer.

The pointer current_ptr must have been allocated via a call to allocate() or reallocate() on this instance.

The semantics of this method are equivalent to realloc():

  • current_ptr may be null, in which case this call is equivalent to allocate().
  • the returned pointer may be null if the memory could not be allocated.

Implements Arcane::IMemoryAllocator.

Definition at line 81 of file MachineShMemWinMemoryAllocator.cc.

References allocate(), Arcane::AllocatedMemoryInfo::baseAddress(), Arcane::SpanImpl< T, SizeType, Extent >::data(), Arcane::MachineShMemWinBase::resize(), Arcane::MachineShMemWinBase::segmentView(), and Arcane::SpanImpl< T, SizeType, Extent >::size().

Here is the call graph for this function:

◆ segmentView() [1/2]

Span< std::byte > Arcane::MachineShMemWinMemoryAllocator::segmentView ( AllocatedMemoryInfo ptr)
static

Definition at line 161 of file MachineShMemWinMemoryAllocator.cc.

◆ segmentView() [2/2]

Span< std::byte > Arcane::MachineShMemWinMemoryAllocator::segmentView ( AllocatedMemoryInfo ptr,
Int32 rank )
static

Definition at line 172 of file MachineShMemWinMemoryAllocator.cc.

Member Data Documentation

◆ m_pm

IParallelMng* Arcane::MachineShMemWinMemoryAllocator::m_pm
private

Definition at line 75 of file MachineShMemWinMemoryAllocator.h.


The documentation for this class was generated from the following files: