12#ifndef ARCANE_UTILS_MEMORYUTILS_H
13#define ARCANE_UTILS_MEMORYUTILS_H
17#include "arcane/utils/MemoryRessource.h"
19#include "arcane/utils/MemoryView.h"
21#include "arccore/collections/MemoryAllocationArgs.h"
26namespace Arcane::MemoryUtils
42extern "C++" ARCANE_UTILS_EXPORT IMemoryAllocator*
43getDefaultDataAllocator();
53extern "C++" ARCANE_UTILS_EXPORT IMemoryAllocator*
54getDeviceOrHostAllocator();
65extern "C++" ARCANE_UTILS_EXPORT MemoryAllocationOptions
66getDefaultDataAllocator(eMemoryLocationHint hint);
76extern "C++" ARCANE_UTILS_EXPORT MemoryAllocationOptions
77getAllocatorForMostlyReadOnlyData();
92extern "C++" ARCANE_UTILS_EXPORT MemoryAllocationOptions
101 extern "C++" ARCANE_UTILS_EXPORT
Int64
102 computeCapacity(
Int64 size);
120template <
typename DataType>
inline Int32
121checkResizeArrayWithCapacity(Array<DataType>& array,
Int64 new_size,
bool force_resize)
124 Int64 s = array.largeSize();
125 if (new_size > s || force_resize) {
127 if (new_size > array.capacity()) {
128 array.reserve(impl::computeCapacity(new_size));
131 array.resize(new_size);
145extern "C++" ARCANE_UTILS_EXPORT
void
148 const RunQueue* queue =
nullptr);
155copy(MutableMemoryView destination, ConstMemoryView source,
const RunQueue* queue =
nullptr)
158 copy(destination, mem_type, source, mem_type, queue);
165template <
typename DataType>
inline void
166copy(Span<DataType> destination, Span<const DataType> source,
const RunQueue* queue =
nullptr)
168 ConstMemoryView input(
asBytes(source));
170 copy(output, input, queue);
174template <
typename DataType>
inline void
175copy(SmallSpan<DataType> destination, SmallSpan<const DataType> source,
const RunQueue* queue =
nullptr)
177 copy(Span<DataType>(destination), Span<const DataType>(source), queue);
Déclarations des types utilisés dans Arcane.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
char * copy(char *to, const char *from)
Copie from dans to.
eMemoryRessource
Liste des ressources mémoire disponibles.
@ Unknown
Valeur inconnue ou non initialisée.
detail::SpanTypeFromSize< conststd::byte, SizeType >::SpanType asBytes(const SpanImpl< DataType, SizeType, Extent > &s)
Converti la vue en un tableau d'octets non modifiables.
detail::SpanTypeFromSize< std::byte, SizeType >::SpanType asWritableBytes(const SpanImpl< DataType, SizeType, Extent > &s)
Converti la vue en un tableau d'octets modifiables.