Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate 'MemoryUtils::getAcceleratorHostMemoryAllocator()' #1817

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions arcane/src/arcane/materials/MeshMaterialVariableIndexer.cc
Original file line number Diff line number Diff line change
@@ -40,8 +40,8 @@ MeshMaterialVariableIndexer::
MeshMaterialVariableIndexer(ITraceMng* tm, const String& name)
: TraceAccessor(tm)
, m_name(name)
, m_matvar_indexes(platform::getAcceleratorHostMemoryAllocator())
, m_local_ids(platform::getAcceleratorHostMemoryAllocator())
, m_matvar_indexes(MemoryUtils::getDefaultDataAllocator())
, m_local_ids(MemoryUtils::getDefaultDataAllocator())
{
_init();
m_matvar_indexes.setDebugName(String("VariableIndexerMatVarIndexes")+name);
Original file line number Diff line number Diff line change
@@ -246,7 +246,7 @@ SimpleHydroAcceleratorService(const ServiceBuildInfo& sbi)
, m_delta_t_f(VariableBuildInfo(sbi.mesh(),"SplitDeltaT"))
, m_old_dt_f(VariableBuildInfo(sbi.mesh(),"OldDTf"))
, m_module(nullptr)
, m_node_index_in_cells(platform::getAcceleratorHostMemoryAllocator())
, m_node_index_in_cells(MemoryUtils::getDefaultDataAllocator())
, m_runner(sbi.subDomain()->acceleratorMng()->defaultRunner())
, m_default_queue(sbi.subDomain()->acceleratorMng()->defaultQueue())
{
9 changes: 5 additions & 4 deletions arcane/src/arcane/utils/MemoryResourceMng.cc
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@
#include "arcane/utils/Array.h"
#include "arcane/utils/MemoryView.h"
#include "arcane/utils/MemoryAllocator.h"
#include "arcane/utils/MemoryUtils.h"
#include "arcane/utils/internal/MemoryUtilsInternal.h"

/*---------------------------------------------------------------------------*/
@@ -109,15 +110,15 @@
// Si pas d'allocateur spécifique et qu'on n'est pas sur accélérateur,
// utilise platform::getAcceleratorHostMemoryAllocator().
if (!a && !m_is_accelerator) {
if (r == eMemoryRessource::UnifiedMemory || r == eMemoryRessource::HostPinned) {
a = platform::getAcceleratorHostMemoryAllocator();
if (r == eMemoryResource::UnifiedMemory || r == eMemoryResource::HostPinned) {
a = MemoryUtils::getDefaultDataAllocator();
if (!a)
a = m_allocators[(int)eMemoryRessource::Host];
a = m_allocators[(int)eMemoryResource::Host];

Check warning on line 116 in arcane/src/arcane/utils/MemoryResourceMng.cc

Codecov / codecov/patch

arcane/src/arcane/utils/MemoryResourceMng.cc#L116

Added line #L116 was not covered by tests
}
}

if (!a && throw_if_not_found)
ARCANE_FATAL("Allocator for ressource '{0}' is not available", r);
ARCANE_FATAL("Allocator for resource '{0}' is not available", r);

Check warning on line 121 in arcane/src/arcane/utils/MemoryResourceMng.cc

Codecov / codecov/patch

arcane/src/arcane/utils/MemoryResourceMng.cc#L121

Added line #L121 was not covered by tests

return a;
}
7 changes: 3 additions & 4 deletions arcane/src/arcane/utils/MemoryUtils.h
Original file line number Diff line number Diff line change
@@ -15,7 +15,6 @@
/*---------------------------------------------------------------------------*/

#include "arcane/utils/MemoryRessource.h"
#include "arcane/utils/UtilsTypes.h"
#include "arcane/utils/MemoryView.h"

#include "arccore/collections/MemoryAllocationArgs.h"
@@ -114,10 +113,10 @@ getAllocatorForMostlyReadOnlyData();
/*!
* \brief Allocateur spécifique pour les accélérateurs.
*
* Si non nul, cet allocateur permet d'allouer de la mémoire sur l'hôte en
* utilisant le runtime spécique de l'allocateur.
* \deprecated Use MemoryUtils::getDefaultDataAllocator() instead.
*/
extern "C++" ARCANE_UTILS_EXPORT IMemoryAllocator*
extern "C++" ARCANE_DEPRECATED_REASON("Y2024: Use getDefaultDataAllocator() instead.")
ARCANE_UTILS_EXPORT IMemoryAllocator*
getAcceleratorHostMemoryAllocator();

/*---------------------------------------------------------------------------*/
13 changes: 6 additions & 7 deletions arcane/src/arcane/utils/PlatformUtils.h
Original file line number Diff line number Diff line change
@@ -253,15 +253,14 @@ callDotNETGarbageCollector();
/*!
* \brief Allocateur spécifique pour les accélérateurs.
*
* Si non nul, cet allocateur permet d'allouer de la mémoire sur l'hôte en
* utilisant le runtime spécique de l'allocateur.
*
* \todo rendre obsolète (utiliser MemoryUtils::getAcceleratorHostMemoryAllocator()
* à la place).
* \deprecated Use MemoryUtils::getDefaultDataAllocator() instead.
*/
extern "C++" ARCANE_UTILS_EXPORT
IMemoryAllocator* getAcceleratorHostMemoryAllocator();
extern "C++" ARCANE_DEPRECATED_REASON("Y2024: Use MemoryUtils::getDefaultDataAllocator() instead.")
ARCANE_UTILS_EXPORT IMemoryAllocator*
getAcceleratorHostMemoryAllocator();

/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
/*!
* \brief Positionne l'allocateur spécifique pour les accélérateurs.
*