From 8f6820a7061955e20220165cf92f35d4c20d330b Mon Sep 17 00:00:00 2001 From: Rich Hornung Date: Wed, 19 Aug 2026 14:49:46 -0700 Subject: [PATCH 01/12] Add method getHostAllocatorID() and route seq/omp::allocatorID() methods through it. --- src/axom/core/execution/internal/omp_exec.hpp | 11 +---------- src/axom/core/execution/internal/seq_exec.hpp | 11 +---------- src/axom/core/memory_management.hpp | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/src/axom/core/execution/internal/omp_exec.hpp b/src/axom/core/execution/internal/omp_exec.hpp index 3da39efb96..6575edf3ee 100644 --- a/src/axom/core/execution/internal/omp_exec.hpp +++ b/src/axom/core/execution/internal/omp_exec.hpp @@ -16,11 +16,6 @@ #error OMP_EXEC requires an OpenMP enabled RAJA #endif -// Umpire includes -#ifdef AXOM_USE_UMPIRE - #include "umpire/Umpire.hpp" -#endif - namespace axom { /*! @@ -54,11 +49,7 @@ struct execution_space static int allocatorID() noexcept { -#ifdef AXOM_USE_UMPIRE - return axom::getUmpireResourceAllocatorID(umpire::resource::Host); -#else - return axom::getDefaultAllocatorID(); -#endif + return axom::getDefaultHostAllocatorID(); } AXOM_HOST_DEVICE static constexpr runtime_policy::Policy runtimePolicy() noexcept { diff --git a/src/axom/core/execution/internal/seq_exec.hpp b/src/axom/core/execution/internal/seq_exec.hpp index ce9bac758b..07c87e454e 100644 --- a/src/axom/core/execution/internal/seq_exec.hpp +++ b/src/axom/core/execution/internal/seq_exec.hpp @@ -14,11 +14,6 @@ #include "RAJA/RAJA.hpp" #endif -// Umpire includes -#ifdef AXOM_USE_UMPIRE - #include "umpire/Umpire.hpp" -#endif - namespace axom { /*! @@ -64,11 +59,7 @@ struct execution_space static int allocatorID() noexcept { -#ifdef AXOM_USE_UMPIRE - return axom::getUmpireResourceAllocatorID(umpire::resource::Host); -#else - return axom::getDefaultAllocatorID(); -#endif + return axom::getDefaultHostAllocatorID(); } AXOM_HOST_DEVICE static constexpr runtime_policy::Policy runtimePolicy() noexcept { diff --git a/src/axom/core/memory_management.hpp b/src/axom/core/memory_management.hpp index 5f6fd8bd41..e3ad6e0105 100644 --- a/src/axom/core/memory_management.hpp +++ b/src/axom/core/memory_management.hpp @@ -188,6 +188,20 @@ inline int getDefaultAllocatorID() #endif } +/*! + * \brief Returns the ID of the default host allocator. + * + * \return ID of the default host allocator. + */ +inline int getDefaultHostAllocatorID() +{ +#ifdef AXOM_USE_UMPIRE + return getUmpireResourceAllocatorID(umpire::resource::Host); +#else + return getDefaultAllocatorID(); +#endif +} + /*! * \brief Get the allocator id from which data has been allocated. * \return Allocator id. If Umpire doesn't have an allocator for the From 4dc85f673b9ff8e5aeea2c55cd75f453c38a172c Mon Sep 17 00:00:00 2001 From: Rich Hornung Date: Mon, 24 Aug 2026 13:59:49 -0700 Subject: [PATCH 02/12] Change default host alloc to axom malloc and associated changes --- src/axom/core/ArrayBase.hpp | 6 ++--- src/axom/core/examples/core_array_perf.cpp | 24 ++++++++++++------ src/axom/core/execution/execution_space.hpp | 2 +- src/axom/core/execution/internal/omp_exec.hpp | 6 +---- src/axom/core/execution/internal/seq_exec.hpp | 6 +---- src/axom/core/memory_management.hpp | 25 +++++++++++++------ src/axom/core/tests/core_execution_space.hpp | 16 ++++++++++-- .../examples/concentric_circles/runMIR.hpp | 8 ++++-- .../mir/examples/heavily_mixed/runMIR.hpp | 8 ++++-- src/axom/primal/tests/primal_intersect.cpp | 6 ++--- src/axom/quest/MarchingCubes.cpp | 6 +---- .../examples/quest_marching_cubes_example.cpp | 4 +-- 12 files changed, 71 insertions(+), 46 deletions(-) diff --git a/src/axom/core/ArrayBase.hpp b/src/axom/core/ArrayBase.hpp index 7b59b50897..e93fb32420 100644 --- a/src/axom/core/ArrayBase.hpp +++ b/src/axom/core/ArrayBase.hpp @@ -911,7 +911,7 @@ struct DeviceStagingBuffer #if defined(AXOM_USE_CUDA) && defined(AXOM_USE_UMPIRE) if(m_deviceStage) { - int allocator_id = axom::detail::getAllocatorID(); + int allocator_id = axom::getDefaultHostAllocatorID(); m_staging_buf = axom::allocate(nelems, allocator_id); if(read_from_data) { @@ -1018,7 +1018,7 @@ struct ArrayOps if constexpr(std::is_default_constructible_v) { #if defined(AXOM_USE_GPU) && defined(AXOM_USE_UMPIRE) - if(space != MemorySpace::Host) + if(space != MemorySpace::Host && space != MemorySpace::Malloc) { if constexpr(std::is_trivially_default_constructible_v) { @@ -1062,7 +1062,7 @@ struct ArrayOps void fill(T* array, IndexType begin, IndexType nelems, const T& value) { #if defined(AXOM_USE_GPU) && defined(AXOM_USE_UMPIRE) - if(space != MemorySpace::Host) + if(space != MemorySpace::Host && space != MemorySpace::Malloc) { if constexpr(std::is_trivially_copyable_v) { diff --git a/src/axom/core/examples/core_array_perf.cpp b/src/axom/core/examples/core_array_perf.cpp index 4ed0ba1dbe..9184cd6d21 100644 --- a/src/axom/core/examples/core_array_perf.cpp +++ b/src/axom/core/examples/core_array_perf.cpp @@ -162,11 +162,11 @@ int allocatorIdFromPolicy(axom::runtime_policy::Policy policy) AXOM_UNUSED_VAR(policy); #if defined(AXOM_USE_UMPIRE) int allocatorID = policy == axom::runtime_policy::Policy::seq - ? axom::detail::getAllocatorID() + ? axom::getDefaultHostAllocatorID() : #if defined(AXOM_RUNTIME_POLICY_USE_OPENMP) policy == axom::runtime_policy::Policy::omp - ? axom::detail::getAllocatorID() + ? axom::getDefaultHostAllocatorID() : #endif #if defined(AXOM_RUNTIME_POLICY_USE_CUDA) @@ -204,12 +204,20 @@ class MDMappingPerfTester { m_allocatorId = allocatorIdFromPolicy(params.runtimePolicy); #ifdef AXOM_USE_UMPIRE - umpire::ResourceManager& rm = umpire::ResourceManager::getInstance(); - umpire::Allocator allocator = rm.getAllocator(m_allocatorId); - std::cout << axom::fmt::format("Allocator id: {}, Umpire memory space {}", - m_allocatorId, - allocator.getName()) - << std::endl; + if(m_allocatorId == axom::MALLOC_ALLOCATOR_ID) + { + std::cout << axom::fmt::format("Allocator id: {}, malloc memory space", m_allocatorId) + << std::endl; + } + else + { + umpire::ResourceManager& rm = umpire::ResourceManager::getInstance(); + umpire::Allocator allocator = rm.getAllocator(m_allocatorId); + std::cout << axom::fmt::format("Allocator id: {}, Umpire memory space {}", + m_allocatorId, + allocator.getName()) + << std::endl; + } #else std::cout << axom::fmt::format("Allocator id: {}, default memory space", m_allocatorId) << std::endl; diff --git a/src/axom/core/execution/execution_space.hpp b/src/axom/core/execution/execution_space.hpp index f2cfd30fc9..03c12ac5dc 100644 --- a/src/axom/core/execution/execution_space.hpp +++ b/src/axom/core/execution/execution_space.hpp @@ -32,7 +32,7 @@ * with OpenMp, i.e., RAJA_ENABLE_OPENMP must be defined in the generated * RAJA/config.hpp. * - * The default memory allocator when using this execution space is HOST. + * The default memory allocator when using this execution space is malloc. * * When using this execution space, the data must reside on CPU/host memory. * diff --git a/src/axom/core/execution/internal/omp_exec.hpp b/src/axom/core/execution/internal/omp_exec.hpp index 6575edf3ee..0f0bdf64fc 100644 --- a/src/axom/core/execution/internal/omp_exec.hpp +++ b/src/axom/core/execution/internal/omp_exec.hpp @@ -36,11 +36,7 @@ struct execution_space using atomic_policy = RAJA::omp_atomic; using sync_policy = RAJA::omp_synchronize; -#ifdef AXOM_USE_UMPIRE - static constexpr MemorySpace memory_space = MemorySpace::Host; -#else - static constexpr MemorySpace memory_space = MemorySpace::Dynamic; -#endif + static constexpr MemorySpace memory_space = MemorySpace::Malloc; AXOM_HOST_DEVICE static constexpr bool async() noexcept { return false; } AXOM_HOST_DEVICE static constexpr bool valid() noexcept { return true; } diff --git a/src/axom/core/execution/internal/seq_exec.hpp b/src/axom/core/execution/internal/seq_exec.hpp index 07c87e454e..b039ee0c69 100644 --- a/src/axom/core/execution/internal/seq_exec.hpp +++ b/src/axom/core/execution/internal/seq_exec.hpp @@ -46,11 +46,7 @@ struct execution_space using sync_policy = void; -#ifdef AXOM_USE_UMPIRE - static constexpr MemorySpace memory_space = MemorySpace::Host; -#else - static constexpr MemorySpace memory_space = MemorySpace::Dynamic; -#endif + static constexpr MemorySpace memory_space = MemorySpace::Malloc; AXOM_HOST_DEVICE static constexpr bool async() noexcept { return false; } AXOM_HOST_DEVICE static constexpr bool valid() noexcept { return true; } diff --git a/src/axom/core/memory_management.hpp b/src/axom/core/memory_management.hpp index e3ad6e0105..7350f955a7 100644 --- a/src/axom/core/memory_management.hpp +++ b/src/axom/core/memory_management.hpp @@ -158,14 +158,23 @@ inline void setDefaultAllocator(umpire::resource::MemoryResourceType resource_ty /*! * \brief Sets the default memory allocator to use. - * \param [in] allocId the Umpire allocator id + * \param [in] allocId the Axom allocator id * + * \note When Axom is compiled with Umpire and \a allocId is + * axom::MALLOC_ALLOCATOR_ID, this function sets Umpire's default + * allocator to its Host resource. * \note This function has no effect when Axom is not compiled with Umpire. */ inline void setDefaultAllocator(int allocId) { #ifdef AXOM_USE_UMPIRE umpire::ResourceManager& rm = umpire::ResourceManager::getInstance(); + if(allocId == MALLOC_ALLOCATOR_ID) + { + rm.setDefaultAllocator(rm.getAllocator(umpire::resource::Host)); + return; + } + umpire::Allocator allocator = rm.getAllocator(allocId); rm.setDefaultAllocator(allocator); #else @@ -191,15 +200,15 @@ inline int getDefaultAllocatorID() /*! * \brief Returns the ID of the default host allocator. * + * \note This is distinct from the current default allocator returned by + * axom::getDefaultAllocatorID(), which tracks Umpire's default allocator + * when Axom is configured with Umpire. + * * \return ID of the default host allocator. */ inline int getDefaultHostAllocatorID() { -#ifdef AXOM_USE_UMPIRE - return getUmpireResourceAllocatorID(umpire::resource::Host); -#else - return getDefaultAllocatorID(); -#endif + return MALLOC_ALLOCATOR_ID; } /*! @@ -562,12 +571,12 @@ inline void fill(void* dst, std::size_t n, const T& value) noexcept // Device memory: fill on host, then copy to device const auto num_bytes = n * sizeof(T); - T* src = allocate(num_bytes, rm.getDefaultAllocator().getId()); + T* src = allocate(n, axom::getDefaultHostAllocatorID()); for(std::size_t i = 0; i < n; ++i) { src[i] = value; } - rm.copy(dst, src, num_bytes); + axom::copy(dst, src, num_bytes); deallocate(src); } } diff --git a/src/axom/core/tests/core_execution_space.hpp b/src/axom/core/tests/core_execution_space.hpp index 26385c8f57..9f261d6302 100644 --- a/src/axom/core/tests/core_execution_space.hpp +++ b/src/axom/core/tests/core_execution_space.hpp @@ -118,6 +118,18 @@ TEST(core_execution_space, check_invalid) check_invalid(); } +//------------------------------------------------------------------------------ +TEST(core_execution_space, check_default_host_allocator) +{ + EXPECT_EQ(axom::MALLOC_ALLOCATOR_ID, axom::getDefaultHostAllocatorID()); + EXPECT_EQ(axom::MemorySpace::Malloc, axom::execution_space::memory_space); + +#if defined(AXOM_USE_OPENMP) && defined(AXOM_USE_RAJA) + EXPECT_EQ(axom::MALLOC_ALLOCATOR_ID, axom::execution_space::allocatorID()); + EXPECT_EQ(axom::MemorySpace::Malloc, axom::execution_space::memory_space); +#endif +} + //============================================================================== // The following tests require RAJA and UMPIRE //============================================================================== @@ -130,7 +142,7 @@ TEST(core_execution_space, check_seq_exec) constexpr bool IS_ASYNC = false; constexpr bool ON_DEVICE = false; - int allocator_id = axom::getUmpireResourceAllocatorID(umpire::resource::Host); + int allocator_id = axom::MALLOC_ALLOCATOR_ID; check_execution_mappings 2022 RAJA::seq_exec, @@ -153,7 +165,7 @@ TEST(core_execution_space, check_omp_exec) constexpr bool IS_ASYNC = false; constexpr bool ON_DEVICE = false; - int allocator_id = axom::getUmpireResourceAllocatorID(umpire::resource::Host); + int allocator_id = axom::MALLOC_ALLOCATOR_ID; check_execution_mappings::allocatorID(); #if defined(AXOM_USE_UMPIRE) auto &rm = umpire::ResourceManager::getInstance(); - umpire::Allocator allocator = rm.getAllocator(allocator_id); + umpire::Allocator allocator = allocator_id == axom::MALLOC_ALLOCATOR_ID + ? rm.getAllocator(umpire::resource::Host) + : rm.getAllocator(allocator_id); const std::string newName = allocator.getName() + "_POOL"; SLIC_INFO( @@ -211,7 +213,9 @@ int runMIR(const conduit::Node &hostMesh, const conduit::Node &options, conduit: try { auto &rm = umpire::ResourceManager::getInstance(); - umpire::Allocator allocator = rm.getAllocator(allocator_id); + umpire::Allocator allocator = allocator_id == axom::MALLOC_ALLOCATOR_ID + ? rm.getAllocator(umpire::resource::Host) + : rm.getAllocator(allocator_id); SLIC_INFO("Allocator Information:"); SLIC_INFO(axom::fmt::format("\tname: {}", allocator.getName())); SLIC_INFO(axom::fmt::format("\thighwatermark: {}", allocator.getHighWatermark())); diff --git a/src/axom/mir/examples/heavily_mixed/runMIR.hpp b/src/axom/mir/examples/heavily_mixed/runMIR.hpp index 9424cb8da3..2b41c6dd61 100644 --- a/src/axom/mir/examples/heavily_mixed/runMIR.hpp +++ b/src/axom/mir/examples/heavily_mixed/runMIR.hpp @@ -19,7 +19,9 @@ int installAllocator([[maybe_unused]] size_t initialPoolSizeBytes) int allocator_id = axom::execution_space::allocatorID(); #if defined(AXOM_USE_UMPIRE) auto &rm = umpire::ResourceManager::getInstance(); - umpire::Allocator allocator = rm.getAllocator(allocator_id); + umpire::Allocator allocator = allocator_id == axom::MALLOC_ALLOCATOR_ID + ? rm.getAllocator(umpire::resource::Host) + : rm.getAllocator(allocator_id); const std::string newName = allocator.getName() + "_POOL"; SLIC_INFO( @@ -141,7 +143,9 @@ int runMIR(const conduit::Node &hostMesh, const conduit::Node &options, conduit: try { auto &rm = umpire::ResourceManager::getInstance(); - umpire::Allocator allocator = rm.getAllocator(allocator_id); + umpire::Allocator allocator = allocator_id == axom::MALLOC_ALLOCATOR_ID + ? rm.getAllocator(umpire::resource::Host) + : rm.getAllocator(allocator_id); SLIC_INFO("Allocator Information:"); SLIC_INFO(axom::fmt::format("\tname: {}", allocator.getName())); SLIC_INFO(axom::fmt::format("\thighwatermark: {}", allocator.getHighWatermark())); diff --git a/src/axom/primal/tests/primal_intersect.cpp b/src/axom/primal/tests/primal_intersect.cpp index 66fd2c2bca..ddc83d2e07 100644 --- a/src/axom/primal/tests/primal_intersect.cpp +++ b/src/axom/primal/tests/primal_intersect.cpp @@ -2594,7 +2594,7 @@ void check_plane_bb_intersect() umpire::Allocator allocator = (axom::execution_space::onDevice() ? rm.getAllocator(umpire::resource::Device) - : rm.getAllocator(axom::execution_space::allocatorID())); + : rm.getAllocator(umpire::resource::Host)); // Set new default to device axom::setDefaultAllocator(allocator.getId()); @@ -2675,7 +2675,7 @@ void check_plane_seg_intersect() umpire::Allocator allocator = (axom::execution_space::onDevice() ? rm.getAllocator(umpire::resource::Device) - : rm.getAllocator(axom::execution_space::allocatorID())); + : rm.getAllocator(umpire::resource::Host)); // Set new default to device axom::setDefaultAllocator(allocator.getId()); @@ -2764,7 +2764,7 @@ void check_segment_segment_intersect_policy() umpire::Allocator allocator = (axom::execution_space::onDevice() ? rm.getAllocator(umpire::resource::Device) - : rm.getAllocator(axom::execution_space::allocatorID())); + : rm.getAllocator(umpire::resource::Host)); axom::setDefaultAllocator(allocator.getId()); diff --git a/src/axom/quest/MarchingCubes.cpp b/src/axom/quest/MarchingCubes.cpp index 4a0d4f855e..54f6589275 100644 --- a/src/axom/quest/MarchingCubes.cpp +++ b/src/axom/quest/MarchingCubes.cpp @@ -197,11 +197,7 @@ void MarchingCubes::populateContourMesh(axom::mint::UnstructuredMesh() -#else - axom::detail::getAllocatorID() -#endif + axom::getDefaultHostAllocatorID() : m_allocatorID; if(hostAndInternalMemoriesAreSeparate) diff --git a/src/axom/quest/examples/quest_marching_cubes_example.cpp b/src/axom/quest/examples/quest_marching_cubes_example.cpp index 3c19f9734f..c3edbd9395 100644 --- a/src/axom/quest/examples/quest_marching_cubes_example.cpp +++ b/src/axom/quest/examples/quest_marching_cubes_example.cpp @@ -1612,9 +1612,9 @@ int allocatorIdToTest(axom::runtime_policy::Policy policy) // Memory resource. For testing, choose device memory if appropriate. //--------------------------------------------------------------------------- int allocatorID = - policy == RuntimePolicy::seq ? axom::detail::getAllocatorID() : + policy == RuntimePolicy::seq ? axom::getDefaultHostAllocatorID() : #if defined(AXOM_RUNTIME_POLICY_USE_OPENMP) - policy == RuntimePolicy::omp ? axom::detail::getAllocatorID() + policy == RuntimePolicy::omp ? axom::getDefaultHostAllocatorID() : #endif #if defined(AXOM_RUNTIME_POLICY_USE_CUDA) From 11f118a583df1b5a3f6cb6b864b77adfd9358905 Mon Sep 17 00:00:00 2001 From: Rich Hornung Date: Tue, 25 Aug 2026 10:41:16 -0700 Subject: [PATCH 03/12] add compilation option to change default host allocator --- src/axom/config.hpp.in | 1 + src/axom/core/execution/internal/omp_exec.hpp | 4 +++ src/axom/core/execution/internal/seq_exec.hpp | 4 +++ src/axom/core/memory_management.hpp | 4 +++ src/axom/core/tests/core_execution_space.hpp | 25 ++++++++++++++----- src/cmake/AxomConfig.cmake | 16 ++++++++++++ src/cmake/AxomOptions.cmake | 2 ++ src/cmake/axom-config.cmake.in | 1 + .../sphinx/quickstart_guide/config_build.rst | 5 ++++ 9 files changed, 56 insertions(+), 6 deletions(-) diff --git a/src/axom/config.hpp.in b/src/axom/config.hpp.in index f810b11086..f99834547f 100644 --- a/src/axom/config.hpp.in +++ b/src/axom/config.hpp.in @@ -81,6 +81,7 @@ * Compiler defines for library capabilities */ #cmakedefine AXOM_USE_UMPIRE_SHARED_MEMORY +#cmakedefine AXOM_DEFAULT_HOST_ALLOCATOR_USES_UMPIRE_HOST /* * Compiler defines for third-party executables diff --git a/src/axom/core/execution/internal/omp_exec.hpp b/src/axom/core/execution/internal/omp_exec.hpp index 0f0bdf64fc..2c3711db5d 100644 --- a/src/axom/core/execution/internal/omp_exec.hpp +++ b/src/axom/core/execution/internal/omp_exec.hpp @@ -36,7 +36,11 @@ struct execution_space using atomic_policy = RAJA::omp_atomic; using sync_policy = RAJA::omp_synchronize; +#ifdef AXOM_DEFAULT_HOST_ALLOCATOR_USES_UMPIRE_HOST + static constexpr MemorySpace memory_space = MemorySpace::Host; +#else static constexpr MemorySpace memory_space = MemorySpace::Malloc; +#endif AXOM_HOST_DEVICE static constexpr bool async() noexcept { return false; } AXOM_HOST_DEVICE static constexpr bool valid() noexcept { return true; } diff --git a/src/axom/core/execution/internal/seq_exec.hpp b/src/axom/core/execution/internal/seq_exec.hpp index b039ee0c69..21efc67001 100644 --- a/src/axom/core/execution/internal/seq_exec.hpp +++ b/src/axom/core/execution/internal/seq_exec.hpp @@ -46,7 +46,11 @@ struct execution_space using sync_policy = void; +#ifdef AXOM_DEFAULT_HOST_ALLOCATOR_USES_UMPIRE_HOST + static constexpr MemorySpace memory_space = MemorySpace::Host; +#else static constexpr MemorySpace memory_space = MemorySpace::Malloc; +#endif AXOM_HOST_DEVICE static constexpr bool async() noexcept { return false; } AXOM_HOST_DEVICE static constexpr bool valid() noexcept { return true; } diff --git a/src/axom/core/memory_management.hpp b/src/axom/core/memory_management.hpp index 7350f955a7..a7d97d9c9a 100644 --- a/src/axom/core/memory_management.hpp +++ b/src/axom/core/memory_management.hpp @@ -208,7 +208,11 @@ inline int getDefaultAllocatorID() */ inline int getDefaultHostAllocatorID() { +#if defined(AXOM_DEFAULT_HOST_ALLOCATOR_USES_UMPIRE_HOST) + return getUmpireResourceAllocatorID(umpire::resource::Host); +#else return MALLOC_ALLOCATOR_ID; +#endif } /*! diff --git a/src/axom/core/tests/core_execution_space.hpp b/src/axom/core/tests/core_execution_space.hpp index 9f261d6302..2fad1eb522 100644 --- a/src/axom/core/tests/core_execution_space.hpp +++ b/src/axom/core/tests/core_execution_space.hpp @@ -121,12 +121,25 @@ TEST(core_execution_space, check_invalid) //------------------------------------------------------------------------------ TEST(core_execution_space, check_default_host_allocator) { - EXPECT_EQ(axom::MALLOC_ALLOCATOR_ID, axom::getDefaultHostAllocatorID()); - EXPECT_EQ(axom::MemorySpace::Malloc, axom::execution_space::memory_space); + int expected_host_allocator = axom::MALLOC_ALLOCATOR_ID; + auto expected_host_memory_space = axom::MemorySpace::Malloc; +#if defined(AXOM_DEFAULT_HOST_ALLOCATOR_USES_UMPIRE_HOST) + expected_host_allocator = axom::getUmpireResourceAllocatorID(umpire::resource::Host); + expected_host_memory_space = axom::MemorySpace::Host; +#endif + + EXPECT_EQ(expected_host_allocator, axom::getDefaultHostAllocatorID()); + EXPECT_EQ(expected_host_memory_space, axom::execution_space::memory_space); + EXPECT_EQ(expected_host_allocator, axom::execution_space::allocatorID()); + +#if defined(AXOM_USE_UMPIRE) + EXPECT_EQ(axom::getUmpireResourceAllocatorID(umpire::resource::Host), + axom::detail::getAllocatorID()); +#endif #if defined(AXOM_USE_OPENMP) && defined(AXOM_USE_RAJA) - EXPECT_EQ(axom::MALLOC_ALLOCATOR_ID, axom::execution_space::allocatorID()); - EXPECT_EQ(axom::MemorySpace::Malloc, axom::execution_space::memory_space); + EXPECT_EQ(expected_host_allocator, axom::execution_space::allocatorID()); + EXPECT_EQ(expected_host_memory_space, axom::execution_space::memory_space); #endif } @@ -142,7 +155,7 @@ TEST(core_execution_space, check_seq_exec) constexpr bool IS_ASYNC = false; constexpr bool ON_DEVICE = false; - int allocator_id = axom::MALLOC_ALLOCATOR_ID; + int allocator_id = axom::getDefaultHostAllocatorID(); check_execution_mappings 2022 RAJA::seq_exec, @@ -165,7 +178,7 @@ TEST(core_execution_space, check_omp_exec) constexpr bool IS_ASYNC = false; constexpr bool ON_DEVICE = false; - int allocator_id = axom::MALLOC_ALLOCATOR_ID; + int allocator_id = axom::getDefaultHostAllocatorID(); check_execution_mappings Date: Tue, 25 Aug 2026 11:43:05 -0700 Subject: [PATCH 04/12] Moved getDefaultHostAllocatorID() into axom::detail to avoid Axom API expansion --- src/axom/core/ArrayBase.hpp | 2 +- src/axom/core/examples/core_array_perf.cpp | 4 ++-- src/axom/core/execution/internal/omp_exec.hpp | 2 +- src/axom/core/execution/internal/seq_exec.hpp | 2 +- src/axom/core/memory_management.hpp | 5 ++++- src/axom/core/tests/core_execution_space.hpp | 5 ++--- src/axom/quest/MarchingCubes.cpp | 2 +- src/axom/quest/examples/quest_marching_cubes_example.cpp | 4 ++-- 8 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/axom/core/ArrayBase.hpp b/src/axom/core/ArrayBase.hpp index e93fb32420..a35a130b9f 100644 --- a/src/axom/core/ArrayBase.hpp +++ b/src/axom/core/ArrayBase.hpp @@ -911,7 +911,7 @@ struct DeviceStagingBuffer #if defined(AXOM_USE_CUDA) && defined(AXOM_USE_UMPIRE) if(m_deviceStage) { - int allocator_id = axom::getDefaultHostAllocatorID(); + int allocator_id = axom::detail::getDefaultHostAllocatorID(); m_staging_buf = axom::allocate(nelems, allocator_id); if(read_from_data) { diff --git a/src/axom/core/examples/core_array_perf.cpp b/src/axom/core/examples/core_array_perf.cpp index 9184cd6d21..3a62f43db1 100644 --- a/src/axom/core/examples/core_array_perf.cpp +++ b/src/axom/core/examples/core_array_perf.cpp @@ -162,11 +162,11 @@ int allocatorIdFromPolicy(axom::runtime_policy::Policy policy) AXOM_UNUSED_VAR(policy); #if defined(AXOM_USE_UMPIRE) int allocatorID = policy == axom::runtime_policy::Policy::seq - ? axom::getDefaultHostAllocatorID() + ? axom::detail::getDefaultHostAllocatorID() : #if defined(AXOM_RUNTIME_POLICY_USE_OPENMP) policy == axom::runtime_policy::Policy::omp - ? axom::getDefaultHostAllocatorID() + ? axom::detail::getDefaultHostAllocatorID() : #endif #if defined(AXOM_RUNTIME_POLICY_USE_CUDA) diff --git a/src/axom/core/execution/internal/omp_exec.hpp b/src/axom/core/execution/internal/omp_exec.hpp index 2c3711db5d..861f2f69f5 100644 --- a/src/axom/core/execution/internal/omp_exec.hpp +++ b/src/axom/core/execution/internal/omp_exec.hpp @@ -49,7 +49,7 @@ struct execution_space static int allocatorID() noexcept { - return axom::getDefaultHostAllocatorID(); + return axom::detail::getDefaultHostAllocatorID(); } AXOM_HOST_DEVICE static constexpr runtime_policy::Policy runtimePolicy() noexcept { diff --git a/src/axom/core/execution/internal/seq_exec.hpp b/src/axom/core/execution/internal/seq_exec.hpp index 21efc67001..d393fedee8 100644 --- a/src/axom/core/execution/internal/seq_exec.hpp +++ b/src/axom/core/execution/internal/seq_exec.hpp @@ -59,7 +59,7 @@ struct execution_space static int allocatorID() noexcept { - return axom::getDefaultHostAllocatorID(); + return axom::detail::getDefaultHostAllocatorID(); } AXOM_HOST_DEVICE static constexpr runtime_policy::Policy runtimePolicy() noexcept { diff --git a/src/axom/core/memory_management.hpp b/src/axom/core/memory_management.hpp index a7d97d9c9a..3987e5ab91 100644 --- a/src/axom/core/memory_management.hpp +++ b/src/axom/core/memory_management.hpp @@ -197,6 +197,8 @@ inline int getDefaultAllocatorID() #endif } +namespace detail +{ /*! * \brief Returns the ID of the default host allocator. * @@ -214,6 +216,7 @@ inline int getDefaultHostAllocatorID() return MALLOC_ALLOCATOR_ID; #endif } +} // namespace detail /*! * \brief Get the allocator id from which data has been allocated. @@ -575,7 +578,7 @@ inline void fill(void* dst, std::size_t n, const T& value) noexcept // Device memory: fill on host, then copy to device const auto num_bytes = n * sizeof(T); - T* src = allocate(n, axom::getDefaultHostAllocatorID()); + T* src = allocate(n, axom::detail::getDefaultHostAllocatorID()); for(std::size_t i = 0; i < n; ++i) { src[i] = value; diff --git a/src/axom/core/tests/core_execution_space.hpp b/src/axom/core/tests/core_execution_space.hpp index 2fad1eb522..629f1a22da 100644 --- a/src/axom/core/tests/core_execution_space.hpp +++ b/src/axom/core/tests/core_execution_space.hpp @@ -128,7 +128,6 @@ TEST(core_execution_space, check_default_host_allocator) expected_host_memory_space = axom::MemorySpace::Host; #endif - EXPECT_EQ(expected_host_allocator, axom::getDefaultHostAllocatorID()); EXPECT_EQ(expected_host_memory_space, axom::execution_space::memory_space); EXPECT_EQ(expected_host_allocator, axom::execution_space::allocatorID()); @@ -155,7 +154,7 @@ TEST(core_execution_space, check_seq_exec) constexpr bool IS_ASYNC = false; constexpr bool ON_DEVICE = false; - int allocator_id = axom::getDefaultHostAllocatorID(); + int allocator_id = axom::execution_space::allocatorID(); check_execution_mappings 2022 RAJA::seq_exec, @@ -178,7 +177,7 @@ TEST(core_execution_space, check_omp_exec) constexpr bool IS_ASYNC = false; constexpr bool ON_DEVICE = false; - int allocator_id = axom::getDefaultHostAllocatorID(); + int allocator_id = axom::execution_space::allocatorID(); check_execution_mappings Date: Tue, 25 Aug 2026 12:00:53 -0700 Subject: [PATCH 05/12] Add CI test job on dane to test Umpire host allocation --- .gitlab/build_dane.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitlab/build_dane.yml b/.gitlab/build_dane.yml index 18f5ba1a9d..d0c893294b 100644 --- a/.gitlab/build_dane.yml +++ b/.gitlab/build_dane.yml @@ -59,6 +59,13 @@ dane-gcc_13_3_1-werror-src: EXTRA_CMAKE_OPTIONS: "-DENABLE_WARNINGS_AS_ERRORS:BOOL=ON" extends: .src_build_on_dane +dane-gcc_13_3_1-umpire_host_default-werror-src: + variables: + COMPILER: "gcc@13.3.1" + HOST_CONFIG: "dane-toss_4_x86_64_ib-${COMPILER}.cmake" + EXTRA_CMAKE_OPTIONS: "-DENABLE_WARNINGS_AS_ERRORS:BOOL=ON -DAXOM_DEFAULT_HOST_ALLOCATOR=UMPIRE_HOST" + extends: .src_build_on_dane + dane-sanitizers-gcc_13_3_1-src: variables: COMPILER: "gcc@13.3.1" From 5db9bd41958467789f8d8184788c5a1c4238b45f Mon Sep 17 00:00:00 2001 From: Rich Hornung Date: Tue, 25 Aug 2026 12:14:41 -0700 Subject: [PATCH 06/12] Make style --- src/axom/core/examples/core_array_perf.cpp | 8 +++----- src/axom/core/execution/internal/omp_exec.hpp | 5 +---- src/axom/core/execution/internal/seq_exec.hpp | 5 +---- src/axom/primal/tests/primal_intersect.cpp | 15 ++++++--------- src/axom/quest/MarchingCubes.cpp | 6 ++---- .../examples/quest_marching_cubes_example.cpp | 3 +-- 6 files changed, 14 insertions(+), 28 deletions(-) diff --git a/src/axom/core/examples/core_array_perf.cpp b/src/axom/core/examples/core_array_perf.cpp index 3a62f43db1..c0a74f9d31 100644 --- a/src/axom/core/examples/core_array_perf.cpp +++ b/src/axom/core/examples/core_array_perf.cpp @@ -161,12 +161,10 @@ int allocatorIdFromPolicy(axom::runtime_policy::Policy policy) { AXOM_UNUSED_VAR(policy); #if defined(AXOM_USE_UMPIRE) - int allocatorID = policy == axom::runtime_policy::Policy::seq - ? axom::detail::getDefaultHostAllocatorID() - : + int allocatorID = + policy == axom::runtime_policy::Policy::seq ? axom::detail::getDefaultHostAllocatorID() : #if defined(AXOM_RUNTIME_POLICY_USE_OPENMP) - policy == axom::runtime_policy::Policy::omp - ? axom::detail::getDefaultHostAllocatorID() + policy == axom::runtime_policy::Policy::omp ? axom::detail::getDefaultHostAllocatorID() : #endif #if defined(AXOM_RUNTIME_POLICY_USE_CUDA) diff --git a/src/axom/core/execution/internal/omp_exec.hpp b/src/axom/core/execution/internal/omp_exec.hpp index 861f2f69f5..ad04b38b75 100644 --- a/src/axom/core/execution/internal/omp_exec.hpp +++ b/src/axom/core/execution/internal/omp_exec.hpp @@ -47,10 +47,7 @@ struct execution_space AXOM_HOST_DEVICE static constexpr bool onDevice() noexcept { return false; } AXOM_HOST_DEVICE static constexpr char* name() noexcept { return (char*)"[OMP_EXEC]"; } - static int allocatorID() noexcept - { - return axom::detail::getDefaultHostAllocatorID(); - } + static int allocatorID() noexcept { return axom::detail::getDefaultHostAllocatorID(); } AXOM_HOST_DEVICE static constexpr runtime_policy::Policy runtimePolicy() noexcept { return runtime_policy::Policy::omp; diff --git a/src/axom/core/execution/internal/seq_exec.hpp b/src/axom/core/execution/internal/seq_exec.hpp index d393fedee8..cde15fb027 100644 --- a/src/axom/core/execution/internal/seq_exec.hpp +++ b/src/axom/core/execution/internal/seq_exec.hpp @@ -57,10 +57,7 @@ struct execution_space AXOM_HOST_DEVICE static constexpr bool onDevice() noexcept { return false; } AXOM_HOST_DEVICE static constexpr char* name() noexcept { return (char*)"[SEQ_EXEC]"; } - static int allocatorID() noexcept - { - return axom::detail::getDefaultHostAllocatorID(); - } + static int allocatorID() noexcept { return axom::detail::getDefaultHostAllocatorID(); } AXOM_HOST_DEVICE static constexpr runtime_policy::Policy runtimePolicy() noexcept { return runtime_policy::Policy::seq; diff --git a/src/axom/primal/tests/primal_intersect.cpp b/src/axom/primal/tests/primal_intersect.cpp index ddc83d2e07..12c02bc44b 100644 --- a/src/axom/primal/tests/primal_intersect.cpp +++ b/src/axom/primal/tests/primal_intersect.cpp @@ -2592,9 +2592,8 @@ void check_plane_bb_intersect() // Determine new allocator (for CUDA or HIP policy, set to device) umpire::Allocator allocator = - (axom::execution_space::onDevice() - ? rm.getAllocator(umpire::resource::Device) - : rm.getAllocator(umpire::resource::Host)); + (axom::execution_space::onDevice() ? rm.getAllocator(umpire::resource::Device) + : rm.getAllocator(umpire::resource::Host)); // Set new default to device axom::setDefaultAllocator(allocator.getId()); @@ -2673,9 +2672,8 @@ void check_plane_seg_intersect() // Determine new allocator (for CUDA or HIP policy, set to device) umpire::Allocator allocator = - (axom::execution_space::onDevice() - ? rm.getAllocator(umpire::resource::Device) - : rm.getAllocator(umpire::resource::Host)); + (axom::execution_space::onDevice() ? rm.getAllocator(umpire::resource::Device) + : rm.getAllocator(umpire::resource::Host)); // Set new default to device axom::setDefaultAllocator(allocator.getId()); @@ -2762,9 +2760,8 @@ void check_segment_segment_intersect_policy() const int current_allocator = axom::getDefaultAllocatorID(); umpire::Allocator allocator = - (axom::execution_space::onDevice() - ? rm.getAllocator(umpire::resource::Device) - : rm.getAllocator(umpire::resource::Host)); + (axom::execution_space::onDevice() ? rm.getAllocator(umpire::resource::Device) + : rm.getAllocator(umpire::resource::Host)); axom::setDefaultAllocator(allocator.getId()); diff --git a/src/axom/quest/MarchingCubes.cpp b/src/axom/quest/MarchingCubes.cpp index 74c6b1de1d..3c1e82391b 100644 --- a/src/axom/quest/MarchingCubes.cpp +++ b/src/axom/quest/MarchingCubes.cpp @@ -195,10 +195,8 @@ void MarchingCubes::populateContourMesh(axom::mint::UnstructuredMesh Date: Tue, 25 Aug 2026 14:34:49 -0700 Subject: [PATCH 07/12] Add release note about default host allocator change. --- RELEASE-NOTES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index cf273a76c4..fd92bca229 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -95,6 +95,10 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/ internal `quest::internal::read_*_mesh()`/`logger_init()` helpers are now declared only when Axom is configured with MPI. Serial code that passed the placeholder `MPI_COMM_SELF` explicitly should drop the argument. - We can now configure Axom without MPI when some of its dependencies were configured with MPI. +- Axom's host execution-space default allocator is now a configure-time policy. The default policy is malloc, regardless + whether Axom is configured with Umpire enabled. Umpire builds may opt into the Umpire `HOST` resource with + `-DAXOM_DEFAULT_HOST_ALLOCATOR=UMPIRE_HOST`. Runtime per-use selection remains available through existing explicit + allocator-ID arguments. ### Fixed - MIR/Bump: `MergeCoordsetPoints` now only emits its node-merge `SLIC_INFO` when MIR `verbose` is enabled on the Conduit options passed through ELVIRA. From 13bfcda1e5427b4c133e5517339a35f610650394 Mon Sep 17 00:00:00 2001 From: Rich Hornung Date: Wed, 26 Aug 2026 13:48:13 -0700 Subject: [PATCH 08/12] Fix grammar --- RELEASE-NOTES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 8dbcf77977..b99bd5f609 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -100,7 +100,7 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/ configured with MPI. Serial code that passed the placeholder `MPI_COMM_SELF` explicitly should drop the argument. - We can now configure Axom without MPI when some of its dependencies were configured with MPI. - Axom's host execution-space default allocator is now a configure-time policy. The default policy is malloc, regardless - whether Axom is configured with Umpire enabled. Umpire builds may opt into the Umpire `HOST` resource with + of whether Axom is configured with Umpire enabled. Umpire builds may opt into the Umpire `HOST` resource with `-DAXOM_DEFAULT_HOST_ALLOCATOR=UMPIRE_HOST`. Runtime per-use selection remains available through existing explicit allocator-ID arguments. From 8a0a4d2928076c2b4f560bca4c52e15887ec6d65 Mon Sep 17 00:00:00 2001 From: Rich Hornung Date: Wed, 26 Aug 2026 13:50:18 -0700 Subject: [PATCH 09/12] Explicitly unset macro in malloc case (reviewer suggestion) --- src/cmake/AxomConfig.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cmake/AxomConfig.cmake b/src/cmake/AxomConfig.cmake index 1b41a66be1..ec9e264346 100644 --- a/src/cmake/AxomConfig.cmake +++ b/src/cmake/AxomConfig.cmake @@ -66,6 +66,7 @@ endforeach() string(TOUPPER "${AXOM_DEFAULT_HOST_ALLOCATOR}" _axom_default_host_allocator_upper) if(_axom_default_host_allocator_upper STREQUAL "MALLOC") set(AXOM_DEFAULT_HOST_ALLOCATOR "MALLOC" CACHE STRING "Default host allocator: MALLOC or UMPIRE_HOST" FORCE) + unset(AXOM_DEFAULT_HOST_ALLOCATOR_USES_UMPIRE_HOST) elseif(_axom_default_host_allocator_upper STREQUAL "UMPIRE_HOST") if(NOT AXOM_USE_UMPIRE) message(FATAL_ERROR From c68478b6b2ca5154e8a5c829c146aad0582861bc Mon Sep 17 00:00:00 2001 From: Rich Hornung Date: Thu, 27 Aug 2026 14:50:06 -0700 Subject: [PATCH 10/12] Fix issues with sidre group not choosing default host allocator --- src/axom/core/memory_management.hpp | 3 +-- src/axom/sidre/core/Group.cpp | 23 +++++++---------------- src/axom/sidre/tests/sidre_group.cpp | 5 ++--- 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/src/axom/core/memory_management.hpp b/src/axom/core/memory_management.hpp index 3987e5ab91..97b265cea0 100644 --- a/src/axom/core/memory_management.hpp +++ b/src/axom/core/memory_management.hpp @@ -577,13 +577,12 @@ inline void fill(void* dst, std::size_t n, const T& value) noexcept doHostFill = false; // Device memory: fill on host, then copy to device - const auto num_bytes = n * sizeof(T); T* src = allocate(n, axom::detail::getDefaultHostAllocatorID()); for(std::size_t i = 0; i < n; ++i) { src[i] = value; } - axom::copy(dst, src, num_bytes); + axom::copy(dst, src, n * sizeof(T)); deallocate(src); } } diff --git a/src/axom/sidre/core/Group.cpp b/src/axom/sidre/core/Group.cpp index c9e35ac0f5..b8182c516d 100644 --- a/src/axom/sidre/core/Group.cpp +++ b/src/axom/sidre/core/Group.cpp @@ -17,6 +17,7 @@ #include "axom/core/Macros.hpp" #include "axom/core/MapCollection.hpp" #include "axom/core/Path.hpp" +#include "axom/core/memory_management.hpp" // Sidre headers #include "Buffer.hpp" @@ -1084,10 +1085,8 @@ Group* Group::createGroup(const std::string& path, bool is_list, bool accept_exi return nullptr; } - SLIC_ASSERT(group->getDefaultArrayAllocatorID() == m_default_array_alloc_id); - SLIC_ASSERT(group->getDefaultTupleAllocatorID() == m_default_tuple_alloc_id); - new_group->setDefaultArrayAllocator(m_default_array_alloc_id); - new_group->setDefaultTupleAllocator(m_default_tuple_alloc_id); + new_group->setDefaultArrayAllocator(group->getDefaultArrayAllocatorID()); + new_group->setDefaultTupleAllocator(group->getDefaultTupleAllocatorID()); return group->attachGroup(new_group); } @@ -1115,11 +1114,8 @@ Group* Group::createUnnamedGroup(bool is_list) return nullptr; } -#ifdef AXOM_USE_UMPIRE - // Why only do this with Umpire? BTNG. - new_group->setDefaultArrayAllocator(getDefaultArrayAllocator()); - new_group->setDefaultTupleAllocator(getDefaultTupleAllocator()); -#endif + new_group->setDefaultArrayAllocator(getDefaultArrayAllocatorID()); + new_group->setDefaultTupleAllocator(getDefaultTupleAllocatorID()); return attachGroup(new_group); } @@ -2290,13 +2286,8 @@ Group::Group(const std::string& name, DataStore* datastore, bool is_list) , m_is_list(is_list) , m_view_coll(nullptr) , m_group_coll(nullptr) -#ifdef AXOM_USE_UMPIRE - , m_default_array_alloc_id(axom::getDefaultAllocatorID()) - , m_default_tuple_alloc_id(axom::getDefaultAllocatorID()) -#else - , m_default_array_alloc_id(axom::MALLOC_ALLOCATOR_ID) - , m_default_tuple_alloc_id(axom::MALLOC_ALLOCATOR_ID) -#endif + , m_default_array_alloc_id(axom::detail::getDefaultHostAllocatorID()) + , m_default_tuple_alloc_id(axom::detail::getDefaultHostAllocatorID()) { if(is_list) { diff --git a/src/axom/sidre/tests/sidre_group.cpp b/src/axom/sidre/tests/sidre_group.cpp index d2dc061fe9..815f8e8ecc 100644 --- a/src/axom/sidre/tests/sidre_group.cpp +++ b/src/axom/sidre/tests/sidre_group.cpp @@ -4140,14 +4140,13 @@ TEST_P(UmpireTest, root_default_allocator) axom::setDefaultAllocator(allocID); DataStore dsPrime; - ASSERT_EQ(dsPrime.getRoot()->getDefaultAllocatorID(), allocID); + ASSERT_EQ(dsPrime.getRoot()->getDefaultAllocatorID(), axom::detail::getDefaultHostAllocatorID()); } TEST_P(UmpireTest, get_set_allocator) { int defaultAllocatorID = axom::getDefaultAllocatorID(); - ASSERT_EQ(root->getDefaultAllocator().getId(), defaultAllocatorID); - ASSERT_EQ(root->getDefaultAllocatorID(), defaultAllocatorID); + ASSERT_EQ(root->getDefaultAllocatorID(), axom::detail::getDefaultHostAllocatorID()); root->setDefaultAllocator(allocID); defaultAllocatorID = axom::getDefaultAllocatorID(); From e641dc08124a4722c3cd2be8bdc9ef245d5f74f2 Mon Sep 17 00:00:00 2001 From: Rich Hornung Date: Thu, 27 Aug 2026 15:10:59 -0700 Subject: [PATCH 11/12] Clarify method comment. --- src/axom/core/memory_management.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/axom/core/memory_management.hpp b/src/axom/core/memory_management.hpp index 97b265cea0..6835f1ad16 100644 --- a/src/axom/core/memory_management.hpp +++ b/src/axom/core/memory_management.hpp @@ -157,7 +157,7 @@ inline void setDefaultAllocator(umpire::resource::MemoryResourceType resource_ty #endif /*! - * \brief Sets the default memory allocator to use. + * \brief Sets the default memory allocator for the Umpire ResourceManager. * \param [in] allocId the Axom allocator id * * \note When Axom is compiled with Umpire and \a allocId is From 89dd157977b42d87563efa8b4f893a0f6e70a352 Mon Sep 17 00:00:00 2001 From: Rich Hornung Date: Fri, 28 Aug 2026 13:13:29 -0700 Subject: [PATCH 12/12] Change order of allocate conditional checks based on new default --- src/axom/core/memory_management.hpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/axom/core/memory_management.hpp b/src/axom/core/memory_management.hpp index 6835f1ad16..47837cfa67 100644 --- a/src/axom/core/memory_management.hpp +++ b/src/axom/core/memory_management.hpp @@ -271,7 +271,7 @@ int getSharedMemoryAllocatorID(std::size_t minSegmentSize = 0); * \brief Allocates a chunk of memory of type T. * * \param [in] n the number of elements to allocate. - * \param [in] allocID the Umpire allocator to use (optional) + * \param [in] allocID the Axom/Umpire allocator to use (optional) * * \tparam T the type of pointer returned. * @@ -290,7 +290,7 @@ inline T* allocate(std::size_t n, int allocID = getDefaultAllocatorID()) noexcep * * \param [in] n the number of elements to allocate. * \param [in] name allocation name (must be non-empty for shared memory allocators) - * \param [in] allocID the Umpire allocator to use (optional) + * \param [in] allocID the Axom/Umpire allocator to use (optional) * * \return pointer to the new allocation or a nullptr if allocation failed. */ @@ -390,6 +390,11 @@ inline T* allocate(std::size_t n, int allocID) noexcept { const std::size_t numbytes = n * sizeof(T); + if(allocID == MALLOC_ALLOCATOR_ID) + { + return static_cast(std::malloc(numbytes)); + } + #ifdef AXOM_USE_UMPIRE if(umpire::ResourceManager& rm = umpire::ResourceManager::getInstance(); rm.isAllocator(allocID)) { @@ -398,11 +403,6 @@ inline T* allocate(std::size_t n, int allocID) noexcept } #endif - if(allocID == MALLOC_ALLOCATOR_ID) - { - return static_cast(std::malloc(numbytes)); - } - std::cerr << "Unrecognized allocator id " << allocID << std::endl; axom::utilities::processAbort(); @@ -414,6 +414,12 @@ inline T* allocate(std::size_t n, const std::string& name, int allocID) noexcept { const std::size_t numbytes = n * sizeof(T); + if(allocID == MALLOC_ALLOCATOR_ID) + { + AXOM_UNUSED_VAR(name); + return static_cast(std::malloc(numbytes)); + } + #ifdef AXOM_USE_UMPIRE if(umpire::ResourceManager& rm = umpire::ResourceManager::getInstance(); rm.isAllocator(allocID)) { @@ -423,12 +429,6 @@ inline T* allocate(std::size_t n, const std::string& name, int allocID) noexcept } #endif - if(allocID == MALLOC_ALLOCATOR_ID) - { - AXOM_UNUSED_VAR(name); - return static_cast(std::malloc(numbytes)); - } - std::cerr << "Unrecognized allocator id " << allocID << std::endl; axom::utilities::processAbort();