Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Allow using external fmt #834

Merged
merged 42 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
e02137e
Switch to regular fmt library
adayton1 Jul 18, 2023
d53e966
Remove old fmt cruft
adayton1 Jul 18, 2023
38ce7d5
Add fmt as a submodule
adayton1 Jul 18, 2023
14c8886
Quiet CMake warning for fmt
adayton1 Jul 18, 2023
b8977ba
Convert enum to int for formatting
adayton1 Jul 18, 2023
6db05c0
Use fmt::fmt target
adayton1 Jul 18, 2023
25826e5
Set options for fmt submodule build
adayton1 Jul 18, 2023
0692ba8
Specify fmt version required
adayton1 Jul 18, 2023
9e4bf8e
Require compatible fmt_DIR or submodule
adayton1 Jul 18, 2023
6f1ea51
Fix typo
adayton1 Jul 18, 2023
04a7b33
Merge branch 'develop' into feature/dayton8/external_fmt
adayton1 Aug 21, 2023
6aed10d
Add safe directory for fmt
adayton1 Aug 21, 2023
e3322df
Apply style updates
Aug 21, 2023
d3cdf25
merging with develop
kab163 Dec 12, 2023
d2cac40
Add better error messages if fmt is not found
adayton1 Jan 8, 2024
22cd275
testing with radiuss-spack-configs update
kab163 Jan 8, 2024
826721d
Merge branch 'feature/dayton8/external_fmt' of https://github.com/LLN…
kab163 Jan 8, 2024
3e8c586
Fix umpire-config.cmake
adayton1 Jan 8, 2024
ca03d49
pulling in radiuss-spack-config update
kab163 Jan 8, 2024
8a7cd55
Add debugging
adayton1 Jan 8, 2024
4cec5ff
Merge branch 'feature/dayton8/external_fmt' of github.com:LLNL/Umpire…
adayton1 Jan 8, 2024
7a5c07f
More debugging
adayton1 Jan 8, 2024
e2671c0
Make fmt::fmt global
adayton1 Jan 8, 2024
6a7ec08
Remove debugging cruft
adayton1 Jan 9, 2024
492ec72
Update fmt to 10.2.1
adayton1 Jan 9, 2024
aba1829
Treat fmt includes as system includes
adayton1 Jan 9, 2024
16b4bd0
Try latest fmt package
adayton1 Jan 10, 2024
24808b1
Attempt to fix fmt package
adayton1 Jan 10, 2024
2f143af
Make fmt version more flexible
adayton1 Jan 10, 2024
d8b7302
CMake versioning is too limited
adayton1 Jan 10, 2024
dd2deb3
Allow any version of fmt
adayton1 Jan 10, 2024
c2eed8d
Try a patch
adayton1 Jan 10, 2024
efc3189
Remove unused fmt include
adayton1 Jan 11, 2024
80dfc45
Try try again
adayton1 Jan 19, 2024
ca8e833
Rename patch file
adayton1 Jan 19, 2024
912693c
Pull in updated patch
adayton1 Jan 20, 2024
3f8bb49
Restrict patch
adayton1 Jan 22, 2024
0316a3f
Try an alternative fix
adayton1 Jan 22, 2024
07e1b23
Revert change
adayton1 Jan 22, 2024
44df307
Update cce 16 CI job
adayton1 Jan 22, 2024
f9c2572
Fix up gitlab jobs
adayton1 Jan 22, 2024
1677846
Update to latest radiuss-spack-configs
adayton1 Jan 25, 2024
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
1 change: 1 addition & 0 deletions .github/actions/abi-compat/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ git config --global --add safe.directory /github/workspace/blt
git config --global --add safe.directory /github/workspace/scripts/radiuss-spack-configs
git config --global --add safe.directory /github/workspace/scripts/uberenv
git config --global --add safe.directory /github/workspace/src/tpl/umpire/camp
git config --global --add safe.directory /github/workspace/src/tpl/umpire/fmt

git submodule update --init --recursive

Expand Down
2 changes: 2 additions & 0 deletions .github/actions/apply-style/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ git config --global --add safe.directory /github/workspace/blt
git config --global --add safe.directory /github/workspace/scripts/radiuss-spack-configs
git config --global --add safe.directory /github/workspace/scripts/uberenv
git config --global --add safe.directory /github/workspace/src/tpl/umpire/camp
git config --global --add safe.directory /github/workspace/src/tpl/umpire/fmt

git submodule update --init --recursive

mkdir build && cd build
Expand Down
1 change: 1 addition & 0 deletions .github/actions/shroud/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ git config --global --add safe.directory /github/workspace/blt
git config --global --add safe.directory /github/workspace/scripts/radiuss-spack-configs
git config --global --add safe.directory /github/workspace/scripts/uberenv
git config --global --add safe.directory /github/workspace/src/tpl/umpire/camp
git config --global --add safe.directory /github/workspace/src/tpl/umpire/fmt

