Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
[submodule "src/tpl/umpire/fmt"]
path = src/tpl/umpire/fmt
url = https://github.com/fmtlib/fmt
[submodule "src/tpl/umpire/spdlog"]
path = src/tpl/umpire/spdlog
url = https://github.com/gabime/spdlog.git
1 change: 0 additions & 1 deletion cmake/SetupUmpireOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ option(UMPIRE_ENABLE_NUMA "Build Umpire with NUMA support" Off)
option(UMPIRE_ENABLE_OPENMP_TARGET "Build Umpire with OPENMP target" Off)

option(UMPIRE_ENABLE_LOGGING "Build Umpire with Logging enabled" On)
option(UMPIRE_ENABLE_SLIC "Build Umpire with SLIC logging" Off)
option(UMPIRE_ENABLE_BACKTRACE "Build Umpire with allocation backtrace enabled" Off)
option(UMPIRE_ENABLE_BACKTRACE_SYMBOLS "Build Umpire with symbol support" Off)
option(UMPIRE_ENABLE_PEDANTIC_WARNINGS "Enable pedantic compiler warnings" On)
Expand Down
34 changes: 0 additions & 34 deletions cmake/SetupUmpireThirdParty.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,40 +36,6 @@ if (UMPIRE_ENABLE_UMAP)
DEPENDS_ON -lpthread -lrt)
endif ()

if (ENABLE_SLIC AND ENABLE_LOGGING)
find_library( SLIC_LIBRARY
libslic.a
PATHS ${SLIC_LIBRARY_PATH}
)

if (NOT SLIC_LIBRARY)
message(FATAL_ERROR "Could not find SLIC library, make sure SLIC_LIBRARY_PATH is set properly")
endif()

find_library( SLIC_UTIL_LIBRARY
libaxom_utils.a
PATHS ${SLIC_LIBRARY_PATH}
)

if (NOT SLIC_UTIL_LIBRARY)
message(FATAL_ERROR "Could not find Axom Utility Library for SLIC, make sure SLIC_LIBRARY_PATH is set properly")
endif()

find_path( SLIC_INCLUDE_DIR
slic/slic.hpp
PATHS ${SLIC_INCLUDE_PATH}
)

if (NOT SLIC_INCLUDE_DIR)
message(FATAL_ERROR "Could not find SLIC include directory, make sure SLIC_INCLUDE_PATH is set properly")
endif()

blt_register_library( NAME slic
INCLUDES ${SLIC_INCLUDE_DIR}
LIBRARIES ${SLIC_LIBRARY} ${SLIC_UTIL_LIBRARY}
)
endif ()

