diff --git a/examples/cookbook/recipe_coalesce_pool.cpp b/examples/cookbook/recipe_coalesce_pool.cpp index 9d2e0d132..394a2043e 100644 --- a/examples/cookbook/recipe_coalesce_pool.cpp +++ b/examples/cookbook/recipe_coalesce_pool.cpp @@ -27,7 +27,7 @@ int main(int, char**) quick_pool->coalesce(); // _sphinx_tag_tut_call_coalesce_end } else { - UMPIRE_ERROR(umpire::runtime_error, umpire::fmt::format("{} is not a QuickPool, cannot coalesce!", pool.getName())); + UMPIRE_ERROR(umpire::runtime_error, fmt::format("{} is not a QuickPool, cannot coalesce!", pool.getName())); } return 0; diff --git a/examples/cookbook/recipe_get_largest_available_block_in_pool.cpp b/examples/cookbook/recipe_get_largest_available_block_in_pool.cpp index 8cc8d8628..27b058da6 100644 --- a/examples/cookbook/recipe_get_largest_available_block_in_pool.cpp +++ b/examples/cookbook/recipe_get_largest_available_block_in_pool.cpp @@ -23,7 +23,7 @@ int main(int, char**) // _sphinx_tag_tut_unwrap_end if (quick_pool == nullptr) { - UMPIRE_ERROR(umpire::runtime_error, umpire::fmt::format("{} is not a QuickPool", pool.getName())); + UMPIRE_ERROR(umpire::runtime_error, fmt::format("{} is not a QuickPool", pool.getName())); } auto ptr = pool.allocate(1024); diff --git a/examples/cookbook/recipe_move_between_numa.cpp b/examples/cookbook/recipe_move_between_numa.cpp index 16e498ce5..43c18d7e6 100644 --- a/examples/cookbook/recipe_move_between_numa.cpp +++ b/examples/cookbook/recipe_move_between_numa.cpp @@ -48,7 +48,7 @@ int main(int, char**) // The pointer shouldn't change even though the memory location changes if (dst_ptr != src_ptr) { UMPIRE_ERROR(umpire::runtime_error, - umpire::fmt::format("Pointers should match: dst_ptr: {} != src_ptr: {}", dst_ptr, src_ptr)); + fmt::format("Pointers should match: dst_ptr: {} != src_ptr: {}", dst_ptr, src_ptr)); } // Touch it @@ -56,7 +56,7 @@ int main(int, char**) // Verify NUMA node if (umpire::numa::get_location(dst_ptr) != host_nodes[1]) { - UMPIRE_ERROR(umpire::runtime_error, umpire::fmt::format("Move was unsuccessful: {}", dst_ptr)); + UMPIRE_ERROR(umpire::runtime_error, fmt::format("Move was unsuccessful: {}", dst_ptr)); } } @@ -77,7 +77,7 @@ int main(int, char**) // The pointer shouldn't change even though the memory location changes if (dst_ptr != src_ptr) { UMPIRE_ERROR(umpire::runtime_error, - umpire::fmt::format("Pointers should match: dst_ptr: {} != src_ptr: {}", dst_ptr, src_ptr)); + fmt::format("Pointers should match: dst_ptr: {} != src_ptr: {}", dst_ptr, src_ptr)); } // Touch it -- this currently uses the host memset operation (thus, copying @@ -86,7 +86,7 @@ int main(int, char**) // Verify NUMA node if (umpire::numa::get_location(dst_ptr) != device_nodes[0]) { - UMPIRE_ERROR(umpire::runtime_error, umpire::fmt::format("Move was unsuccessful: {}", dst_ptr)); + UMPIRE_ERROR(umpire::runtime_error, fmt::format("Move was unsuccessful: {}", dst_ptr)); } } #endif diff --git a/src/tpl/CMakeLists.txt b/src/tpl/CMakeLists.txt index 60269f882..1a5e9c60f 100644 --- a/src/tpl/CMakeLists.txt +++ b/src/tpl/CMakeLists.txt @@ -133,82 +133,15 @@ if (NOT TARGET camp) SCOPE INTERFACE TARGET_DEFINITIONS CAMP_HAVE_HIP) endif() - endif () -set(fmt_headers - umpire/fmt/fmt.hpp - umpire/fmt/args.h - umpire/fmt/chrono.h - umpire/fmt/color.h - umpire/fmt/compile.h - umpire/fmt/core.h - umpire/fmt/format-inl.h - umpire/fmt/format.h - umpire/fmt/locale.h - umpire/fmt/os.h - umpire/fmt/ostream.h - umpire/fmt/printf.h - umpire/fmt/ranges.h - ) - -blt_add_library(NAME umpire_tpl_fmt - HEADERS ${fmt_headers}) - - -target_include_directories( - umpire_tpl_fmt - INTERFACE - $ - $) - -# Avoid warnings from fmt (so we can still use -Werror) -blt_convert_to_system_includes(TARGET umpire_tpl_fmt) - -target_include_directories( - umpire_tpl_fmt - INTERFACE - $) - -if (C_COMPILER_FAMILY_IS_XL) - set(_fmt_warning_disable_flag - $<$>:-Wno-unknown-attributes> - $<$:-Xcompiler=-Wno-unknown-attributes>) +if (NOT TARGET fmt::fmt-header-only) + find_package(fmt) - target_compile_options(umpire_tpl_fmt INTERFACE ${_fmt_warning_disable_flag}) -endif () - -if (C_COMPILER_FAMILY_IS_PGI) - set(_fmt_warning_disable_flag - "--diag_suppress 1625;--diag_suppress 185;--diag_suppress 811;--diag_suppress 186") - - if (ENABLE_FORTRAN) - target_compile_options(umpire_tpl_fmt - INTERFACE - $<$>:${_fmt_warning_disable_flag}>) - else () - target_compile_options(umpire_tpl_fmt - INTERFACE - ${_fmt_warning_disable_flag}) + if (NOT fmt_FOUND) + add_subdirectory(umpire/fmt) endif () endif () -if (C_COMPILER_FAMILY_IS_GNU) - target_compile_options(umpire_tpl_fmt - INTERFACE - $<$:-fcompare-debug-second>) -endif () - -install(TARGETS - umpire_tpl_fmt - EXPORT umpire-targets - RUNTIME DESTINATION lib - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) - -install(FILES - ${fmt_headers} - DESTINATION include/umpire/fmt) - set(UMPIRE_ENABLE_TESTS ${OLD_ENABLE_TESTS}) set(UMPIRE_ENABLE_FORTRAN ${OLD_ENABLE_FORTRAN}) diff --git a/src/umpire/ResourceManager.cpp b/src/umpire/ResourceManager.cpp index 95dad16d2..f9ef4dcd9 100644 --- a/src/umpire/ResourceManager.cpp +++ b/src/umpire/ResourceManager.cpp @@ -146,7 +146,7 @@ Allocator ResourceManager::makeResource(const std::string& name, MemoryResourceT { if (m_allocators_by_name.find(name) != m_allocators_by_name.end()) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("Allocator \"{}\" already exists, and cannot be re-created.", name)); + fmt::format("Allocator \"{}\" already exists, and cannot be re-created.", name)); } resource::MemoryResourceRegistry& registry{resource::MemoryResourceRegistry::getInstance()}; @@ -196,8 +196,8 @@ strategy::AllocationStrategy* ResourceManager::getAllocationStrategy(const std:: if (resource_name != std::end(resource_names)) { makeResource(name); } else { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Allocator \"{}\" not found. Available allocators: {}", name, - getAllocatorInformation())); + UMPIRE_ERROR(runtime_error, fmt::format("Allocator \"{}\" not found. Available allocators: {}", name, + getAllocatorInformation())); } } @@ -233,7 +233,7 @@ Allocator ResourceManager::getAllocator(int id) if (id < 0) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("Passed an invalid id: {}. Is this a DeviceAllocator instead?", id)); + fmt::format("Passed an invalid id: {}. Is this a DeviceAllocator instead?", id)); } if (id == umpire::invalid_allocator_id) { @@ -242,8 +242,8 @@ Allocator ResourceManager::getAllocator(int id) auto allocator = m_allocators_by_id.find(id); if (allocator == m_allocators_by_id.end()) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Allocator {} not found. Available allocators: {}", id, - getAllocatorInformation())); + UMPIRE_ERROR(runtime_error, fmt::format("Allocator {} not found. Available allocators: {}", id, + getAllocatorInformation())); } return Allocator(m_allocators_by_id[id]); @@ -286,8 +286,8 @@ void ResourceManager::setDefaultAllocator(Allocator allocator) noexcept void ResourceManager::addAlias(const std::string& name, Allocator allocator) { if (isAllocator(name)) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Allocator \"{}\" is already an alias for \"{}\"", name, - getAllocator(name).getName())); + UMPIRE_ERROR(runtime_error, fmt::format("Allocator \"{}\" is already an alias for \"{}\"", name, + getAllocator(name).getName())); } m_allocators_by_name[name] = allocator.getAllocationStrategy(); @@ -296,17 +296,17 @@ void ResourceManager::addAlias(const std::string& name, Allocator allocator) void ResourceManager::removeAlias(const std::string& name, Allocator allocator) { if (!isAllocator(name)) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Allocator \"{}\" is not registered", name)); + UMPIRE_ERROR(runtime_error, fmt::format("Allocator \"{}\" is not registered", name)); } auto a = m_allocators_by_name.find(name); if (a->second->getName().compare(name) == 0) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("\"{}\" is not an alias, so cannot be removed", name)); + UMPIRE_ERROR(runtime_error, fmt::format("\"{}\" is not an alias, so cannot be removed", name)); } if (a->second->getId() != allocator.getId()) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("\"{}\" is not is not registered as an alias of {}", name, allocator.getName())); + fmt::format("\"{}\" is not is not registered as an alias of {}", name, allocator.getName())); } m_allocators_by_name.erase(a); @@ -364,7 +364,7 @@ const util::AllocationRecord* ResourceManager::findAllocationRecord(void* ptr) c auto alloc_record = m_allocations.find(ptr); if (!alloc_record->strategy) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Cannot find allocator for {}", ptr)); + UMPIRE_ERROR(runtime_error, fmt::format("Cannot find allocator for {}", ptr)); } UMPIRE_LOG(Debug, "(Returning allocation record for ptr = " << ptr << ")"); @@ -407,7 +407,7 @@ void ResourceManager::copy(void* dst_ptr, void* src_ptr, std::size_t size) if (size > dst_size) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("Not enough space in destination to copy {} bytes into {} bytes", size, dst_size)); + fmt::format("Not enough space in destination to copy {} bytes into {} bytes", size, dst_size)); } auto op = op_registry.find("COPY", src_alloc_record->strategy, dst_alloc_record->strategy); @@ -453,7 +453,7 @@ camp::resources::EventProxy ResourceManager::copy(voi if (size > dst_size) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("Not enough resource in destination for copy: {} -> {}", size, dst_size)); + fmt::format("Not enough resource in destination for copy: {} -> {}", size, dst_size)); } auto op = op_registry.find("COPY", src_alloc_record->strategy, dst_alloc_record->strategy); @@ -489,7 +489,7 @@ void ResourceManager::memset(void* ptr, int value, std::size_t length) if (length > size) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("Cannot memset over the end of allocation: {} -> {}", length, size)); + fmt::format("Cannot memset over the end of allocation: {} -> {}", length, size)); } auto op = op_registry.find("MEMSET", alloc_record->strategy, alloc_record->strategy); @@ -528,7 +528,7 @@ camp::resources::EventProxy ResourceManager::memset(v if (length > size) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("Cannot memset over the end of allocation: {} -> {}", length, size)); + fmt::format("Cannot memset over the end of allocation: {} -> {}", length, size)); } auto op = op_registry.find("MEMSET", alloc_record->strategy, alloc_record->strategy); @@ -675,8 +675,8 @@ void* ResourceManager::reallocate_impl(void* current_ptr, std::size_t new_size, if (alloc_record->strategy != allocator.getAllocationStrategy()) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("Cannot reallocate {} from allocator \"{}\" with allocator \"{}\"", current_ptr, - alloc.getName(), allocator.getName())); + fmt::format("Cannot reallocate {} from allocator \"{}\" with allocator \"{}\"", current_ptr, + alloc.getName(), allocator.getName())); } // @@ -689,8 +689,8 @@ void* ResourceManager::reallocate_impl(void* current_ptr, std::size_t new_size, auto& op_registry = op::MemoryOperationRegistry::getInstance(); if (current_ptr != alloc_record->ptr) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Cannot reallocate an offset ptr (ptr={}, base={})", - current_ptr, alloc_record->ptr)); + UMPIRE_ERROR(runtime_error, fmt::format("Cannot reallocate an offset ptr (ptr={}, base={})", + current_ptr, alloc_record->ptr)); } std::shared_ptr op; @@ -727,8 +727,8 @@ void* ResourceManager::reallocate_impl(void* current_ptr, std::size_t new_size, if (alloc_record->strategy != allocator.getAllocationStrategy()) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("Cannot reallocate {} from allocator \"{}\" with allocator \"{}\"", current_ptr, - alloc.getName(), allocator.getName())); + fmt::format("Cannot reallocate {} from allocator \"{}\" with allocator \"{}\"", current_ptr, + alloc.getName(), allocator.getName())); } // @@ -741,8 +741,8 @@ void* ResourceManager::reallocate_impl(void* current_ptr, std::size_t new_size, auto& op_registry = op::MemoryOperationRegistry::getInstance(); if (current_ptr != alloc_record->ptr) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Cannot reallocate an offset ptr (ptr={}, base={})", - current_ptr, alloc_record->ptr)); + UMPIRE_ERROR(runtime_error, fmt::format("Cannot reallocate an offset ptr (ptr={}, base={})", + current_ptr, alloc_record->ptr)); } std::shared_ptr op; @@ -816,7 +816,7 @@ void* ResourceManager::move(void* ptr, Allocator allocator) if (ptr != alloc_record->ptr) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("Cannot move an offset ptr (ptr={}, base={})", ptr, alloc_record->ptr)); + fmt::format("Cannot move an offset ptr (ptr={}, base={})", ptr, alloc_record->ptr)); } void* dst_ptr{allocator.allocate(alloc_record->size)}; @@ -876,7 +876,7 @@ strategy::AllocationStrategy* ResourceManager::findAllocatorForId(int id) auto allocator_i = m_allocators_by_id.find(id); if (allocator_i == m_allocators_by_id.end()) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Cannot find allocator with id: {}", id)); + UMPIRE_ERROR(runtime_error, fmt::format("Cannot find allocator with id: {}", id)); } UMPIRE_LOG(Debug, "(id=" << id << ") returning " << allocator_i->second); @@ -888,7 +888,7 @@ strategy::AllocationStrategy* ResourceManager::findAllocatorForPointer(void* ptr auto allocation_record = m_allocations.find(ptr); if (!allocation_record->strategy) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Cannot find allocator for pointer: {}", ptr)); + UMPIRE_ERROR(runtime_error, fmt::format("Cannot find allocator for pointer: {}", ptr)); } UMPIRE_LOG(Debug, "(ptr=" << ptr << ") returning " << allocation_record->strategy); diff --git a/src/umpire/ResourceManager.inl b/src/umpire/ResourceManager.inl index fc482fa98..df9c38428 100644 --- a/src/umpire/ResourceManager.inl +++ b/src/umpire/ResourceManager.inl @@ -30,7 +30,7 @@ Allocator ResourceManager::makeAllocator(const std::string& name, Tracking track UMPIRE_LOG(Debug, "(name=\"" << name << "\")"); if (isAllocator(name)) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Allocator with name \"{}\" is already registered", name)); + UMPIRE_ERROR(runtime_error, fmt::format("Allocator with name \"{}\" is already registered", name)); } allocator = util::make_unique(name, getNextId(), std::forward(args)...); diff --git a/src/umpire/Umpire.cpp b/src/umpire/Umpire.cpp index c2c07c0b4..7fb215cc7 100644 --- a/src/umpire/Umpire.cpp +++ b/src/umpire/Umpire.cpp @@ -229,7 +229,7 @@ void* find_pointer_from_name(Allocator allocator, const std::string& name) { if (ptr == nullptr) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("Allocator \"{}\" is not a Shared Memory Allocator", allocator.getName())); + fmt::format("Allocator \"{}\" is not a Shared Memory Allocator", allocator.getName())); } } return ptr; @@ -311,7 +311,7 @@ void coalesce(Allocator a) bool coalesced{try_coalesce(a)}; if (!coalesced) - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Allocator \"{}\" could not be coalesced", a.getName())); + UMPIRE_ERROR(runtime_error, fmt::format("Allocator \"{}\" could not be coalesced", a.getName())); } } // end namespace umpire diff --git a/src/umpire/alloc/CudaMallocAllocator.hpp b/src/umpire/alloc/CudaMallocAllocator.hpp index 37f13a66e..25a638a74 100644 --- a/src/umpire/alloc/CudaMallocAllocator.hpp +++ b/src/umpire/alloc/CudaMallocAllocator.hpp @@ -35,11 +35,11 @@ struct CudaMallocAllocator { UMPIRE_LOG(Debug, "(bytes=" << size << ") returning " << ptr); if (error != cudaSuccess) { if (error == cudaErrorMemoryAllocation) { - UMPIRE_ERROR(out_of_memory_error, umpire::fmt::format("cudaMalloc( bytes = {} ) failed with error: {}", size, - cudaGetErrorString(error))); + UMPIRE_ERROR(out_of_memory_error, fmt::format("cudaMalloc( bytes = {} ) failed with error: {}", size, + cudaGetErrorString(error))); } else { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("cudaMalloc( bytes = {} ) failed with error: {}", size, - cudaGetErrorString(error))); + UMPIRE_ERROR(runtime_error, fmt::format("cudaMalloc( bytes = {} ) failed with error: {}", size, + cudaGetErrorString(error))); } } @@ -59,7 +59,7 @@ struct CudaMallocAllocator { cudaError_t error = ::cudaFree(ptr); if (error != cudaSuccess) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("cudaFree( ptr = {} ) failed with error: {}", ptr, cudaGetErrorString(error))); + fmt::format("cudaFree( ptr = {} ) failed with error: {}", ptr, cudaGetErrorString(error))); } } }; diff --git a/src/umpire/alloc/CudaMallocManagedAllocator.hpp b/src/umpire/alloc/CudaMallocManagedAllocator.hpp index 5a1af31fa..b6d4f711d 100644 --- a/src/umpire/alloc/CudaMallocManagedAllocator.hpp +++ b/src/umpire/alloc/CudaMallocManagedAllocator.hpp @@ -36,11 +36,11 @@ struct CudaMallocManagedAllocator { UMPIRE_LOG(Debug, "(bytes=" << bytes << ") returning " << ptr); if (error != cudaSuccess) { if (error == cudaErrorMemoryAllocation) { - UMPIRE_ERROR(out_of_memory_error, umpire::fmt::format("cudaMallocManaged( bytes = {} ) failed with error: {}", - bytes, cudaGetErrorString(error))); + UMPIRE_ERROR(out_of_memory_error, fmt::format("cudaMallocManaged( bytes = {} ) failed with error: {}", + bytes, cudaGetErrorString(error))); } else { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("cudaMallocManaged( bytes = {} ) failed with error: {}", bytes, - cudaGetErrorString(error))); + UMPIRE_ERROR(runtime_error, fmt::format("cudaMallocManaged( bytes = {} ) failed with error: {}", bytes, + cudaGetErrorString(error))); } } return ptr; @@ -60,7 +60,7 @@ struct CudaMallocManagedAllocator { cudaError_t error = ::cudaFree(ptr); if (error != cudaSuccess) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("cudaFree( ptr = {} ) failed with error: {}", ptr, cudaGetErrorString(error))); + fmt::format("cudaFree( ptr = {} ) failed with error: {}", ptr, cudaGetErrorString(error))); } } diff --git a/src/umpire/alloc/CudaPinnedAllocator.hpp b/src/umpire/alloc/CudaPinnedAllocator.hpp index 4a9bdd19d..d65567652 100644 --- a/src/umpire/alloc/CudaPinnedAllocator.hpp +++ b/src/umpire/alloc/CudaPinnedAllocator.hpp @@ -24,11 +24,11 @@ struct CudaPinnedAllocator { UMPIRE_LOG(Debug, "(bytes=" << bytes << ") returning " << ptr); if (error != cudaSuccess) { if (error == cudaErrorMemoryAllocation) { - UMPIRE_ERROR(out_of_memory_error, umpire::fmt::format("cudaMalloc( bytes = {} ) failed with error: {}", bytes, - cudaGetErrorString(error))); + UMPIRE_ERROR(out_of_memory_error, fmt::format("cudaMalloc( bytes = {} ) failed with error: {}", bytes, + cudaGetErrorString(error))); } else { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("cudaMalloc( bytes = {} ) failed with error: {}", bytes, - cudaGetErrorString(error))); + UMPIRE_ERROR(runtime_error, fmt::format("cudaMalloc( bytes = {} ) failed with error: {}", bytes, + cudaGetErrorString(error))); } } @@ -40,8 +40,8 @@ struct CudaPinnedAllocator { UMPIRE_LOG(Debug, "(ptr=" << ptr << ")"); cudaError_t error = ::cudaFreeHost(ptr); if (error != cudaSuccess) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("cudaFreeHost( ptr = {} ) failed with error: {}", ptr, - cudaGetErrorString(error))); + UMPIRE_ERROR(runtime_error, fmt::format("cudaFreeHost( ptr = {} ) failed with error: {}", ptr, + cudaGetErrorString(error))); } } diff --git a/src/umpire/alloc/HipMallocAllocator.hpp b/src/umpire/alloc/HipMallocAllocator.hpp index 0a618bbb9..8e8e7777a 100644 --- a/src/umpire/alloc/HipMallocAllocator.hpp +++ b/src/umpire/alloc/HipMallocAllocator.hpp @@ -36,11 +36,11 @@ struct HipMallocAllocator { UMPIRE_LOG(Debug, "(bytes=" << size << ") returning " << ptr); if (error != hipSuccess) { if (error == hipErrorMemoryAllocation) { - UMPIRE_ERROR(out_of_memory_error, umpire::fmt::format("hipMalloc( bytes = {} ) failed with error: {}", size, - hipGetErrorString(error))); + UMPIRE_ERROR(out_of_memory_error, fmt::format("hipMalloc( bytes = {} ) failed with error: {}", size, + hipGetErrorString(error))); } else { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("hipMalloc( bytes = {} ) failed with error: {}", size, - hipGetErrorString(error))); + UMPIRE_ERROR(runtime_error, fmt::format("hipMalloc( bytes = {} ) failed with error: {}", size, + hipGetErrorString(error))); } } @@ -60,7 +60,7 @@ struct HipMallocAllocator { hipError_t error = ::hipFree(ptr); if (error != hipSuccess) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("hipFree( ptr = {} ) failed with error: {}", ptr, hipGetErrorString(error))); + fmt::format("hipFree( ptr = {} ) failed with error: {}", ptr, hipGetErrorString(error))); } } }; diff --git a/src/umpire/alloc/HipMallocManagedAllocator.hpp b/src/umpire/alloc/HipMallocManagedAllocator.hpp index b5551daae..a49eff1bf 100644 --- a/src/umpire/alloc/HipMallocManagedAllocator.hpp +++ b/src/umpire/alloc/HipMallocManagedAllocator.hpp @@ -36,11 +36,11 @@ struct HipMallocManagedAllocator { UMPIRE_LOG(Debug, "(bytes=" << bytes << ") returning " << ptr); if (error != hipSuccess) { if (error == hipErrorMemoryAllocation) { - UMPIRE_ERROR(out_of_memory_error, umpire::fmt::format("hipMallocManaged( bytes = {} ) failed with error: {}", - bytes, hipGetErrorString(error))); + UMPIRE_ERROR(out_of_memory_error, fmt::format("hipMallocManaged( bytes = {} ) failed with error: {}", + bytes, hipGetErrorString(error))); } else { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("hipMallocManaged( bytes = {} ) failed with error: {}", bytes, - hipGetErrorString(error))); + UMPIRE_ERROR(runtime_error, fmt::format("hipMallocManaged( bytes = {} ) failed with error: {}", bytes, + hipGetErrorString(error))); } } @@ -61,7 +61,7 @@ struct HipMallocManagedAllocator { hipError_t error = ::hipFree(ptr); if (error != hipSuccess) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("hipFree( ptr = {} ) failed with error: {}", ptr, hipGetErrorString(error))); + fmt::format("hipFree( ptr = {} ) failed with error: {}", ptr, hipGetErrorString(error))); } } diff --git a/src/umpire/alloc/HipPinnedAllocator.hpp b/src/umpire/alloc/HipPinnedAllocator.hpp index c7e13eba1..c5c54acbc 100644 --- a/src/umpire/alloc/HipPinnedAllocator.hpp +++ b/src/umpire/alloc/HipPinnedAllocator.hpp @@ -24,11 +24,11 @@ struct HipPinnedAllocator { UMPIRE_LOG(Debug, "(bytes=" << bytes << ") returning " << ptr); if (error != hipSuccess) { if (error == hipErrorMemoryAllocation) { - UMPIRE_ERROR(out_of_memory_error, umpire::fmt::format("hipMallocHost( bytes = {} ) failed with error: {}", - bytes, hipGetErrorString(error))); + UMPIRE_ERROR(out_of_memory_error, fmt::format("hipMallocHost( bytes = {} ) failed with error: {}", + bytes, hipGetErrorString(error))); } else { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("hipMallocHost( bytes = {} ) failed with error: {}", bytes, - hipGetErrorString(error))); + UMPIRE_ERROR(runtime_error, fmt::format("hipMallocHost( bytes = {} ) failed with error: {}", bytes, + hipGetErrorString(error))); } } @@ -41,7 +41,7 @@ struct HipPinnedAllocator { hipError_t error = ::hipHostFree(ptr); if (error != hipSuccess) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("hipFreeHost( ptr = {} ) failed with error: {}", ptr, hipGetErrorString(error))); + fmt::format("hipFreeHost( ptr = {} ) failed with error: {}", ptr, hipGetErrorString(error))); } } diff --git a/src/umpire/alloc/MallocAllocator.hpp b/src/umpire/alloc/MallocAllocator.hpp index 1aa3448de..efce740fb 100644 --- a/src/umpire/alloc/MallocAllocator.hpp +++ b/src/umpire/alloc/MallocAllocator.hpp @@ -42,9 +42,9 @@ struct MallocAllocator { if (ret == nullptr) { if (errno == ENOMEM) { - UMPIRE_ERROR(out_of_memory_error, umpire::fmt::format("malloc( bytes = {} ) failed.", bytes)) + UMPIRE_ERROR(out_of_memory_error, fmt::format("malloc( bytes = {} ) failed.", bytes)) } else { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("malloc( bytes = {} ) failed {}", bytes, strerror(errno))) + UMPIRE_ERROR(runtime_error, fmt::format("malloc( bytes = {} ) failed {}", bytes, strerror(errno))) } } diff --git a/src/umpire/alloc/OpenMPTargetAllocator.hpp b/src/umpire/alloc/OpenMPTargetAllocator.hpp index 9a0d8f09f..ceaa3afd7 100644 --- a/src/umpire/alloc/OpenMPTargetAllocator.hpp +++ b/src/umpire/alloc/OpenMPTargetAllocator.hpp @@ -37,7 +37,7 @@ struct OpenMPTargetAllocator { if (ret == nullptr) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("omp_target_alloc( bytes = {}, device = {} ) failed. ", bytes, device)); + fmt::format("omp_target_alloc( bytes = {}, device = {} ) failed. ", bytes, device)); } else { return ret; } diff --git a/src/umpire/alloc/PosixMemalignAllocator.hpp b/src/umpire/alloc/PosixMemalignAllocator.hpp index 7b0bbae36..e667d11a2 100644 --- a/src/umpire/alloc/PosixMemalignAllocator.hpp +++ b/src/umpire/alloc/PosixMemalignAllocator.hpp @@ -40,12 +40,12 @@ struct PosixMemalignAllocator { if (ret == nullptr) { if (err == ENOMEM) { UMPIRE_ERROR(out_of_memory_error, - umpire::fmt::format("posix_memalign( bytes = {}, pagesize = {} ) failed with error = {}", bytes, - get_page_size(), strerror(err))); + fmt::format("posix_memalign( bytes = {}, pagesize = {} ) failed with error = {}", bytes, + get_page_size(), strerror(err))); } else { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("posix_memalign( bytes = {}, pagesize = {} ) failed with error = {}", bytes, - get_page_size(), strerror(err))); + fmt::format("posix_memalign( bytes = {}, pagesize = {} ) failed with error = {}", bytes, + get_page_size(), strerror(err))); } } diff --git a/src/umpire/alloc/SyclMallocAllocator.hpp b/src/umpire/alloc/SyclMallocAllocator.hpp index bfa541bf5..fc4d8b70e 100644 --- a/src/umpire/alloc/SyclMallocAllocator.hpp +++ b/src/umpire/alloc/SyclMallocAllocator.hpp @@ -35,7 +35,7 @@ struct SyclMallocAllocator { UMPIRE_LOG(Debug, "(bytes=" << size << ") returning " << ptr); if (ptr == nullptr) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("sycl::malloc_device( bytes = {} ) failed", size)); + UMPIRE_ERROR(runtime_error, fmt::format("sycl::malloc_device( bytes = {} ) failed", size)); } else { return ptr; } diff --git a/src/umpire/alloc/SyclMallocManagedAllocator.hpp b/src/umpire/alloc/SyclMallocManagedAllocator.hpp index 33ead5d0b..cc9e74a61 100644 --- a/src/umpire/alloc/SyclMallocManagedAllocator.hpp +++ b/src/umpire/alloc/SyclMallocManagedAllocator.hpp @@ -35,7 +35,7 @@ struct SyclMallocManagedAllocator { UMPIRE_LOG(Debug, "(bytes=" << bytes << ") returning " << usm_ptr); if (usm_ptr == nullptr) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("sycl::malloc_shared( bytes = {} ) failed", bytes)); + UMPIRE_ERROR(runtime_error, fmt::format("sycl::malloc_shared( bytes = {} ) failed", bytes)); } else { return usm_ptr; } diff --git a/src/umpire/alloc/SyclPinnedAllocator.hpp b/src/umpire/alloc/SyclPinnedAllocator.hpp index 32f42a883..44146dee2 100644 --- a/src/umpire/alloc/SyclPinnedAllocator.hpp +++ b/src/umpire/alloc/SyclPinnedAllocator.hpp @@ -35,7 +35,7 @@ struct SyclPinnedAllocator { UMPIRE_LOG(Debug, "(bytes=" << size << ") returning " << ptr); if (ptr == nullptr) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("sycl::malloc_host( bytes = {} ) failed", size)); + UMPIRE_ERROR(runtime_error, fmt::format("sycl::malloc_host( bytes = {} ) failed", size)); } else { return ptr; } diff --git a/src/umpire/device_allocator_helper.cpp b/src/umpire/device_allocator_helper.cpp index 049306952..e3b9e6cc6 100644 --- a/src/umpire/device_allocator_helper.cpp +++ b/src/umpire/device_allocator_helper.cpp @@ -90,7 +90,7 @@ __host__ __device__ DeviceAllocator get_device_allocator(const char* name) int index = get_index(name); if (index == -1) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("No DeviceAllocator named \"{}\" was found", name)); + UMPIRE_ERROR(runtime_error, fmt::format("No DeviceAllocator named \"{}\" was found", name)); } #if !defined(__CUDA_ARCH__) && !defined(__HIP_DEVICE_COMPILE__) @@ -105,10 +105,10 @@ __host__ __device__ DeviceAllocator get_device_allocator(int da_id) int id = convert_to_array_index(da_id); if (id < 0 || id > (UMPIRE_TOTAL_DEV_ALLOCS - 1)) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Invalid id given: {}", id)); + UMPIRE_ERROR(runtime_error, fmt::format("Invalid id given: {}", id)); } if (!is_device_allocator(da_id)) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("No DeviceAllocator with id: {} was found", id)); + UMPIRE_ERROR(runtime_error, fmt::format("No DeviceAllocator with id: {} was found", id)); } #if !defined(__CUDA_ARCH__) && !defined(__HIP_DEVICE_COMPILE__) @@ -127,7 +127,7 @@ __host__ __device__ bool is_device_allocator(const char* name) UMPIRE_LOG(Warning, "No DeviceAllocator by the name " << name << " was found."); return false; #else - UMPIRE_ERROR(runtime_error, umpire::fmt::format("No DeviceAllocator by the name \"{}\" was found", name)); + UMPIRE_ERROR(runtime_error, fmt::format("No DeviceAllocator by the name \"{}\" was found", name)); #endif } @@ -147,7 +147,7 @@ __host__ __device__ bool is_device_allocator(int da_id) UMPIRE_LOG(Warning, "Invalid ID given: " << id); return false; #else - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Invalid id given: {}", id)); + UMPIRE_ERROR(runtime_error, fmt::format("Invalid id given: {}", id)); #endif } @@ -166,7 +166,7 @@ __host__ DeviceAllocator make_device_allocator(Allocator allocator, size_t size, static int index{0}; if (size <= 0) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Invalid size passed to DeviceAllocator: ", size)); + UMPIRE_ERROR(runtime_error, fmt::format("Invalid size passed to DeviceAllocator: ", size)); } if (UMPIRE_DEV_ALLOCS_h == nullptr) { diff --git a/src/umpire/event/CMakeLists.txt b/src/umpire/event/CMakeLists.txt index fa1861415..199a444b9 100644 --- a/src/umpire/event/CMakeLists.txt +++ b/src/umpire/event/CMakeLists.txt @@ -17,7 +17,7 @@ set (umpire_event_sources json_file_store.cpp recorder_factory.cpp) -set (umpire_event_depends umpire_tpl_fmt umpire_tpl_json camp) +set (umpire_event_depends fmt::fmt-header-only umpire_tpl_json camp) if (UMPIRE_ENABLE_CUDA) set(umpire_event_depends diff --git a/src/umpire/event/json_file_store.cpp b/src/umpire/event/json_file_store.cpp index d74406ec6..7a06aabf6 100644 --- a/src/umpire/event/json_file_store.cpp +++ b/src/umpire/event/json_file_store.cpp @@ -15,7 +15,7 @@ #include #include "umpire/event/event_json.hpp" -#include "umpire/fmt/fmt.hpp" +#include "fmt/format.h" #include "umpire/json/json.hpp" #include "umpire/util/error.hpp" @@ -95,7 +95,7 @@ std::vector json_file_store::get_events() e = json_event; } catch (...) { UMPIRE_ERROR(umpire::runtime_error, - umpire::fmt::format("json_file_store::get_events: Error parsing Line #{}", line_number)); + fmt::format("json_file_store::get_events: Error parsing Line #{}", line_number)); } events.push_back(e); @@ -116,7 +116,7 @@ std::vector json_file_store::get_events() f.open(m_filename, std::fstream::in); if (f.fail()) { - UMPIRE_ERROR(umpire::runtime_error, umpire::fmt::format("Failed to open {}", m_filename)); + UMPIRE_ERROR(umpire::runtime_error, fmt::format("Failed to open {}", m_filename)); } while (std::getline(f, line)) { @@ -128,7 +128,7 @@ std::vector json_file_store::get_events() e = json_event; } catch (...) { UMPIRE_ERROR(umpire::runtime_error, - umpire::fmt::format("json_file_store::get_events: Error parsing Line #{}", line_number)); + fmt::format("json_file_store::get_events: Error parsing Line #{}", line_number)); } events.push_back(e); @@ -146,7 +146,7 @@ void json_file_store::open_store() m_fstream = fopen(m_filename.c_str(), m_read_only ? "r" : "w"); if (m_fstream == NULL) { - UMPIRE_ERROR(umpire::runtime_error, umpire::fmt::format("Failed to open {}", m_filename)); + UMPIRE_ERROR(umpire::runtime_error, fmt::format("Failed to open {}", m_filename)); } } } diff --git a/src/umpire/op/CudaAdviseOperation.cpp b/src/umpire/op/CudaAdviseOperation.cpp index 31bb432fd..04d2c38ec 100644 --- a/src/umpire/op/CudaAdviseOperation.cpp +++ b/src/umpire/op/CudaAdviseOperation.cpp @@ -25,8 +25,8 @@ void CudaAdviseOperation::apply(void* src_ptr, util::AllocationRecord* UMPIRE_UN if (error != cudaSuccess) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("cudaMemAdvise( src_ptr = {}, length = {}, device = {}) failed with error: {}", - src_ptr, length, device, cudaGetErrorString(error))); + fmt::format("cudaMemAdvise( src_ptr = {}, length = {}, device = {}) failed with error: {}", + src_ptr, length, device, cudaGetErrorString(error))); } } diff --git a/src/umpire/op/CudaCopyOperation.cpp b/src/umpire/op/CudaCopyOperation.cpp index 905e91246..ac255de78 100644 --- a/src/umpire/op/CudaCopyOperation.cpp +++ b/src/umpire/op/CudaCopyOperation.cpp @@ -28,7 +28,7 @@ void CudaCopyOperation::transform(void* src_ptr, void** dst_ptr, if (error != cudaSuccess) { UMPIRE_ERROR( runtime_error, - umpire::fmt::format( + fmt::format( "CudaMemmcpy( dest_ptr = {}, src_ptr = {}, length = {}, cudaMemcpyDeviceToDevice) failed with error: {}", *dst_ptr, src_ptr, length, cudaGetErrorString(error))); } @@ -40,8 +40,8 @@ camp::resources::EventProxy CudaCopyOperation::transf { auto device = ctx.try_get(); if (!device) { - UMPIRE_ERROR(resource_error, umpire::fmt::format("Expected resources::Cuda, got resources::{}", - platform_to_string(ctx.get_platform()))); + UMPIRE_ERROR(resource_error, fmt::format("Expected resources::Cuda, got resources::{}", + platform_to_string(ctx.get_platform()))); } auto stream = device->get_stream(); @@ -49,9 +49,9 @@ camp::resources::EventProxy CudaCopyOperation::transf if (error != cudaSuccess) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("cudaMemcpyAsync( dest_ptr = {}, src_ptr = {}, length = {}, " - "cudaMemcpyDeviceToDevice, stream = {}) failed with error: {}", - *dst_ptr, src_ptr, length, cudaGetErrorString(error), (void*)stream)); + fmt::format("cudaMemcpyAsync( dest_ptr = {}, src_ptr = {}, length = {}, " + "cudaMemcpyDeviceToDevice, stream = {}) failed with error: {}", + *dst_ptr, src_ptr, length, cudaGetErrorString(error), (void*)stream)); } return camp::resources::EventProxy{ctx}; diff --git a/src/umpire/op/CudaGetAttributeOperation.cpp b/src/umpire/op/CudaGetAttributeOperation.cpp index f73afd5cf..10eabe1c8 100644 --- a/src/umpire/op/CudaGetAttributeOperation.cpp +++ b/src/umpire/op/CudaGetAttributeOperation.cpp @@ -23,8 +23,8 @@ bool CudaGetAttributeOperation::check_apply(void* src_ptr, umpire::ut error = ::cudaGetDeviceProperties(&properties, 0); if (error != cudaSuccess) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("cudaGetDeviceProperties( device = 0 ) failed with error: {}", - cudaGetErrorString(error))); + UMPIRE_ERROR(runtime_error, fmt::format("cudaGetDeviceProperties( device = 0 ) failed with error: {}", + cudaGetErrorString(error))); } if (properties.managedMemory == 1 && properties.concurrentManagedAccess == 1) { diff --git a/src/umpire/op/CudaMemPrefetchOperation.cpp b/src/umpire/op/CudaMemPrefetchOperation.cpp index 4e01a8d4f..ffb1c2844 100644 --- a/src/umpire/op/CudaMemPrefetchOperation.cpp +++ b/src/umpire/op/CudaMemPrefetchOperation.cpp @@ -30,8 +30,8 @@ void CudaMemPrefetchOperation::apply(void* src_ptr, util::AllocationRecord* UMPI error = ::cudaGetDeviceProperties(&properties, gpu); if (error != cudaSuccess) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("cudaGetDeviceProperties( device = {} ) failed with error: {}", - device, cudaGetErrorString(error))); + UMPIRE_ERROR(runtime_error, fmt::format("cudaGetDeviceProperties( device = {} ) failed with error: {}", + device, cudaGetErrorString(error))); } if (properties.managedMemory == 1 && properties.concurrentManagedAccess == 1) { @@ -40,8 +40,8 @@ void CudaMemPrefetchOperation::apply(void* src_ptr, util::AllocationRecord* UMPI if (error != cudaSuccess) { UMPIRE_ERROR( runtime_error, - umpire::fmt::format("cudaMemPrefetchAsync( src_ptr = {}, length = {}, device = {}) failed with error: {}", - src_ptr, length, device, cudaGetErrorString(error))); + fmt::format("cudaMemPrefetchAsync( src_ptr = {}, length = {}, device = {}) failed with error: {}", + src_ptr, length, device, cudaGetErrorString(error))); } } } @@ -63,14 +63,14 @@ camp::resources::EventProxy CudaMemPrefetchOperation: auto resource = ctx.try_get(); if (!resource) { - UMPIRE_ERROR(resource_error, umpire::fmt::format("Expected resources::Cuda, got resources::{}", - platform_to_string(ctx.get_platform()))); + UMPIRE_ERROR(resource_error, fmt::format("Expected resources::Cuda, got resources::{}", + platform_to_string(ctx.get_platform()))); } auto stream = resource->get_stream(); if (error != cudaSuccess) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("cudaGetDeviceProperties( device = {} ) failed with error: {}", - device, cudaGetErrorString(error))); + UMPIRE_ERROR(runtime_error, fmt::format("cudaGetDeviceProperties( device = {} ) failed with error: {}", + device, cudaGetErrorString(error))); } if (properties.managedMemory == 1 && properties.concurrentManagedAccess == 1) { @@ -79,7 +79,7 @@ camp::resources::EventProxy CudaMemPrefetchOperation: if (error != cudaSuccess) { UMPIRE_ERROR( runtime_error, - umpire::fmt::format( + fmt::format( "cudaMemPrefetchAsync( src_ptr = {}, length = {}, device = {}, stream = {}) failed with error: {}", src_ptr, length, device, cudaGetErrorString(error), (void*)stream)); } diff --git a/src/umpire/op/CudaMemsetOperation.cpp b/src/umpire/op/CudaMemsetOperation.cpp index 04ad31626..851fa493e 100644 --- a/src/umpire/op/CudaMemsetOperation.cpp +++ b/src/umpire/op/CudaMemsetOperation.cpp @@ -22,8 +22,8 @@ void CudaMemsetOperation::apply(void* src_ptr, util::AllocationRecord* UMPIRE_UN if (error != cudaSuccess) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("cudaMemset( src_ptr = {}, val = {}, length = {}) failed with error: {}", src_ptr, - value, length, cudaGetErrorString(error))); + fmt::format("cudaMemset( src_ptr = {}, val = {}, length = {}) failed with error: {}", src_ptr, + value, length, cudaGetErrorString(error))); } } @@ -33,8 +33,8 @@ camp::resources::EventProxy CudaMemsetOperation::appl { auto device = ctx.try_get(); if (!device) { - UMPIRE_ERROR(resource_error, umpire::fmt::format("Expected resources::Cuda, got resources::{}", - platform_to_string(ctx.get_platform()))); + UMPIRE_ERROR(resource_error, fmt::format("Expected resources::Cuda, got resources::{}", + platform_to_string(ctx.get_platform()))); } auto stream = device->get_stream(); @@ -42,7 +42,7 @@ camp::resources::EventProxy CudaMemsetOperation::appl if (error != cudaSuccess) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format( + fmt::format( "cudaMemsetAsync( src_ptr = {}, value = {}, length = {}, stream = {}) failed with error: {}", src_ptr, value, length, cudaGetErrorString(error), (void*)stream)); } diff --git a/src/umpire/op/HipAdviseOperation.cpp b/src/umpire/op/HipAdviseOperation.cpp index 4af7648c2..9d8cf95e4 100644 --- a/src/umpire/op/HipAdviseOperation.cpp +++ b/src/umpire/op/HipAdviseOperation.cpp @@ -25,8 +25,8 @@ void HipAdviseOperation::apply(void* src_ptr, util::AllocationRecord* UMPIRE_UNU if (error != hipSuccess) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("hipMemAdvise( src_ptr = {}, length = {}, device = {}) failed with error: {}", - src_ptr, length, device, hipGetErrorString(error))); + fmt::format("hipMemAdvise( src_ptr = {}, length = {}, device = {}) failed with error: {}", + src_ptr, length, device, hipGetErrorString(error))); } } diff --git a/src/umpire/op/HipCopyOperation.cpp b/src/umpire/op/HipCopyOperation.cpp index 134604c79..032d67292 100644 --- a/src/umpire/op/HipCopyOperation.cpp +++ b/src/umpire/op/HipCopyOperation.cpp @@ -27,8 +27,8 @@ void HipCopyOperation::transform(void* src_ptr, void** dst_ptr, if (error != hipSuccess) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("hipMemcpy( dest_ptr = {}, src_ptr = {}, length = {}) failed with error: {}", - *dst_ptr, src_ptr, length, hipGetErrorString(error))); + fmt::format("hipMemcpy( dest_ptr = {}, src_ptr = {}, length = {}) failed with error: {}", + *dst_ptr, src_ptr, length, hipGetErrorString(error))); } } @@ -38,8 +38,8 @@ camp::resources::EventProxy HipCopyOperation::transfo { auto device = ctx.try_get(); if (!device) { - UMPIRE_ERROR(resource_error, umpire::fmt::format("Expected resources::Hip, got resources::{}", - platform_to_string(ctx.get_platform()))); + UMPIRE_ERROR(resource_error, fmt::format("Expected resources::Hip, got resources::{}", + platform_to_string(ctx.get_platform()))); } auto stream = device->get_stream(); @@ -47,9 +47,9 @@ camp::resources::EventProxy HipCopyOperation::transfo if (error != hipSuccess) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("hipMemcpyAsync( dest_ptr = {}, src_ptr = {}, length = {}, " - "stream = {}) failed with error: {}", - *dst_ptr, src_ptr, length, hipGetErrorString(error), (void*)stream)); + fmt::format("hipMemcpyAsync( dest_ptr = {}, src_ptr = {}, length = {}, " + "stream = {}) failed with error: {}", + *dst_ptr, src_ptr, length, hipGetErrorString(error), (void*)stream)); } return camp::resources::EventProxy{ctx}; diff --git a/src/umpire/op/HipMemsetOperation.cpp b/src/umpire/op/HipMemsetOperation.cpp index d9d07e711..5032d7eac 100644 --- a/src/umpire/op/HipMemsetOperation.cpp +++ b/src/umpire/op/HipMemsetOperation.cpp @@ -22,8 +22,8 @@ void HipMemsetOperation::apply(void* src_ptr, util::AllocationRecord* UMPIRE_UNU if (error != hipSuccess) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("hipMemset( src_ptr = {}, value = {}, length = {}) failed with error: {}", src_ptr, - value, length, hipGetErrorString(error))); + fmt::format("hipMemset( src_ptr = {}, value = {}, length = {}) failed with error: {}", src_ptr, + value, length, hipGetErrorString(error))); } } @@ -33,8 +33,8 @@ camp::resources::EventProxy HipMemsetOperation::apply { auto device = ctx.try_get(); if (!device) { - UMPIRE_ERROR(resource_error, umpire::fmt::format("Expected resources::Hip, got resources::{}", - platform_to_string(ctx.get_platform()))); + UMPIRE_ERROR(resource_error, fmt::format("Expected resources::Hip, got resources::{}", + platform_to_string(ctx.get_platform()))); } auto stream = device->get_stream(); @@ -43,8 +43,8 @@ camp::resources::EventProxy HipMemsetOperation::apply if (error != hipSuccess) { UMPIRE_ERROR( runtime_error, - umpire::fmt::format("hipMemsetAsync( src_ptr = {}, value = {}, length = {}, stream = {}) failed with error: {}", - src_ptr, value, length, (void*)stream, hipGetErrorString(error))); + fmt::format("hipMemsetAsync( src_ptr = {}, value = {}, length = {}, stream = {}) failed with error: {}", + src_ptr, value, length, (void*)stream, hipGetErrorString(error))); } return camp::resources::EventProxy{ctx}; diff --git a/src/umpire/op/HostReallocateOperation.cpp b/src/umpire/op/HostReallocateOperation.cpp index b3353cf2d..fc5786194 100644 --- a/src/umpire/op/HostReallocateOperation.cpp +++ b/src/umpire/op/HostReallocateOperation.cpp @@ -36,8 +36,8 @@ void HostReallocateOperation::transform(void* current_ptr, void** new_ptr, util: *new_ptr = ::realloc(current_ptr, new_size); if (!*new_ptr) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("::realloc(current_ptr={}, old_size={}, new_size={}) failed.", - current_ptr, old_record.size, new_size)); + UMPIRE_ERROR(runtime_error, fmt::format("::realloc(current_ptr={}, old_size={}, new_size={}) failed.", + current_ptr, old_record.size, new_size)); } ResourceManager::getInstance().registerAllocation(*new_ptr, {*new_ptr, new_size, new_allocation->strategy}); diff --git a/src/umpire/op/MemoryOperationRegistry.cpp b/src/umpire/op/MemoryOperationRegistry.cpp index d992d59bc..13848762f 100644 --- a/src/umpire/op/MemoryOperationRegistry.cpp +++ b/src/umpire/op/MemoryOperationRegistry.cpp @@ -224,15 +224,15 @@ std::shared_ptr MemoryOperationRegistry::find(const auto operations = m_operators.find(name); if (operations == m_operators.end()) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Cannot find operator \"{}\"", name)); + UMPIRE_ERROR(runtime_error, fmt::format("Cannot find operator \"{}\"", name)); } auto op = operations->second.find(platforms); if (op == operations->second.end()) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("Cannot find operator \"{}\" for platforms {}, {}", name, - static_cast(platforms.first), static_cast(platforms.second))); + fmt::format("Cannot find operator \"{}\" for platforms {}, {}", name, + static_cast(platforms.first), static_cast(platforms.second))); } return op->second; diff --git a/src/umpire/op/SyclMemPrefetchOperation.cpp b/src/umpire/op/SyclMemPrefetchOperation.cpp index ac56ac034..dd65bd019 100644 --- a/src/umpire/op/SyclMemPrefetchOperation.cpp +++ b/src/umpire/op/SyclMemPrefetchOperation.cpp @@ -16,7 +16,7 @@ namespace op { void SyclMemPrefetchOperation::apply(void* src_ptr, util::AllocationRecord* allocation, int value, std::size_t length) { if (allocation->strategy->getTraits().id != value) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("SYCL memPrefetch failed with invalid deviceID = {} ", value)); + UMPIRE_ERROR(runtime_error, fmt::format("SYCL memPrefetch failed with invalid deviceID = {} ", value)); } auto sycl_queue = allocation->strategy->getTraits().queue; @@ -28,7 +28,7 @@ void SyclMemPrefetchOperation::apply(void* src_ptr, util::AllocationRecord* allo sycl_queue->prefetch(src_ptr, length); sycl_queue->wait(); } else { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("SYCL memPrefetch failed ( bytes = {} )", length)); + UMPIRE_ERROR(runtime_error, fmt::format("SYCL memPrefetch failed ( bytes = {} )", length)); } } diff --git a/src/umpire/resource/CMakeLists.txt b/src/umpire/resource/CMakeLists.txt index 364286fa5..88c4aa865 100644 --- a/src/umpire/resource/CMakeLists.txt +++ b/src/umpire/resource/CMakeLists.txt @@ -5,7 +5,7 @@ # SPDX-License-Identifier: (MIT) ############################################################################## -set(umpire_resource_depends umpire_util camp umpire_tpl_fmt) +set(umpire_resource_depends umpire_util camp fmt::fmt-header-only) set (umpire_resource_headers DefaultMemoryResource.hpp diff --git a/src/umpire/resource/CudaConstantMemoryResource.cu b/src/umpire/resource/CudaConstantMemoryResource.cu index a376aa6c7..094afd6ab 100644 --- a/src/umpire/resource/CudaConstantMemoryResource.cu +++ b/src/umpire/resource/CudaConstantMemoryResource.cu @@ -37,7 +37,7 @@ void* CudaConstantMemoryResource::allocate(std::size_t bytes) cudaError_t error = ::cudaGetSymbolAddress((void**)&m_ptr, s_umpire_internal_device_constant_memory); if (error != cudaSuccess) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("cudaGetSymbolAddress failed with error: {}", cudaGetErrorString(error))); + UMPIRE_ERROR(runtime_error, fmt::format("cudaGetSymbolAddress failed with error: {}", cudaGetErrorString(error))); } m_initialized = true; @@ -50,7 +50,7 @@ void* CudaConstantMemoryResource::allocate(std::size_t bytes) if (m_offset > (1024 * 64)) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Max total size of constant allocations is 64KB, current size is {} bytes", (m_offset - bytes))); + UMPIRE_ERROR(runtime_error, fmt::format("Max total size of constant allocations is 64KB, current size is {} bytes", (m_offset - bytes))); } UMPIRE_LOG(Debug, "(bytes=" << bytes << ") returning " << ret); diff --git a/src/umpire/resource/CudaDeviceResourceFactory.cpp b/src/umpire/resource/CudaDeviceResourceFactory.cpp index 91938eaaa..d622a9da1 100644 --- a/src/umpire/resource/CudaDeviceResourceFactory.cpp +++ b/src/umpire/resource/CudaDeviceResourceFactory.cpp @@ -45,7 +45,7 @@ MemoryResourceTraits CudaDeviceResourceFactory::getDefaultTraits() if (error != cudaSuccess) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("cudaGetDeviceProperties failed with error: {}", cudaGetErrorString(error))); + fmt::format("cudaGetDeviceProperties failed with error: {}", cudaGetErrorString(error))); } traits.unified = false; diff --git a/src/umpire/resource/CudaUnifiedMemoryResourceFactory.cpp b/src/umpire/resource/CudaUnifiedMemoryResourceFactory.cpp index 8586d505d..54404752d 100644 --- a/src/umpire/resource/CudaUnifiedMemoryResourceFactory.cpp +++ b/src/umpire/resource/CudaUnifiedMemoryResourceFactory.cpp @@ -46,7 +46,7 @@ MemoryResourceTraits CudaUnifiedMemoryResourceFactory::getDefaultTraits() if (error != cudaSuccess) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("cudaGetDeviceProperties failed with error: {}", cudaGetErrorString(error))); + fmt::format("cudaGetDeviceProperties failed with error: {}", cudaGetErrorString(error))); } traits.unified = true; diff --git a/src/umpire/resource/FileMemoryResource.cpp b/src/umpire/resource/FileMemoryResource.cpp index 576f9b456..f9c6b560f 100644 --- a/src/umpire/resource/FileMemoryResource.cpp +++ b/src/umpire/resource/FileMemoryResource.cpp @@ -64,7 +64,7 @@ void* FileMemoryResource::allocate(std::size_t bytes) int fd{open(ss.str().c_str(), O_RDWR | O_CREAT | O_LARGEFILE, S_IRWXU)}; if (fd == -1) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Opening file {} failed: {}", ss.str(), strerror(errno))); + UMPIRE_ERROR(runtime_error, fmt::format("Opening file {} failed: {}", ss.str(), strerror(errno))); } // Setting Size Of Map File @@ -77,7 +77,7 @@ void* FileMemoryResource::allocate(std::size_t bytes) int errno_save = errno; remove(ss.str().c_str()); UMPIRE_ERROR(runtime_error, - umpire::fmt::format("truncate64 of file {} failed: {}", ss.str(), strerror(errno_save))); + fmt::format("truncate64 of file {} failed: {}", ss.str(), strerror(errno_save))); } #if defined(UMPIRE_ENABLE_UMAP) // Using mmap @@ -88,8 +88,8 @@ void* FileMemoryResource::allocate(std::size_t bytes) if (ptr == MAP_FAILED) { int errno_save = errno; remove(ss.str().c_str()); - UMPIRE_ERROR(runtime_error, umpire::fmt::format("mmap of {} to file {} failed: {}", rounded_bytes, ss.str(), - strerror(errno_save))); + UMPIRE_ERROR(runtime_error, fmt::format("mmap of {} to file {} failed: {}", rounded_bytes, ss.str(), + strerror(errno_save))); } // Storing Information On File @@ -116,7 +116,7 @@ void FileMemoryResource::deallocate(void* ptr, std::size_t UMPIRE_UNUSED_ARG(siz if (munmap(iter->first, iter->second->second) < 0) { #endif UMPIRE_ERROR(runtime_error, - umpire::fmt::format("munmap of file {} failed: {}", iter->second->first.c_str(), strerror(errno))); + fmt::format("munmap of file {} failed: {}", iter->second->first.c_str(), strerror(errno))); } #if defined(UMPIRE_ENABLE_UMAP) // close fd @@ -126,7 +126,7 @@ void FileMemoryResource::deallocate(void* ptr, std::size_t UMPIRE_UNUSED_ARG(siz // Remove File if (remove(iter->second->first.c_str()) < 0) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("remove of file {} failed: {}", iter->second->first.c_str(), strerror(errno))); + fmt::format("remove of file {} failed: {}", iter->second->first.c_str(), strerror(errno))); } // Remove Information about file in m_size_map m_size_map.erase(iter->first); diff --git a/src/umpire/resource/HipConstantMemoryResource.cpp b/src/umpire/resource/HipConstantMemoryResource.cpp index 65c5f72cf..6537b8024 100644 --- a/src/umpire/resource/HipConstantMemoryResource.cpp +++ b/src/umpire/resource/HipConstantMemoryResource.cpp @@ -40,8 +40,8 @@ void* HipConstantMemoryResource::allocate(std::size_t bytes) if (m_offset > 1024 * 64) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("Max total size of constant allocations is 64KB, current size is {} bytes", - (m_offset - bytes))); + fmt::format("Max total size of constant allocations is 64KB, current size is {} bytes", + (m_offset - bytes))); } UMPIRE_LOG(Debug, "(bytes=" << bytes << ") returning " << ret); diff --git a/src/umpire/resource/HipDeviceResourceFactory.cpp b/src/umpire/resource/HipDeviceResourceFactory.cpp index 7ca003db0..0244f5273 100644 --- a/src/umpire/resource/HipDeviceResourceFactory.cpp +++ b/src/umpire/resource/HipDeviceResourceFactory.cpp @@ -43,7 +43,7 @@ MemoryResourceTraits HipDeviceResourceFactory::getDefaultTraits() if (error != hipSuccess) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("hipGetDeviceProperties failed with error: {}", hipGetErrorString(error))); + fmt::format("hipGetDeviceProperties failed with error: {}", hipGetErrorString(error))); } traits.unified = false; diff --git a/src/umpire/resource/HipUnifiedMemoryResourceFactory.cpp b/src/umpire/resource/HipUnifiedMemoryResourceFactory.cpp index baef96880..50c22276d 100644 --- a/src/umpire/resource/HipUnifiedMemoryResourceFactory.cpp +++ b/src/umpire/resource/HipUnifiedMemoryResourceFactory.cpp @@ -44,7 +44,7 @@ MemoryResourceTraits HipUnifiedMemoryResourceFactory::getDefaultTraits() if (error != hipSuccess) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("hipGetDeviceProperties failed with error: {}", hipGetErrorString(error))); + fmt::format("hipGetDeviceProperties failed with error: {}", hipGetErrorString(error))); } traits.unified = true; diff --git a/src/umpire/resource/HostSharedMemoryResourceImpl.hpp b/src/umpire/resource/HostSharedMemoryResourceImpl.hpp index 7befb9849..ee85d94a0 100644 --- a/src/umpire/resource/HostSharedMemoryResourceImpl.hpp +++ b/src/umpire/resource/HostSharedMemoryResourceImpl.hpp @@ -74,15 +74,15 @@ class HostSharedMemoryResource::impl { created = true; completed = true; } else if (err != EEXIST) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Failed to create shared memory segment \"{}\": {}", - m_segment_name, strerror(err))); + UMPIRE_ERROR(runtime_error, fmt::format("Failed to create shared memory segment \"{}\": {}", + m_segment_name, strerror(err))); } else { if (open_shared_memory_segment(err, O_RDWR)) { created = false; completed = true; } else if (err != ENOENT) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Failed to open shared memory file \"{}\": {}", - m_segment_name, strerror(err))); + UMPIRE_ERROR(runtime_error, fmt::format("Failed to open shared memory file \"{}\": {}", + m_segment_name, strerror(err))); } } std::this_thread::yield(); @@ -91,8 +91,8 @@ class HostSharedMemoryResource::impl { if (created) { if (0 != ftruncate(m_segment_fd, size)) { err = errno; - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Failed to set size for shared memory segment \"{}\": {}", - m_segment_name, strerror(err))); + UMPIRE_ERROR(runtime_error, fmt::format("Failed to set size for shared memory segment \"{}\": {}", + m_segment_name, strerror(err))); } map_shared_memory_segment(); @@ -102,20 +102,20 @@ class HostSharedMemoryResource::impl { pthread_mutexattr_t mattr; if ((err = pthread_mutexattr_init(&mattr)) != 0) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("Failed to initialize mutex attributes for shared memory segment \"{}\": {}", - m_segment_name, strerror(err))); + fmt::format("Failed to initialize mutex attributes for shared memory segment \"{}\": {}", + m_segment_name, strerror(err))); } if ((err = pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED)) != 0) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("Failed to set shared attributes for shared memory segment \"{}\": {}", - m_segment_name, strerror(err))); + fmt::format("Failed to set shared attributes for shared memory segment \"{}\": {}", + m_segment_name, strerror(err))); } if ((err = pthread_mutex_init(&m_segment->mutex, &mattr)) != 0) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("Failed to initialize mutex for shared memory segment \"{}\": {}", - m_segment_name, strerror(err))); + fmt::format("Failed to initialize mutex for shared memory segment \"{}\": {}", + m_segment_name, strerror(err))); } m_segment->segment_size = size; @@ -140,8 +140,8 @@ class HostSharedMemoryResource::impl { if (fstat(m_segment_fd, &st) < 0) { err = errno; - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Failed fstat for shared memory segment {}: {}", - m_segment_name, strerror(err))); + UMPIRE_ERROR(runtime_error, fmt::format("Failed fstat for shared memory segment {}: {}", + m_segment_name, strerror(err))); } filesize = st.st_size; std::this_thread::yield(); @@ -192,8 +192,8 @@ class HostSharedMemoryResource::impl { UMPIRE_LOG(Debug, "(name=\"" << name << ", requested_size=" << requested_size << ")"); if ((err = pthread_mutex_lock(&m_segment->mutex)) != 0) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Failed to lock mutex for shared memory segment {}: {}", - m_segment_name, strerror(err))); + UMPIRE_ERROR(runtime_error, fmt::format("Failed to lock mutex for shared memory segment {}: {}", + m_segment_name, strerror(err))); } // First let's see if the allaction already exists @@ -233,7 +233,7 @@ class HostSharedMemoryResource::impl { if (best == nullptr) { UMPIRE_ERROR(out_of_memory_error, - umpire::fmt::format("shared memory allocation( bytes = {} ) failed", requested_size)); + fmt::format("shared memory allocation( bytes = {} ) failed", requested_size)); } else { offset_to_pointer(best->memory_offset, ptr); } @@ -255,8 +255,8 @@ class HostSharedMemoryResource::impl { int err{0}; if ((err = pthread_mutex_lock(&m_segment->mutex)) != 0) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Failed to lock mutex for shared memory segment {}: {}", - m_segment_name, strerror(err))); + UMPIRE_ERROR(runtime_error, fmt::format("Failed to lock mutex for shared memory segment {}: {}", + m_segment_name, strerror(err))); } block_ptr->reference_count--; @@ -289,8 +289,8 @@ class HostSharedMemoryResource::impl { int err{0}; if ((err = pthread_mutex_lock(&m_segment->mutex)) != 0) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Failed to lock mutex for shared memory segment {}: {}", - m_segment_name, strerror(err))); + UMPIRE_ERROR(runtime_error, fmt::format("Failed to lock mutex for shared memory segment {}: {}", + m_segment_name, strerror(err))); } // First let's see if the allaction already exists @@ -492,8 +492,8 @@ class HostSharedMemoryResource::impl { struct ::stat buf; if (0 != fstat(m_segment_fd, &buf)) { int err = errno; - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Failed to obtain size of shared object \"{}\": {}", - m_segment_name, strerror(err))); + UMPIRE_ERROR(runtime_error, fmt::format("Failed to obtain size of shared object \"{}\": {}", + m_segment_name, strerror(err))); } auto size = buf.st_size; @@ -506,7 +506,7 @@ class HostSharedMemoryResource::impl { if (base == MAP_FAILED) { int err = errno; UMPIRE_ERROR(runtime_error, - umpire::fmt::format("Failed to map shared object \"{}\": {}", m_segment_name, strerror(err))); + fmt::format("Failed to map shared object \"{}\": {}", m_segment_name, strerror(err))); } m_segment = static_cast(base); diff --git a/src/umpire/resource/MemoryResourceRegistry.cpp b/src/umpire/resource/MemoryResourceRegistry.cpp index 7d011e130..b75413370 100644 --- a/src/umpire/resource/MemoryResourceRegistry.cpp +++ b/src/umpire/resource/MemoryResourceRegistry.cpp @@ -230,7 +230,7 @@ std::unique_ptr MemoryResourceRegistry::makeMemoryReso } } - UMPIRE_ERROR(runtime_error, umpire::fmt::format("MemoryResource \"{}\" not found", name)); + UMPIRE_ERROR(runtime_error, fmt::format("MemoryResource \"{}\" not found", name)); } std::unique_ptr MemoryResourceRegistry::makeMemoryResource(const std::string& name, int id, @@ -243,7 +243,7 @@ std::unique_ptr MemoryResourceRegistry::makeMemoryReso } } - UMPIRE_ERROR(runtime_error, umpire::fmt::format("MemoryResource \"{}\" not found", name)); + UMPIRE_ERROR(runtime_error, fmt::format("MemoryResource \"{}\" not found", name)); } MemoryResourceTraits MemoryResourceRegistry::getDefaultTraitsForResource(const std::string& name) @@ -254,7 +254,7 @@ MemoryResourceTraits MemoryResourceRegistry::getDefaultTraitsForResource(const s } } - UMPIRE_ERROR(runtime_error, umpire::fmt::format("MemoryResource \"{}\" not found", name)); + UMPIRE_ERROR(runtime_error, fmt::format("MemoryResource \"{}\" not found", name)); } } // end of namespace resource diff --git a/src/umpire/resource/MemoryResourceTypes.hpp b/src/umpire/resource/MemoryResourceTypes.hpp index b64c0eaef..efbfcce80 100644 --- a/src/umpire/resource/MemoryResourceTypes.hpp +++ b/src/umpire/resource/MemoryResourceTypes.hpp @@ -54,7 +54,7 @@ inline std::string resource_to_string(MemoryResourceType type) case Shared: return "SHARED"; default: - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Unkown resource type: {}", type)); + UMPIRE_ERROR(runtime_error, fmt::format("Unkown resource type: {}", type)); } // @@ -88,7 +88,7 @@ inline MemoryResourceType string_to_resource(const std::string& resource) else if (resource == "SHARED") return MemoryResourceType::Shared; else { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Unkown resource name \"{}\"", resource)); + UMPIRE_ERROR(runtime_error, fmt::format("Unkown resource name \"{}\"", resource)); } // diff --git a/src/umpire/strategy/DynamicPoolList.cpp b/src/umpire/strategy/DynamicPoolList.cpp index ce01cceba..193276754 100644 --- a/src/umpire/strategy/DynamicPoolList.cpp +++ b/src/umpire/strategy/DynamicPoolList.cpp @@ -147,7 +147,7 @@ PoolCoalesceHeuristic DynamicPoolList::percent_releasable(int p if (percentage < 0 || percentage > 100) { UMPIRE_ERROR( runtime_error, - umpire::fmt::format("Invalid percentage {}, percentage must be an integer between 0 and 100", percentage)); + fmt::format("Invalid percentage {}, percentage must be an integer between 0 and 100", percentage)); } if (percentage == 0) { @@ -169,7 +169,7 @@ PoolCoalesceHeuristic DynamicPoolList::percent_releasable_hwm(i if (percentage < 0 || percentage > 100) { UMPIRE_ERROR( runtime_error, - umpire::fmt::format("Invalid percentage {}, percentage must be an integer between 0 and 100", percentage)); + fmt::format("Invalid percentage {}, percentage must be an integer between 0 and 100", percentage)); } if (percentage == 0) { diff --git a/src/umpire/strategy/FixedPool.cpp b/src/umpire/strategy/FixedPool.cpp index 3d0cbfd0d..0a35b4749 100644 --- a/src/umpire/strategy/FixedPool.cpp +++ b/src/umpire/strategy/FixedPool.cpp @@ -144,7 +144,7 @@ void* FixedPool::allocate(std::size_t bytes) } if (!ptr) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("FixedPool::allocate(size={}): Could not allocate.", m_obj_bytes)); + UMPIRE_ERROR(runtime_error, fmt::format("FixedPool::allocate(size={}): Could not allocate.", m_obj_bytes)); } return ptr; } diff --git a/src/umpire/strategy/MonotonicAllocationStrategy.cpp b/src/umpire/strategy/MonotonicAllocationStrategy.cpp index 3ef26cece..58cc570a1 100644 --- a/src/umpire/strategy/MonotonicAllocationStrategy.cpp +++ b/src/umpire/strategy/MonotonicAllocationStrategy.cpp @@ -35,7 +35,7 @@ void* MonotonicAllocationStrategy::allocate(std::size_t bytes) if (m_size > m_capacity) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("MonotonicAllocationStrategy capacity exceeded {} > {}", m_size, m_capacity)); + fmt::format("MonotonicAllocationStrategy capacity exceeded {} > {}", m_size, m_capacity)); } UMPIRE_LOG(Debug, "(bytes=" << bytes << ") returning " << ret); diff --git a/src/umpire/strategy/QuickPool.cpp b/src/umpire/strategy/QuickPool.cpp index ef2f5c83d..3cb1fe6fe 100644 --- a/src/umpire/strategy/QuickPool.cpp +++ b/src/umpire/strategy/QuickPool.cpp @@ -352,7 +352,7 @@ PoolCoalesceHeuristic QuickPool::percent_releasable(int percentage) if (percentage < 0 || percentage > 100) { UMPIRE_ERROR( runtime_error, - umpire::fmt::format("Invalid percentage: {}, percentage must be an integer between 0 and 100", percentage)); + fmt::format("Invalid percentage: {}, percentage must be an integer between 0 and 100", percentage)); } if (percentage == 0) { return [=](const QuickPool& UMPIRE_UNUSED_ARG(pool)) { return 0; }; @@ -375,7 +375,7 @@ PoolCoalesceHeuristic QuickPool::percent_releasable_hwm(int percentag if (percentage < 0 || percentage > 100) { UMPIRE_ERROR( runtime_error, - umpire::fmt::format("Invalid percentage: {}, percentage must be an integer between 0 and 100", percentage)); + fmt::format("Invalid percentage: {}, percentage must be an integer between 0 and 100", percentage)); } if (percentage == 0) { return [=](const QuickPool& UMPIRE_UNUSED_ARG(pool)) { return 0; }; diff --git a/src/umpire/strategy/SlotPool.cpp b/src/umpire/strategy/SlotPool.cpp index 9d0f62498..00c3f54d0 100644 --- a/src/umpire/strategy/SlotPool.cpp +++ b/src/umpire/strategy/SlotPool.cpp @@ -52,7 +52,7 @@ void* SlotPool::allocate(std::size_t bytes) if (int_bytes < 0) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("allocation request of size: {} bytes is too large for this pool", bytes)); + fmt::format("allocation request of size: {} bytes is too large for this pool", bytes)); } for (std::size_t i = 0; i < m_slots; ++i) { diff --git a/src/umpire/strategy/mixins/Inspector.cpp b/src/umpire/strategy/mixins/Inspector.cpp index 61c686129..6601dc2df 100644 --- a/src/umpire/strategy/mixins/Inspector.cpp +++ b/src/umpire/strategy/mixins/Inspector.cpp @@ -49,7 +49,7 @@ Inspector::deregisterAllocation(void* ptr, strategy::AllocationStrategy* s) } else { // Re-register the pointer and throw an error ResourceManager::getInstance().registerAllocation(ptr, {ptr, record.size, record.strategy, record.name}); - UMPIRE_ERROR(runtime_error, umpire::fmt::format("{} was not allocated by {}", ptr, s->getName())); + UMPIRE_ERROR(runtime_error, fmt::format("{} was not allocated by {}", ptr, s->getName())); } return record; diff --git a/src/umpire/util/AllocationMap.cpp b/src/umpire/util/AllocationMap.cpp index 0c32c9c5f..467369f90 100644 --- a/src/umpire/util/AllocationMap.cpp +++ b/src/umpire/util/AllocationMap.cpp @@ -188,7 +188,7 @@ const AllocationRecord* AllocationMap::find(void* ptr) const // use this from a debugger to dump the contents of the AllocationMap printAll(); #endif - UMPIRE_ERROR(unknown_pointer_error, umpire::fmt::format("Allocation not mapped: {}", ptr)); + UMPIRE_ERROR(unknown_pointer_error, fmt::format("Allocation not mapped: {}", ptr)); } } @@ -252,7 +252,7 @@ AllocationRecord AllocationMap::remove(void* ptr) if (iter->second->empty()) m_map.removeLast(); } else { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Cannot remove {}", ptr)); + UMPIRE_ERROR(runtime_error, fmt::format("Cannot remove {}", ptr)); } --m_size; diff --git a/src/umpire/util/CMakeLists.txt b/src/umpire/util/CMakeLists.txt index 551f8188c..7855fd48a 100644 --- a/src/umpire/util/CMakeLists.txt +++ b/src/umpire/util/CMakeLists.txt @@ -51,7 +51,7 @@ if (UMPIRE_ENABLE_NUMA) numa.cpp) endif () -set (umpire_util_depends camp umpire_event umpire_tpl_judy umpire_tpl_fmt) +set (umpire_util_depends camp umpire_event umpire_tpl_judy fmt::fmt-header-only) if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") set (umpire_util_depends diff --git a/src/umpire/util/MPI.cpp b/src/umpire/util/MPI.cpp index 730c7de22..3fadfa750 100644 --- a/src/umpire/util/MPI.cpp +++ b/src/umpire/util/MPI.cpp @@ -70,7 +70,7 @@ void MPI::finalize() int MPI::getRank() { if (!s_initialized) { - UMPIRE_LOG(Warning, umpire::fmt::format("umpire::MPI not initialized, returning rank={}", s_rank)); + UMPIRE_LOG(Warning, fmt::format("umpire::MPI not initialized, returning rank={}", s_rank)); } return s_rank; @@ -79,7 +79,7 @@ int MPI::getRank() int MPI::getSize() { if (!s_initialized) { - UMPIRE_LOG(Warning, umpire::fmt::format("umpire::MPI not initialized, returning size={}", s_world_size)); + UMPIRE_LOG(Warning, fmt::format("umpire::MPI not initialized, returning size={}", s_world_size)); } return s_world_size; diff --git a/src/umpire/util/MemoryMap.inl b/src/umpire/util/MemoryMap.inl index 6f79d47e6..7b49bcb59 100644 --- a/src/umpire/util/MemoryMap.inl +++ b/src/umpire/util/MemoryMap.inl @@ -164,7 +164,7 @@ void MemoryMap::erase(Key ptr) if (m_last) { removeLast(); } else { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Could not remove ptr: {}", ptr)); + UMPIRE_ERROR(runtime_error, fmt::format("Could not remove ptr: {}", ptr)); } } diff --git a/src/umpire/util/error.hpp b/src/umpire/util/error.hpp index ca8e8f07c..335695b4e 100644 --- a/src/umpire/util/error.hpp +++ b/src/umpire/util/error.hpp @@ -10,7 +10,7 @@ #include #include -#include "umpire/fmt/fmt.hpp" +#include "fmt/format.h" #include "umpire/util/Macros.hpp" namespace umpire { diff --git a/src/umpire/util/io.cpp b/src/umpire/util/io.cpp index 806fb9e3b..6badd56bc 100644 --- a/src/umpire/util/io.cpp +++ b/src/umpire/util/io.cpp @@ -87,16 +87,16 @@ void initialize_io(const bool enable_log) if (enable_log) { #ifndef WIN32 if (mkdir(root_io_dir.c_str(), S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("mkdir({}) failed", root_io_dir)); + UMPIRE_ERROR(runtime_error, fmt::format("mkdir({}) failed", root_io_dir)); } #else if (_mkdir(root_io_dir.c_str())) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("mkdir( \"{}\" ) failed", root_io_dir)); + UMPIRE_ERROR(runtime_error, fmt::format("mkdir( \"{}\" ) failed", root_io_dir)); } #endif } } else if (!(S_ISDIR(info.st_mode))) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("{} exists and is not a directory", root_io_dir)); + UMPIRE_ERROR(runtime_error, fmt::format("{} exists and is not a directory", root_io_dir)); } #endif } @@ -114,7 +114,7 @@ void initialize_io(const bool enable_log) if (s_log_ofstream) { s_log_buffer.setFileStream(&s_log_ofstream); } else { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Couldn't open log file: {}", log_filename)); + UMPIRE_ERROR(runtime_error, fmt::format("Couldn't open log file: {}", log_filename)); } } diff --git a/src/umpire/util/numa.cpp b/src/umpire/util/numa.cpp index 615fe4a7d..9f82492c3 100644 --- a/src/umpire/util/numa.cpp +++ b/src/umpire/util/numa.cpp @@ -41,8 +41,8 @@ void move_to_node(void* ptr, std::size_t bytes, int node) if (mbind(ptr, bytes, MPOL_BIND, mask->maskp, mask->size + 1, MPOL_MF_MOVE | MPOL_MF_STRICT) != 0) { UMPIRE_ERROR(runtime_error, - umpire::fmt::format("numa::move_to_node error: mbind( ptr = {}, bytes = {}, node = {} ) failed: {}", - ptr, bytes, node, strerror(errno))); + fmt::format("numa::move_to_node error: mbind( ptr = {}, bytes = {}, node = {} ) failed: {}", + ptr, bytes, node, strerror(errno))); } numa_bitmask_free(mask); @@ -52,8 +52,8 @@ int get_location(void* ptr) { int numa_node = -1; if (get_mempolicy(&numa_node, NULL, 0, ptr, MPOL_F_NODE | MPOL_F_ADDR) != 0) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("numa::get_location error: get_mempolicy( ptr = {} ) failed: {}", - ptr, strerror(errno))); + UMPIRE_ERROR(runtime_error, fmt::format("numa::get_location error: get_mempolicy( ptr = {} ) failed: {}", + ptr, strerror(errno))); } return numa_node; } diff --git a/src/umpire/util/wrap_allocator.hpp b/src/umpire/util/wrap_allocator.hpp index 294e92fa3..37e8686e5 100644 --- a/src/umpire/util/wrap_allocator.hpp +++ b/src/umpire/util/wrap_allocator.hpp @@ -39,8 +39,8 @@ Strategy* unwrap_allocation_strategy(strategy::AllocationStrategy* base_strategy Strategy* strategy{dynamic_cast(base_strategy)}; if (!strategy) { - UMPIRE_ERROR(runtime_error, umpire::fmt::format("Couldn't unwrap allocator \"{}\" to strategy \"{}\"", - base_strategy->getName(), typeid(Strategy).name())); + UMPIRE_ERROR(runtime_error, fmt::format("Couldn't unwrap allocator \"{}\" to strategy \"{}\"", + base_strategy->getName(), typeid(Strategy).name())); } return strategy;