git submodule update --init --recursive

Expand Down
4 changes: 2 additions & 2 deletions .gitlab/jobs/corona.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
# This job intentionally tests our umpire package.py because although this job does not
# explicitly have the ~tools, the package.py should still disable tools from being built.
###
rocmcc_5_6_0_hip_openmp_device_alloc:
rocmcc_5_6_1_hip_openmp_device_alloc:
variables:
SPEC: "~shared +fortran +openmp +rocm +device_alloc tests=basic amdgpu_target=gfx906 %[email protected].0 ^[email protected].0"
SPEC: "~shared +fortran +openmp +rocm +device_alloc tests=basic amdgpu_target=gfx906 %[email protected].1 ^[email protected].1"
extends: .job_on_corona

8 changes: 4 additions & 4 deletions .gitlab/jobs/tioga.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
# the comparison with the original job is easier.

# We override the cce job because we can’t use +device-alloc with it
cce_16_0_0:
cce_16_0_1:
variables:
SPEC: "~shared +fortran tests=basic %[email protected].0"
SPEC: "~shared +fortran tests=basic %[email protected].1"
extends: .job_on_tioga

############
Expand All @@ -29,8 +29,8 @@ cce_16_0_0:
# This job intentionally tests our umpire package.py because although this job does not
# explicitly have the ~tools, the package.py should still disable tools from being built.
###
rocmcc_5_6_0_hip_openmp_device_alloc:
rocmcc_5_6_1_hip_openmp_device_alloc:
variables:
SPEC: "~shared +fortran +openmp +rocm +device_alloc tests=basic amdgpu_target=gfx90a %[email protected].0 ^[email protected].0"
SPEC: "~shared +fortran +openmp +rocm +device_alloc tests=basic amdgpu_target=gfx90a %[email protected].1 ^[email protected].1"
extends: .job_on_tioga

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@
[submodule "scripts/uberenv"]
path = scripts/uberenv
url = https://github.com/LLNL/uberenv
[submodule "src/tpl/umpire/fmt"]
path = src/tpl/umpire/fmt
url = https://github.com/fmtlib/fmt
2 changes: 1 addition & 1 deletion examples/cookbook/recipe_coalesce_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions examples/cookbook/recipe_move_between_numa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ 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
rm.memset(dst_ptr, 0);

// 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));
}
}

Expand All @@ -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
Expand All @@ -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
Expand Down
79 changes: 16 additions & 63 deletions src/tpl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,75 +131,28 @@ 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
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src/tpl>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)

# 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
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

if (C_COMPILER_FAMILY_IS_XL)
set(_fmt_warning_disable_flag
$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:-Wno-unknown-attributes>
$<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler=-Wno-unknown-attributes>)

target_compile_options(umpire_tpl_fmt INTERFACE ${_fmt_warning_disable_flag})
endif ()
if (NOT TARGET fmt::fmt)
if (DEFINED fmt_DIR)
find_package(fmt REQUIRED
NO_DEFAULT_PATH
PATHS
${fmt_DIR}
${fmt_DIR}/lib64/cmake/fmt)

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
$<$<NOT:$<COMPILE_LANGUAGE:Fortran>>:${_fmt_warning_disable_flag}>)
set_target_properties(fmt::fmt PROPERTIES IMPORTED_GLOBAL TRUE)
blt_convert_to_system_includes(TARGET fmt::fmt)
else ()
target_compile_options(umpire_tpl_fmt
INTERFACE
${_fmt_warning_disable_flag})
if (NOT EXISTS ${PROJECT_SOURCE_DIR}/src/tpl/umpire/fmt/CMakeLists.txt)
message(FATAL_ERROR "fmt submodule not initialized. Run 'git submodule update --init --recursive' in the git repository or set fmt_DIR to use an external build of fmt.")
else ()
set(FMT_INSTALL ON)
set(FMT_SYSTEM_HEADERS ON)
add_subdirectory(umpire/fmt)
endif ()
endif ()
endif ()

install(TARGETS
umpire_tpl_fmt
EXPORT umpire-targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

install(FILES
${fmt_headers}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/umpire/fmt)

set(UMPIRE_ENABLE_TESTS ${OLD_ENABLE_TESTS})
set(UMPIRE_ENABLE_FORTRAN ${OLD_ENABLE_FORTRAN})
1 change: 1 addition & 0 deletions src/tpl/umpire/fmt
Submodule fmt added at e69e5f
27 changes: 0 additions & 27 deletions src/tpl/umpire/fmt/LICENSE.rst

This file was deleted.

7 changes: 0 additions & 7 deletions src/tpl/umpire/fmt/README

This file was deleted.

Loading
Loading