if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
blt_register_library( NAME backtrace_symbols
LIBRARIES ${CMAKE_DL_LIBS}
Expand Down
54 changes: 54 additions & 0 deletions src/tpl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,64 @@ if (NOT TARGET ${UMPIRE_FMT_TARGET})
set(UMPIRE_CONFIG_fmt_DIR ${CMAKE_INSTALL_PREFIX} CACHE PATH "")
set(FMT_INSTALL ON)
set(FMT_SYSTEM_HEADERS ON)
# Force header-only mode to avoid linking issues on Windows with static libraries
set(FMT_HEADER_ONLY ON CACHE BOOL "Use header-only fmt")
add_subdirectory(umpire/fmt)
endif ()
endif ()
endif ()

##############################################################################
# spdlog
##############################################################################
if (NOT TARGET spdlog::spdlog)
# Try to find external spdlog installation
if (DEFINED spdlog_DIR)
find_package(spdlog REQUIRED
NO_DEFAULT_PATH
PATHS
${spdlog_DIR}
${spdlog_DIR}/lib/cmake/spdlog)

set_target_properties(spdlog::spdlog PROPERTIES IMPORTED_GLOBAL TRUE)
blt_convert_to_system_includes(TARGET spdlog::spdlog)
set(UMPIRE_CONFIG_spdlog_DIR ${spdlog_DIR} CACHE PATH "")
else ()
if (NOT EXISTS ${PROJECT_SOURCE_DIR}/src/tpl/umpire/spdlog/CMakeLists.txt)
message(FATAL_ERROR "spdlog submodule not initialized. Run 'git submodule update --init --recursive' in the git repository or set spdlog_DIR to use an external build of spdlog.")
else ()
# Configure spdlog to use external fmt (if available)
if (TARGET ${UMPIRE_FMT_TARGET})
set(SPDLOG_FMT_EXTERNAL ON CACHE BOOL "Use external fmt library")

# Help spdlog find the fmt package by setting fmt_DIR
# This works whether fmt is external or from our submodule
if (DEFINED fmt_DIR)
# External fmt case - use the user-provided path
# User must set SPDLOG_FMT_EXTERNAL_HO themselves if their fmt is header-only
set(fmt_DIR ${fmt_DIR} CACHE PATH "Path to fmt")
else ()
# Submodule fmt case - point to build directory where fmt exports its config
# We built fmt as header-only, so tell spdlog
set(SPDLOG_FMT_EXTERNAL_HO ON CACHE BOOL "Use external fmt header-only library")
set(fmt_DIR ${CMAKE_BINARY_DIR}/src/tpl/umpire/fmt CACHE PATH "Path to fmt")
endif ()
else ()
# No fmt available, let spdlog use its bundled fmt
set(SPDLOG_FMT_EXTERNAL OFF CACHE BOOL "Use external fmt library")
endif ()

# Disable unnecessary spdlog features
set(SPDLOG_INSTALL ON CACHE BOOL "Generate install target")
set(SPDLOG_BUILD_SHARED OFF CACHE BOOL "Build shared library")

# In this case, spdlog will be installed inside of Umpire install prefix
set(UMPIRE_CONFIG_spdlog_DIR ${CMAKE_INSTALL_PREFIX} CACHE PATH "")

add_subdirectory(umpire/spdlog)
endif ()
endif ()
endif ()

set(UMPIRE_ENABLE_TESTS ${OLD_ENABLE_TESTS})
set(UMPIRE_ENABLE_FORTRAN ${OLD_ENABLE_FORTRAN})
1 change: 1 addition & 0 deletions src/tpl/umpire/spdlog
Submodule spdlog added at fb1227
7 changes: 3 additions & 4 deletions src/umpire/ResourceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,7 @@ ResourceManager::ResourceManager()
{
UMPIRE_LOG(Debug, "() entering");

const char* env_enable_log{std::getenv("UMPIRE_LOG_LEVEL")};
const bool enable_log{env_enable_log != nullptr};

util::initialize_io(enable_log);
util::Logger::initialize();

initialize();

Expand All @@ -89,6 +86,8 @@ ResourceManager::~ResourceManager()

allocator.reset();
}

util::Logger::finalize();
}

void ResourceManager::initialize()
Expand Down
10 changes: 1 addition & 9 deletions src/umpire/util/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ set (umpire_util_headers
MemoryResourceTraits.hpp
MemoryMap.hpp
MemoryMap.inl
OutputBuffer.hpp
Platform.hpp
allocation_statistics.hpp
detect_vendor.hpp
Expand All @@ -43,7 +42,6 @@ set (umpire_util_sources
io.cpp
Logger.cpp
MPI.cpp
OutputBuffer.cpp
allocation_statistics.cpp
detect_vendor.cpp)

Expand All @@ -53,7 +51,7 @@ if (UMPIRE_ENABLE_NUMA)
numa.cpp)
endif ()

set (umpire_util_depends camp umpire_event umpire_tpl_judy ${UMPIRE_FMT_TARGET})
set (umpire_util_depends camp umpire_event umpire_tpl_judy ${UMPIRE_FMT_TARGET} spdlog::spdlog)

if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set (umpire_util_depends
Expand All @@ -67,12 +65,6 @@ if (UMPIRE_ENABLE_NUMA)
numa)
endif ()

if (UMPIRE_ENABLE_SLIC AND UMPIRE_ENABLE_LOGGING)
set (umpire_util_depends
${umpire_util_depends}
slic)
endif()

if (UMPIRE_ENABLE_MPI)
set (umpire_util_depends
${umpire_util_depends}
Expand Down
Loading
Loading