diff --git a/ci/azure/azure-clang-10-ubuntu-mpich.yml b/ci/azure/azure-clang-10-ubuntu-mpich.yml index 02547331cf..7f2e25e8e9 100644 --- a/ci/azure/azure-clang-10-ubuntu-mpich.yml +++ b/ci/azure/azure-clang-10-ubuntu-mpich.yml @@ -44,6 +44,7 @@ variables: VT_POOL: 1 VT_EXTENDED_TESTS: 1 VT_TESTS_NUM_NODES: 4 + VT_EXTERNAL_FMT: 0 VT_UNITY_BUILD: 1 VT_PRODUCTION_BUILD: 0 VT_FCONTEXT: 0 diff --git a/ci/azure/azure-clang-11-ubuntu-mpich.yml b/ci/azure/azure-clang-11-ubuntu-mpich.yml index e90e10a42f..608d7d51f6 100644 --- a/ci/azure/azure-clang-11-ubuntu-mpich.yml +++ b/ci/azure/azure-clang-11-ubuntu-mpich.yml @@ -44,6 +44,7 @@ variables: VT_POOL: 1 VT_EXTENDED_TESTS: 1 VT_TESTS_NUM_NODES: 2 + VT_EXTERNAL_FMT: 0 VT_UNITY_BUILD: 1 VT_PRODUCTION_BUILD: 0 VT_FCONTEXT: 1 diff --git a/ci/azure/azure-clang-12-ubuntu-mpich.yml b/ci/azure/azure-clang-12-ubuntu-mpich.yml index d55c882e27..de09ff6a9d 100644 --- a/ci/azure/azure-clang-12-ubuntu-mpich.yml +++ b/ci/azure/azure-clang-12-ubuntu-mpich.yml @@ -44,6 +44,7 @@ variables: VT_POOL: 1 VT_EXTENDED_TESTS: 1 VT_TESTS_NUM_NODES: 2 + VT_EXTERNAL_FMT: 0 VT_UNITY_BUILD: 1 VT_PRODUCTION_BUILD: 0 VT_FCONTEXT: 0 diff --git a/ci/azure/azure-clang-13-ubuntu-mpich.yml b/ci/azure/azure-clang-13-ubuntu-mpich.yml index 866b7ee5b7..96b2ddb51a 100644 --- a/ci/azure/azure-clang-13-ubuntu-mpich.yml +++ b/ci/azure/azure-clang-13-ubuntu-mpich.yml @@ -44,6 +44,7 @@ variables: VT_POOL: 1 VT_EXTENDED_TESTS: 1 VT_TESTS_NUM_NODES: 2 + VT_EXTERNAL_FMT: 0 VT_UNITY_BUILD: 1 VT_PRODUCTION_BUILD: 0 VT_FCONTEXT: 0 diff --git a/ci/azure/azure-clang-14-ubuntu-mpich.yml b/ci/azure/azure-clang-14-ubuntu-mpich.yml index e7e6c983d4..013d691431 100644 --- a/ci/azure/azure-clang-14-ubuntu-mpich.yml +++ b/ci/azure/azure-clang-14-ubuntu-mpich.yml @@ -44,6 +44,7 @@ variables: VT_POOL: 1 VT_EXTENDED_TESTS: 1 VT_TESTS_NUM_NODES: 2 + VT_EXTERNAL_FMT: 0 VT_UNITY_BUILD: 1 VT_PRODUCTION_BUILD: 0 VT_FCONTEXT: 0 diff --git a/ci/azure/azure-clang-9-ubuntu-mpich.yml b/ci/azure/azure-clang-9-ubuntu-mpich.yml index cbaf5c4cf8..3de89b380b 100644 --- a/ci/azure/azure-clang-9-ubuntu-mpich.yml +++ b/ci/azure/azure-clang-9-ubuntu-mpich.yml @@ -44,6 +44,7 @@ variables: VT_POOL: 1 VT_EXTENDED_TESTS: 1 VT_TESTS_NUM_NODES: 2 + VT_EXTERNAL_FMT: 0 VT_UNITY_BUILD: 1 VT_PRODUCTION_BUILD: 0 VT_FCONTEXT: 0 diff --git a/ci/azure/azure-clang-alpine-mpich.yml b/ci/azure/azure-clang-alpine-mpich.yml index 6319e67306..31e493fcab 100644 --- a/ci/azure/azure-clang-alpine-mpich.yml +++ b/ci/azure/azure-clang-alpine-mpich.yml @@ -44,6 +44,7 @@ variables: VT_POOL: 1 VT_EXTENDED_TESTS: 1 VT_TESTS_NUM_NODES: 2 + VT_EXTERNAL_FMT: 0 VT_UNITY_BUILD: 1 VT_PRODUCTION_BUILD: 1 VT_FCONTEXT: 0 diff --git a/ci/azure/azure-gcc-10-ubuntu-openmpi.yml b/ci/azure/azure-gcc-10-ubuntu-openmpi.yml index b9c0f8f350..8c5ccabeed 100644 --- a/ci/azure/azure-gcc-10-ubuntu-openmpi.yml +++ b/ci/azure/azure-gcc-10-ubuntu-openmpi.yml @@ -44,6 +44,7 @@ variables: VT_POOL: 1 VT_EXTENDED_TESTS: 1 VT_TESTS_NUM_NODES: 4 + VT_EXTERNAL_FMT: 0 VT_UNITY_BUILD: 1 VT_PRODUCTION_BUILD: 0 VT_FCONTEXT: 0 diff --git a/ci/azure/azure-gcc-11-ubuntu-mpich.yml b/ci/azure/azure-gcc-11-ubuntu-mpich.yml index f8e86e08ac..c0b8f85dea 100644 --- a/ci/azure/azure-gcc-11-ubuntu-mpich.yml +++ b/ci/azure/azure-gcc-11-ubuntu-mpich.yml @@ -44,6 +44,7 @@ variables: VT_POOL: 1 VT_EXTENDED_TESTS: 1 VT_TESTS_NUM_NODES: 2 + VT_EXTERNAL_FMT: 0 VT_UNITY_BUILD: 0 VT_PRODUCTION_BUILD: 0 VT_FCONTEXT: 0 diff --git a/ci/azure/azure-gcc-12-ubuntu-mpich.yml b/ci/azure/azure-gcc-12-ubuntu-mpich.yml index 330ab04925..1378cd6736 100644 --- a/ci/azure/azure-gcc-12-ubuntu-mpich.yml +++ b/ci/azure/azure-gcc-12-ubuntu-mpich.yml @@ -44,6 +44,7 @@ variables: VT_POOL: 1 VT_EXTENDED_TESTS: 1 VT_TESTS_NUM_NODES: 2 + VT_EXTERNAL_FMT: 0 VT_UNITY_BUILD: 1 VT_PRODUCTION_BUILD: 0 VT_FCONTEXT: 0 diff --git a/ci/azure/azure-gcc-8-ubuntu-mpich.yml b/ci/azure/azure-gcc-8-ubuntu-mpich.yml index 4cc5bb1b83..35dbd7a3c6 100644 --- a/ci/azure/azure-gcc-8-ubuntu-mpich.yml +++ b/ci/azure/azure-gcc-8-ubuntu-mpich.yml @@ -44,6 +44,7 @@ variables: VT_POOL: 0 VT_EXTENDED_TESTS: 1 VT_TESTS_NUM_NODES: 2 + VT_EXTERNAL_FMT: 0 VT_UNITY_BUILD: 0 VT_PRODUCTION_BUILD: 0 VT_FCONTEXT: 0 diff --git a/ci/azure/azure-gcc-9-ubuntu-mpich.yml b/ci/azure/azure-gcc-9-ubuntu-mpich.yml index d954595cc7..9dc61ee609 100644 --- a/ci/azure/azure-gcc-9-ubuntu-mpich.yml +++ b/ci/azure/azure-gcc-9-ubuntu-mpich.yml @@ -44,6 +44,7 @@ variables: VT_POOL: 1 VT_EXTENDED_TESTS: 1 VT_TESTS_NUM_NODES: 2 + VT_EXTERNAL_FMT: 0 VT_UNITY_BUILD: 1 VT_PRODUCTION_BUILD: 0 VT_FCONTEXT: 0 diff --git a/ci/azure/azure-intel-oneapi-icpc-ubuntu-mpich.yml b/ci/azure/azure-intel-oneapi-icpc-ubuntu-mpich.yml index d71c493346..462f5c231f 100644 --- a/ci/azure/azure-intel-oneapi-icpc-ubuntu-mpich.yml +++ b/ci/azure/azure-intel-oneapi-icpc-ubuntu-mpich.yml @@ -44,6 +44,7 @@ variables: VT_POOL: 1 VT_EXTENDED_TESTS: 0 VT_TESTS_NUM_NODES: 2 + VT_EXTERNAL_FMT: 0 VT_UNITY_BUILD: 1 VT_PRODUCTION_BUILD: 0 VT_FCONTEXT: 0 diff --git a/ci/azure/azure-intel-oneapi-icpx-ubuntu-mpich.yml b/ci/azure/azure-intel-oneapi-icpx-ubuntu-mpich.yml index 225c5260b9..51d2302d3b 100644 --- a/ci/azure/azure-intel-oneapi-icpx-ubuntu-mpich.yml +++ b/ci/azure/azure-intel-oneapi-icpx-ubuntu-mpich.yml @@ -44,6 +44,7 @@ variables: VT_POOL: 0 VT_EXTENDED_TESTS: 0 VT_TESTS_NUM_NODES: 2 + VT_EXTERNAL_FMT: 0 VT_UNITY_BUILD: 1 VT_PRODUCTION_BUILD: 0 VT_FCONTEXT: 0 diff --git a/ci/azure/azure-nvidia-11-2-ubuntu-mpich.yml b/ci/azure/azure-nvidia-11-2-ubuntu-mpich.yml index 8d2d9ae717..94c291d989 100644 --- a/ci/azure/azure-nvidia-11-2-ubuntu-mpich.yml +++ b/ci/azure/azure-nvidia-11-2-ubuntu-mpich.yml @@ -44,6 +44,7 @@ variables: VT_POOL: 0 VT_EXTENDED_TESTS: 0 VT_TESTS_NUM_NODES: 4 + VT_EXTERNAL_FMT: 1 VT_UNITY_BUILD: 1 VT_PRODUCTION_BUILD: 0 VT_FCONTEXT: 0 diff --git a/ci/azure/azure-nvidia-12-ubuntu-mpich.yml b/ci/azure/azure-nvidia-12-ubuntu-mpich.yml index 7dce80b3c8..5210d57f14 100644 --- a/ci/azure/azure-nvidia-12-ubuntu-mpich.yml +++ b/ci/azure/azure-nvidia-12-ubuntu-mpich.yml @@ -44,6 +44,7 @@ variables: VT_POOL: 0 VT_EXTENDED_TESTS: 0 VT_TESTS_NUM_NODES: 4 + VT_EXTERNAL_FMT: 0 VT_UNITY_BUILD: 1 VT_PRODUCTION_BUILD: 0 VT_FCONTEXT: 0 diff --git a/ci/build_cpp.sh b/ci/build_cpp.sh index 3ea13e9ced..db4ef0469a 100755 --- a/ci/build_cpp.sh +++ b/ci/build_cpp.sh @@ -126,6 +126,7 @@ cmake -G "${CMAKE_GENERATOR:-Ninja}" \ -Dvt_ci_build="${VT_CI_BUILD:-0}" \ -Dvt_debug_verbose="${VT_DEBUG_VERBOSE:-0}" \ -Dvt_tests_num_nodes="${VT_TESTS_NUM_NODES:-}" \ + -Dvt_external_fmt="${VT_EXTERNAL_FMT:-0}" \ -Dvt_no_color_enabled="${VT_NO_COLOR_ENABLED:-0}" \ -DCMAKE_CXX_STANDARD="${CMAKE_CXX_STANDARD:-17}" \ -DBUILD_SHARED_LIBS="${BUILD_SHARED_LIBS:-0}" \ diff --git a/ci/build_vt_sample.sh b/ci/build_vt_sample.sh index b3f6d54f76..2dadc08013 100755 --- a/ci/build_vt_sample.sh +++ b/ci/build_vt_sample.sh @@ -50,6 +50,7 @@ then -Dvt_trace_only="1" \ -Dvt_build_examples="0" \ -Dvt_build_tests="0" \ + -Dvt_external_fmt="${VT_EXTERNAL_FMT:-0}" \ -DCMAKE_CXX_STANDARD="${CMAKE_CXX_STANDARD:-17}" \ -DCMAKE_EXPORT_COMPILE_COMMANDS=1 \ -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-Release}" \ diff --git a/ci/deps/fmt.sh b/ci/deps/fmt.sh new file mode 100644 index 0000000000..36f46d5a5a --- /dev/null +++ b/ci/deps/fmt.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -exo pipefail + +if test $# -lt 1 +then + echo "usage: ./$0 " + exit 1 +fi + +fmt_version=$1 + +base_dir=$(pwd) + +git clone https://github.com/fmtlib/fmt.git +cd fmt +git checkout ${fmt_version} +mkdir build && cd build +cmake .. -D FMT_TEST=OFF +make ${make_flags} +make install +cd ${base_dir} +rm -rf fmt diff --git a/ci/docker/ubuntu-nvidia-cpp.dockerfile b/ci/docker/ubuntu-nvidia-cpp.dockerfile index c6bd3df982..b916ab94c6 100644 --- a/ci/docker/ubuntu-nvidia-cpp.dockerfile +++ b/ci/docker/ubuntu-nvidia-cpp.dockerfile @@ -51,6 +51,14 @@ ENV LESSCHARSET=utf-8 COPY ./ci/deps/mpich.sh mpich.sh RUN ./mpich.sh 3.3.2 -j4 +ARG external_fmt +COPY ./ci/deps/fmt.sh fmt.sh + +RUN if test ${external_fmt} -eq 1; then \ + chmod +x ./fmt.sh && \ + ./fmt.sh 7.1.3 -j4; \ + fi + RUN mkdir -p /nvcc_wrapper/build && \ wget https://raw.githubusercontent.com/kokkos/kokkos/master/bin/nvcc_wrapper -P /nvcc_wrapper/build && \ chmod +x /nvcc_wrapper/build/nvcc_wrapper diff --git a/cmake/configure_options.cmake b/cmake/configure_options.cmake index 5340d5aacf..edf15845bf 100644 --- a/cmake/configure_options.cmake +++ b/cmake/configure_options.cmake @@ -151,6 +151,15 @@ define_option(vt_build_tests "tests" "Build VT tests" ON empty_feature) define_option(vt_build_tools "tools" "Build VT tools" ON empty_feature) define_option(vt_build_examples "examples" "Build VT examples" ON empty_feature) +option(vt_external_fmt "Build VT with external fmt" OFF) +if(${vt_external_fmt}) + message(STATUS "Building vt with external fmt library") + set(vt_feature_cmake_external_fmt "1") +else() + message(STATUS "Building vt with included fmt library") + set(vt_feature_cmake_external_fmt "0") +endif() + list(POP_BACK CMAKE_MESSAGE_INDENT) ########################################################################################################## diff --git a/cmake/link_vt.cmake b/cmake/link_vt.cmake index b85f79dff0..8b6303404b 100644 --- a/cmake/link_vt.cmake +++ b/cmake/link_vt.cmake @@ -170,9 +170,17 @@ function(link_target_with_vt) if (${ARG_DEBUG_LINK}) message(STATUS "link_target_with_vt: fmt=${ARG_LINK_FMT}") endif() - target_link_libraries( - ${ARG_TARGET} PUBLIC ${ARG_BUILD_TYPE} ${FMT_LIBRARY} - ) + + if(${vt_external_fmt}) + target_link_libraries( + ${ARG_TARGET} PUBLIC ${ARG_BUILD_TYPE} fmt::fmt + ) + else() + target_link_libraries( + ${ARG_TARGET} PUBLIC ${ARG_BUILD_TYPE} ${FMT_LIBRARY} + ) + endif() + endif() if (NOT DEFINED ARG_LINK_ENG_FORMAT AND ${ARG_DEFAULT_LINK_SET} OR ARG_LINK_ENG_FORMAT) diff --git a/cmake/load_bundled_libraries.cmake b/cmake/load_bundled_libraries.cmake index c2773a24ad..65d1b1b8e0 100644 --- a/cmake/load_bundled_libraries.cmake +++ b/cmake/load_bundled_libraries.cmake @@ -20,10 +20,24 @@ endif() # CLI11 always included in the build add_subdirectory(${PROJECT_LIB_DIR}/CLI) -# fmt always included in the build -set(FMT_LIBRARY fmt) -add_subdirectory(${PROJECT_LIB_DIR}/fmt) -set_darma_compiler_flags(${FMT_LIBRARY}) +# use included fmt or external one +if(${vt_external_fmt}) + # user should provide 'fmt_DIR' or 'fmt_ROOT' to CMake (unless fmt is installed in system libs) + if(fmt_ROOT) + message(STATUS "vt_external_fmt = ON. Using fmt located at ${fmt_ROOT}") + elseif(fmt_DIR) + message(STATUS "vt_external_fmt = ON. Using fmt located at ${fmt_DIR}") + else() + message(STATUS "vt_external_fmt = ON but neither fmt_DIR nor fmt_ROOT is provided!") + endif() + find_package(fmt 7.1.0 REQUIRED) + +else() + set(FMT_LIBRARY fmt) + add_subdirectory(${PROJECT_LIB_DIR}/fmt) + set_darma_compiler_flags(${FMT_LIBRARY}) +endif() + # EngFormat-Cpp always included in the build set(ENG_FORMAT_LIBRARY EngFormat-Cpp) diff --git a/cmake/vtConfig.cmake.in b/cmake/vtConfig.cmake.in index 97a179750d..599eafdb8b 100644 --- a/cmake/vtConfig.cmake.in +++ b/cmake/vtConfig.cmake.in @@ -26,4 +26,9 @@ endif() set (VT_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include") set (VT_CXX_COMPILER "@CMAKE_CXX_COMPILER@") +if (@vt_external_fmt@) + set (fmt_DIR @fmt_DIR@) + find_dependency(fmt REQUIRED HINTS @fmt_DIR@) +endif() + set(VT_HAS_FMT "TRUE") diff --git a/cmake_config.h.in b/cmake_config.h.in index fe189b7565..c10bea5e62 100644 --- a/cmake_config.h.in +++ b/cmake_config.h.in @@ -65,7 +65,7 @@ #define vt_feature_cmake_production_build @vt_feature_cmake_production_build@ #define vt_feature_cmake_debug_verbose @vt_feature_cmake_debug_verbose@ #define vt_feature_cmake_rdma_tests @vt_feature_cmake_rdma_tests@ - +#define vt_feature_cmake_external_fmt @vt_feature_cmake_external_fmt@ #define vt_detected_max_num_nodes @cmake_detected_max_num_nodes@ @@ -91,3 +91,19 @@ #cmakedefine vt_has_sysconf #cmakedefine vt_has_libunwind_h #cmakedefine vt_has_execinfo_h + +#if vt_feature_cmake_external_fmt + #define INCLUDE_FMT_CORE + #define INCLUDE_FMT_FORMAT + #define INCLUDE_FMT_OSTREAM + + #define VT_FMT_NAMESPACE_BEGIN namespace fmt { + #define VT_FMT_NAMESPACE_END } +#else + #define INCLUDE_FMT_CORE + #define INCLUDE_FMT_FORMAT + #define INCLUDE_FMT_OSTREAM + + #define VT_FMT_NAMESPACE_BEGIN namespace fmt { inline namespace vt { + #define VT_FMT_NAMESPACE_END } } +#endif diff --git a/docker-compose.yml b/docker-compose.yml index d223db0b2f..2ee3246e89 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -112,6 +112,7 @@ x-vtopts: &vtopts VT_CI_BUILD: ${VT_CI_BUILD:-0} VT_DEBUG_VERBOSE: ${VT_DEBUG_VERBOSE:-0} VT_TESTS_NUM_NODES: ${VT_TESTS_NUM_NODES:-} + VT_EXTERNAL_FMT: ${VT_EXTERNAL_FMT:-0} VT_NO_COLOR_ENABLED: ${VT_NO_COLOR:-0} BUILD_SHARED_LIBS: ${VT_BUILD_SHARED_LIBS:-0} VT_INCLUSION_TYPE: ${VT_INCLUSION:-TPL} @@ -138,6 +139,7 @@ services: ubuntu: ${UBUNTU} ubsan_enabled: ${VT_UBSAN:-0} zoltan_enabled: ${VT_ZOLTAN:-0} + external_fmt: ${VT_EXTERNAL_FMT:-0} cache_from: - ${REPO}:${ARCH}-ubuntu-${UBUNTU}-${HOST_COMPILER}-${COMPILER}-cpp ulimits: &ulimits diff --git a/scripts/workflow-azure-template.yml b/scripts/workflow-azure-template.yml index a43cb56658..3fc0793835 100644 --- a/scripts/workflow-azure-template.yml +++ b/scripts/workflow-azure-template.yml @@ -32,6 +32,7 @@ variables: VT_POOL: [% vt_pool %] VT_EXTENDED_TESTS: [% vt_extended_tests %] VT_TESTS_NUM_NODES: [% vt_tests_num_nodes %] + VT_EXTERNAL_FMT: [% vt_external_fmt %] VT_UNITY_BUILD: [% vt_unity_build %] VT_PRODUCTION_BUILD: [% vt_production_build %] VT_FCONTEXT: [% vt_fcontext %] diff --git a/scripts/workflows-azure.ini b/scripts/workflows-azure.ini index 5543f6116c..819e8e04f2 100644 --- a/scripts/workflows-azure.ini +++ b/scripts/workflows-azure.ini @@ -17,6 +17,7 @@ vt_fcontext = 0 vt_zoltan = 0 vt_ci_build = 1 vt_tests_num_nodes = 2 +vt_external_fmt = 0 test_lb_schema = 0 ulimit_core = 0 vt_code_coverage = 0 @@ -93,6 +94,7 @@ vt_diagnostics = 0 vt_trace = 1 vt_pool = 0 vt_tests_num_nodes = 4 +vt_external_fmt = 1 [PR-tests-gcc-8] test_configuration = "gcc-8, ubuntu, mpich, address sanitizer" diff --git a/src/vt/collective/reduce/reduce_manager.h b/src/vt/collective/reduce/reduce_manager.h index 4f0393af99..cbaf554eda 100644 --- a/src/vt/collective/reduce/reduce_manager.h +++ b/src/vt/collective/reduce/reduce_manager.h @@ -47,6 +47,7 @@ #include "vt/collective/reduce/reduce_scope.h" #include "vt/collective/tree/tree.h" +#include namespace vt { namespace collective { namespace reduce { struct Reduce; diff --git a/src/vt/configs/debug/debug_fmt.h b/src/vt/configs/debug/debug_fmt.h index 3d814e7307..8f68cee6a5 100644 --- a/src/vt/configs/debug/debug_fmt.h +++ b/src/vt/configs/debug/debug_fmt.h @@ -46,7 +46,7 @@ #include "vt/config.h" -#include +#include INCLUDE_FMT_CORE #include diff --git a/src/vt/configs/debug/debug_print.h b/src/vt/configs/debug/debug_print.h index 2fd664a351..32b5c3b151 100644 --- a/src/vt/configs/debug/debug_print.h +++ b/src/vt/configs/debug/debug_print.h @@ -49,7 +49,7 @@ #include "vt/configs/debug/debug_colorize.h" #include "vt/configs/debug/debug_var_unused.h" -#include +#include INCLUDE_FMT_CORE /* === Debug file/line/func functionality === diff --git a/src/vt/configs/error/assert_out.impl.h b/src/vt/configs/error/assert_out.impl.h index 9af0575a98..49bc8e5d85 100644 --- a/src/vt/configs/error/assert_out.impl.h +++ b/src/vt/configs/error/assert_out.impl.h @@ -56,7 +56,7 @@ #include #include -#include +#include INCLUDE_FMT_CORE namespace vt { namespace debug { namespace assert { diff --git a/src/vt/configs/error/assert_out_info.impl.h b/src/vt/configs/error/assert_out_info.impl.h index f3bf3d7224..5ab4713321 100644 --- a/src/vt/configs/error/assert_out_info.impl.h +++ b/src/vt/configs/error/assert_out_info.impl.h @@ -57,7 +57,7 @@ #include #include -#include +#include INCLUDE_FMT_CORE namespace vt { namespace debug { namespace assert { diff --git a/src/vt/configs/error/error.impl.h b/src/vt/configs/error/error.impl.h index aced37c291..ea4f177442 100644 --- a/src/vt/configs/error/error.impl.h +++ b/src/vt/configs/error/error.impl.h @@ -55,7 +55,7 @@ #include #include -#include +#include INCLUDE_FMT_CORE namespace vt { namespace error { diff --git a/src/vt/configs/error/keyval_printer.impl.h b/src/vt/configs/error/keyval_printer.impl.h index 05d7555af2..d81ab1a118 100644 --- a/src/vt/configs/error/keyval_printer.impl.h +++ b/src/vt/configs/error/keyval_printer.impl.h @@ -53,7 +53,7 @@ #include #include -#include +#include INCLUDE_FMT_CORE namespace vt { namespace util { namespace error { diff --git a/src/vt/configs/error/pretty_print_message.cc b/src/vt/configs/error/pretty_print_message.cc index c909893694..b288cf7c7a 100644 --- a/src/vt/configs/error/pretty_print_message.cc +++ b/src/vt/configs/error/pretty_print_message.cc @@ -50,7 +50,7 @@ #include #include // gethostname -#include +#include INCLUDE_FMT_CORE namespace vt { namespace debug { diff --git a/src/vt/configs/error/soft_error.h b/src/vt/configs/error/soft_error.h index aab9c43518..9876f797a0 100644 --- a/src/vt/configs/error/soft_error.h +++ b/src/vt/configs/error/soft_error.h @@ -59,7 +59,7 @@ #include -#include +#include INCLUDE_FMT_CORE namespace vt { diff --git a/src/vt/configs/features/features_defines.h b/src/vt/configs/features/features_defines.h index 73b2cf4b9d..d1455cc10d 100644 --- a/src/vt/configs/features/features_defines.h +++ b/src/vt/configs/features/features_defines.h @@ -72,6 +72,7 @@ #define vt_feature_libfort 0 || vt_feature_cmake_libfort #define vt_feature_production_build 0 || vt_feature_cmake_production_build #define vt_feature_debug_verbose 0 || vt_feature_cmake_debug_verbose +#define vt_feature_fmt_external 0 || vt_feature_cmake_external_fmt #define vt_check_enabled(test_option) (vt_feature_ ## test_option != 0) diff --git a/src/vt/elm/elm_id.h b/src/vt/elm/elm_id.h index b4be4682a0..d4baf3446a 100644 --- a/src/vt/elm/elm_id.h +++ b/src/vt/elm/elm_id.h @@ -94,9 +94,10 @@ struct hash { } /* end namespace std */ -#include +#include "vt/cmake_config.h" +#include INCLUDE_FMT_FORMAT -namespace fmt { +VT_FMT_NAMESPACE_BEGIN /// Custom fmt formatter/print for \c vt::elm::ElementIDStruct template <> @@ -127,7 +128,7 @@ struct formatter<::vt::elm::ElementIDStruct> { /// Formats the epoch using the parsed format specification (presentation) /// stored in this formatter. template - auto format(::vt::elm::ElementIDStruct const& e, FormatContext& ctx) { + auto format(::vt::elm::ElementIDStruct const& e, FormatContext& ctx) const { std::string id_format = presentation == 'b' ? "{:b}" : (presentation == 'd' ? "{:d}" : "{:x}"); auto fmt_str = "(" + id_format + ",{},{},{})"; @@ -137,6 +138,6 @@ struct formatter<::vt::elm::ElementIDStruct> { } }; -} /* end namespace fmt */ +VT_FMT_NAMESPACE_END #endif /*INCLUDED_VT_ELM_ELM_ID_H*/ diff --git a/src/vt/epoch/epoch_manip.cc b/src/vt/epoch/epoch_manip.cc index 779286c6f1..93a9c56cb1 100644 --- a/src/vt/epoch/epoch_manip.cc +++ b/src/vt/epoch/epoch_manip.cc @@ -49,7 +49,7 @@ #include "vt/utils/bits/bits_packer.h" #include "vt/termination/term_common.h" -#include +#include INCLUDE_FMT_OSTREAM namespace vt { namespace epoch { diff --git a/src/vt/epoch/epoch_type.h b/src/vt/epoch/epoch_type.h index c4bf73e8e6..07704f4ac6 100644 --- a/src/vt/epoch/epoch_type.h +++ b/src/vt/epoch/epoch_type.h @@ -108,9 +108,10 @@ struct hash { } /* end namespace std */ -#include +#include "vt/cmake_config.h" +#include INCLUDE_FMT_FORMAT -namespace fmt { +VT_FMT_NAMESPACE_BEGIN /// Custom fmt formatter/print for \c EpochType template <> @@ -141,7 +142,7 @@ struct formatter<::vt::epoch::EpochType> { /// Formats the epoch using the parsed format specification (presentation) /// stored in this formatter. template - auto format(::vt::epoch::EpochType const& e, FormatContext& ctx) { + auto format(::vt::epoch::EpochType const& e, FormatContext& ctx) const { return format_to( ctx.out(), presentation == 'b' ? "{:b}" : (presentation == 'd' ? "{:d}" : "{:x}"), @@ -150,7 +151,7 @@ struct formatter<::vt::epoch::EpochType> { } }; -} /* end namespace fmt */ +VT_FMT_NAMESPACE_END namespace vt { diff --git a/src/vt/epoch/epoch_window.cc b/src/vt/epoch/epoch_window.cc index a37533564a..b008be363a 100644 --- a/src/vt/epoch/epoch_window.cc +++ b/src/vt/epoch/epoch_window.cc @@ -44,7 +44,7 @@ #include "vt/epoch/epoch_window.h" #include "vt/epoch/epoch_manip.h" -#include +#include INCLUDE_FMT_OSTREAM namespace vt { namespace epoch { diff --git a/src/vt/handler/handler.cc b/src/vt/handler/handler.cc index 807e8b4ebf..d026ee74fd 100644 --- a/src/vt/handler/handler.cc +++ b/src/vt/handler/handler.cc @@ -70,7 +70,7 @@ namespace vt { verbose, handler, "HandlerManager::makeHandler: is_functor={}, is_auto={}, registry_type={}, " "id={:x}, control={:x}, han={:x}, is_trace={}\n", - is_functor, is_auto, registry_type, id, control, new_han, is_trace + is_functor, is_auto, static_cast(registry_type), id, control, new_han, is_trace ); return new_han; diff --git a/src/vt/rdma/rdma_common.h b/src/vt/rdma/rdma_common.h index 9e049c075c..6a6654692f 100644 --- a/src/vt/rdma/rdma_common.h +++ b/src/vt/rdma/rdma_common.h @@ -75,6 +75,7 @@ enum Type { Uninitialized = 3 }; + static constexpr BitCountType const rdma_type_num_bits = 4; static constexpr BitCountType const rdma_sized_num_bits = 1; static constexpr BitCountType const rdma_collective_num_bits = 1; @@ -116,6 +117,39 @@ static constexpr ByteType rdma_default_byte_size = sizeof(char); }} //end namespace vt::rdma +VT_FMT_NAMESPACE_BEGIN + +template <> +struct formatter<::vt::rdma::Type> { + constexpr auto parse(fmt::format_parse_context& ctx) { return ctx.begin(); } + + template + auto format(::vt::rdma::Type t, FormatContext& ctx) const { + std::string_view name = "Unknown"; + switch (t) { + case ::vt::rdma::Type::Get: + name = "Get"; + break; + case ::vt::rdma::Type::Put: + name = "Put"; + break; + case ::vt::rdma::Type::GetOrPut: + name = "GetOrPut"; + break; + case ::vt::rdma::Type::Uninitialized: + name = "Uninitialized"; + break; + default: + name = fmt::format( + "{}", static_cast>(t)); + } + + return fmt::format_to(ctx.out(), name); + } +}; + +VT_FMT_NAMESPACE_END + #define PRINT_CHANNEL_TYPE(rdma_op_type) ( \ rdma_op_type == vt::rdma::Type::Get ? "rdma::Get" : ( \ rdma_op_type == vt::rdma::Type::Put ? "rdma::Put" : ( \ diff --git a/src/vt/runtime/component/diagnostic_value_format.h b/src/vt/runtime/component/diagnostic_value_format.h index 7c72573ae5..2935c70ce1 100644 --- a/src/vt/runtime/component/diagnostic_value_format.h +++ b/src/vt/runtime/component/diagnostic_value_format.h @@ -49,7 +49,7 @@ #include "vt/runtime/component/diagnostic_enum_format.h" #include "vt/utils/memory/memory_units.h" -#include +#include INCLUDE_FMT_CORE namespace vt { namespace runtime { namespace component { namespace detail { diff --git a/src/vt/runtime/runtime_diagnostics.cc b/src/vt/runtime/runtime_diagnostics.cc index fa78c6ff20..fc03ef3b0a 100644 --- a/src/vt/runtime/runtime_diagnostics.cc +++ b/src/vt/runtime/runtime_diagnostics.cc @@ -56,7 +56,7 @@ #include #endif /*vt_check_enabled(libfort)*/ -#include +#include INCLUDE_FMT_CORE #include #include diff --git a/src/vt/termination/interval/interval.h b/src/vt/termination/interval/interval.h index 59c4ecd724..94b16dacc5 100644 --- a/src/vt/termination/interval/interval.h +++ b/src/vt/termination/interval/interval.h @@ -48,7 +48,7 @@ #include -#include +#include INCLUDE_FMT_OSTREAM namespace vt { namespace term { namespace interval { @@ -230,4 +230,27 @@ using Interval = term::interval::Interval; } /* end namespace vt */ +namespace vt { namespace term { namespace interval { + +template +struct Interval; + +}}} + +VT_FMT_NAMESPACE_BEGIN + +template +struct formatter<::vt::term::interval::Interval> + : formatter { + template + auto format( + const ::vt::term::interval::Interval& interval, + FormatContext& ctx) const { + return format_to( + ctx.out(), "Interval[{}, {}]", interval.lower(), interval.upper()); + } +}; + +VT_FMT_NAMESPACE_END + #endif /*INCLUDED_VT_TERMINATION_INTERVAL_INTERVAL_H*/ diff --git a/src/vt/termination/termination.cc b/src/vt/termination/termination.cc index 1798bad28f..817b0d0153 100644 --- a/src/vt/termination/termination.cc +++ b/src/vt/termination/termination.cc @@ -1019,7 +1019,7 @@ EpochType TerminationDetector::makeEpochRooted( vt_debug_print( normal, term, "makeEpochRooted: root={}, use_ds={}, successor={:x}, label={}\n", - theContext()->getNode(), use_ds, (EpochType)successor, label + theContext()->getNode(), use_ds.use_it_, (EpochType)successor, label ); bool const force_use_ds = vt::theConfig()->vt_term_rooted_use_ds; diff --git a/src/vt/timing/timing.h b/src/vt/timing/timing.h index bd3ad278f3..59679e6888 100644 --- a/src/vt/timing/timing.h +++ b/src/vt/timing/timing.h @@ -47,7 +47,8 @@ #include #include -#include +#include "vt/cmake_config.h" +#include INCLUDE_FMT_CORE #include "vt/timing/timing_type.h" @@ -62,7 +63,7 @@ TimeType getCurrentTime(); }} /* end namespace vt::timing */ -namespace fmt { +VT_FMT_NAMESPACE_BEGIN template<> struct formatter<::vt::TimeTypeWrapper> { @@ -72,7 +73,7 @@ struct formatter<::vt::TimeTypeWrapper> { } template - auto format(::vt::TimeTypeWrapper const& t, FormatContext& ctx) { + auto format(::vt::TimeTypeWrapper const& t, FormatContext& ctx) const { return fmt::format_to( ctx.out(), "{}", to_engineering_string(t.seconds(), 5, eng_exponential, "s") @@ -80,6 +81,6 @@ struct formatter<::vt::TimeTypeWrapper> { } }; -} /* end namespace fmt */ +VT_FMT_NAMESPACE_END #endif /*INCLUDED_VT_TIMING_TIMING_H*/ diff --git a/src/vt/topos/index/dense/dense_array.h b/src/vt/topos/index/dense/dense_array.h index a40a05d215..3a1870de9f 100644 --- a/src/vt/topos/index/dense/dense_array.h +++ b/src/vt/topos/index/dense/dense_array.h @@ -157,6 +157,22 @@ static_assert( }} // end namespace vt::index +VT_FMT_NAMESPACE_BEGIN + +template +struct formatter<::vt::index::DenseIndexArray> { + constexpr auto parse(fmt::format_parse_context& ctx) { return ctx.begin(); } + + template + auto format( + const ::vt::index::DenseIndexArray& idx, + FormatContext& ctx) const { + return fmt::format_to(ctx.out(), idx.toString()); + } +}; + +VT_FMT_NAMESPACE_END + #include "vt/topos/index/dense/dense_array.impl.h" #endif /*INCLUDED_VT_TOPOS_INDEX_DENSE_DENSE_ARRAY_H*/ diff --git a/src/vt/utils/adt/histogram_approx.h b/src/vt/utils/adt/histogram_approx.h index a568e24ce9..04fefd85bb 100644 --- a/src/vt/utils/adt/histogram_approx.h +++ b/src/vt/utils/adt/histogram_approx.h @@ -52,7 +52,7 @@ #include #include -#include +#include INCLUDE_FMT_CORE namespace vt { namespace util { namespace adt { diff --git a/src/vt/utils/compress/decompressor.impl.h b/src/vt/utils/compress/decompressor.impl.h index 971f443fb7..209a29841e 100644 --- a/src/vt/utils/compress/decompressor.impl.h +++ b/src/vt/utils/compress/decompressor.impl.h @@ -136,7 +136,7 @@ std::size_t Decompressor::read( // we have hit an unknown error, print the code and corresponding message! auto error_code = BrotliDecoderGetErrorCode(dec_); auto error_str = fmt::format( - "code={}, msg={}\n", error_code, BrotliDecoderErrorString(error_code) + "code={}, msg={}\n", static_cast(error_code), BrotliDecoderErrorString(error_code) ); vtAbort(error_str); break; diff --git a/src/vt/utils/json/json_appender.h b/src/vt/utils/json/json_appender.h index 0f742b5581..16f64b5705 100644 --- a/src/vt/utils/json/json_appender.h +++ b/src/vt/utils/json/json_appender.h @@ -49,7 +49,7 @@ #include -#include +#include INCLUDE_FMT_CORE namespace vt { namespace util { namespace json { diff --git a/src/vt/vrt/collection/balance/greedylb/greedylb.h b/src/vt/vrt/collection/balance/greedylb/greedylb.h index d544826aad..fe5c63d756 100644 --- a/src/vt/vrt/collection/balance/greedylb/greedylb.h +++ b/src/vt/vrt/collection/balance/greedylb/greedylb.h @@ -41,6 +41,7 @@ //@HEADER */ +#include #if !defined INCLUDED_VT_VRT_COLLECTION_BALANCE_GREEDYLB_GREEDYLB_H #define INCLUDED_VT_VRT_COLLECTION_BALANCE_GREEDYLB_GREEDYLB_H @@ -126,4 +127,36 @@ struct GreedyLB : LoadSamplerBaseLB { }}}} /* end namespace vt::vrt::collection::lb */ +VT_FMT_NAMESPACE_BEGIN + +template <> +struct formatter<::vt::vrt::collection::lb::DataDistStrategy> + : formatter { + template + auto + format(::vt::vrt::collection::lb::DataDistStrategy c, FormatContext& ctx) { + std::string_view name = "Unknown"; + switch (c) { + case ::vt::vrt::collection::lb::DataDistStrategy::scatter: + name = "scatter"; + break; + case ::vt::vrt::collection::lb::DataDistStrategy::bcast: + name = "bcast"; + break; + case ::vt::vrt::collection::lb::DataDistStrategy::pt2pt: + name = "pt2pt"; + break; + default: + name = fmt::format( + "{}", + static_cast< + std::underlying_type_t<::vt::vrt::collection::lb::DataDistStrategy>>( + c)); + } + return formatter::format(name, ctx); + } +}; + +VT_FMT_NAMESPACE_END + #endif /*INCLUDED_VT_VRT_COLLECTION_BALANCE_GREEDYLB_GREEDYLB_H*/ diff --git a/src/vt/vrt/collection/balance/lb_args_enum_converter.h b/src/vt/vrt/collection/balance/lb_args_enum_converter.h index 050adfeb86..fa2dce3ccb 100644 --- a/src/vt/vrt/collection/balance/lb_args_enum_converter.h +++ b/src/vt/vrt/collection/balance/lb_args_enum_converter.h @@ -100,7 +100,7 @@ struct LBArgsEnumConverter { auto err = fmt::format( "LBArgsEnumConverter: enum '{}' value '{}' corresponding to LB " "argument '{}' does not have a string associated with it", - enum_type_, e, par_name_ + enum_type_, static_cast>(e), par_name_ ); vtAbort(err); } diff --git a/src/vt/vrt/collection/balance/node_lb_data.cc b/src/vt/vrt/collection/balance/node_lb_data.cc index 6d65cad1b2..6805f1e933 100644 --- a/src/vt/vrt/collection/balance/node_lb_data.cc +++ b/src/vt/vrt/collection/balance/node_lb_data.cc @@ -58,8 +58,6 @@ #include #include -#include - namespace vt { namespace vrt { namespace collection { namespace balance { void NodeLBData::setProxy(objgroup::proxy::Proxy in_proxy) { diff --git a/src/vt/vrt/collection/balance/temperedlb/criterion.h b/src/vt/vrt/collection/balance/temperedlb/criterion.h index 70cb736fe8..42e8b7befe 100644 --- a/src/vt/vrt/collection/balance/temperedlb/criterion.h +++ b/src/vt/vrt/collection/balance/temperedlb/criterion.h @@ -53,6 +53,8 @@ enum struct CriterionEnum : uint8_t { ModifiedGrapevine = 1 }; + + struct GrapevineCriterion { bool operator()(LoadType, LoadType under, LoadType obj, LoadType avg) const { return not (under + obj > avg); @@ -91,4 +93,27 @@ struct Criterion { }}}} /* end namespace vt::vrt::collection::lb */ +VT_FMT_NAMESPACE_BEGIN + +template <> +struct formatter<::vt::vrt::collection::lb::CriterionEnum> { + constexpr auto parse(fmt::format_parse_context& ctx) { return ctx.begin(); } + + template + auto format(::vt::vrt::collection::lb::CriterionEnum c, FormatContext& ctx) const { + std::string_view name = "Unknown"; + switch (c) { + case ::vt::vrt::collection::lb::CriterionEnum::Grapevine: + name = "Grapevine"; + break; + case ::vt::vrt::collection::lb::CriterionEnum::ModifiedGrapevine: + name = "ModifiedGrapevine"; + break; + } + return fmt::format_to(ctx.out(), name); + } +}; + +VT_FMT_NAMESPACE_END + #endif /*INCLUDED_VT_VRT_COLLECTION_BALANCE_TEMPEREDLB_CRITERION_H*/ diff --git a/src/vt/vrt/collection/manager.impl.h b/src/vt/vrt/collection/manager.impl.h index 8ebb00766a..bf1ecd151e 100644 --- a/src/vt/vrt/collection/manager.impl.h +++ b/src/vt/vrt/collection/manager.impl.h @@ -88,8 +88,8 @@ #include #include -#include -#include +#include INCLUDE_FMT_CORE +#include INCLUDE_FMT_OSTREAM namespace vt { namespace vrt { namespace collection { diff --git a/tests/perf/collection_local_send.cc b/tests/perf/collection_local_send.cc index a300485d8e..05cd8fc73f 100644 --- a/tests/perf/collection_local_send.cc +++ b/tests/perf/collection_local_send.cc @@ -43,7 +43,7 @@ #include "common/test_harness.h" #include -#include +#include INCLUDE_FMT_CORE using namespace vt; using namespace vt::tests::perf::common; diff --git a/tests/perf/make_runnable_micro.cc b/tests/perf/make_runnable_micro.cc index 9991d630e9..c53599070c 100644 --- a/tests/perf/make_runnable_micro.cc +++ b/tests/perf/make_runnable_micro.cc @@ -46,7 +46,7 @@ #include #include -#include +#include INCLUDE_FMT_CORE using namespace vt; using namespace vt::tests::perf::common; diff --git a/tests/perf/objgroup_local_send.cc b/tests/perf/objgroup_local_send.cc index 5cf25ac728..ed351af419 100644 --- a/tests/perf/objgroup_local_send.cc +++ b/tests/perf/objgroup_local_send.cc @@ -43,7 +43,7 @@ #include "common/test_harness.h" #include -#include +#include INCLUDE_FMT_CORE using namespace vt; using namespace vt::tests::perf::common; diff --git a/tests/perf/ping_pong.cc b/tests/perf/ping_pong.cc index 8a2730b3b2..8bec0fa9b7 100644 --- a/tests/perf/ping_pong.cc +++ b/tests/perf/ping_pong.cc @@ -45,7 +45,7 @@ #include #include -#include +#include INCLUDE_FMT_CORE using namespace vt; using namespace vt::tests::perf::common; diff --git a/tests/perf/ping_pong_am.cc b/tests/perf/ping_pong_am.cc index cecb2445ab..0ba975cee9 100644 --- a/tests/perf/ping_pong_am.cc +++ b/tests/perf/ping_pong_am.cc @@ -46,7 +46,7 @@ #include #include -#include +#include INCLUDE_FMT_CORE using namespace vt; using namespace vt::tests::perf::common; diff --git a/tests/perf/reduce.cc b/tests/perf/reduce.cc index 0a4cb6dc0e..0f1b25791a 100644 --- a/tests/perf/reduce.cc +++ b/tests/perf/reduce.cc @@ -45,7 +45,7 @@ #include #include -#include +#include INCLUDE_FMT_CORE using namespace vt; using namespace vt::tests::perf::common; diff --git a/tests/unit/collection/test_collection_common.h b/tests/unit/collection/test_collection_common.h index 65e769b22b..e14553966d 100644 --- a/tests/unit/collection/test_collection_common.h +++ b/tests/unit/collection/test_collection_common.h @@ -47,8 +47,8 @@ #include #include -#include -#include +#include INCLUDE_FMT_CORE +#include INCLUDE_FMT_OSTREAM #include diff --git a/tests/unit/collection/test_collection_construct_common.h b/tests/unit/collection/test_collection_construct_common.h index 33ff3f9d86..f27a59b0c5 100644 --- a/tests/unit/collection/test_collection_construct_common.h +++ b/tests/unit/collection/test_collection_construct_common.h @@ -49,8 +49,8 @@ #include "vt/vrt/collection/manager.h" #include "data_message.h" -#include -#include +#include INCLUDE_FMT_CORE +#include INCLUDE_FMT_OSTREAM #include diff --git a/tests/unit/configs/test_stack_dumping.cc b/tests/unit/configs/test_stack_dumping.cc index 03437e5f96..9aac6ea480 100644 --- a/tests/unit/configs/test_stack_dumping.cc +++ b/tests/unit/configs/test_stack_dumping.cc @@ -41,11 +41,11 @@ //@HEADER */ -#include #include #include "test_parallel_harness.h" #include "vt/configs/error/stack_out.h" +#include INCLUDE_FMT_CORE namespace vt { namespace tests { namespace unit { diff --git a/tests/unit/lb/test_lbargs_enum_conv.nompi.cc b/tests/unit/lb/test_lbargs_enum_conv.nompi.cc index a523b0a4bd..9d0694b117 100644 --- a/tests/unit/lb/test_lbargs_enum_conv.nompi.cc +++ b/tests/unit/lb/test_lbargs_enum_conv.nompi.cc @@ -147,3 +147,27 @@ TEST_F(TestLBArgsEnumConverter, test_enum_converter_config) { } }}} // end namespace vt::tests::unit + +VT_FMT_NAMESPACE_BEGIN + template <> + struct formatter<::vt::tests::unit::DummyEnum> { + constexpr auto parse(fmt::format_parse_context& ctx) { return ctx.begin(); } + + template + auto format(::vt::tests::unit::DummyEnum c, FormatContext& ctx) const { + std::string_view name = "Unknown"; + switch (c) { + case ::vt::tests::unit::DummyEnum::One: + name = "One"; + break; + case ::vt::tests::unit::DummyEnum::Two: + name = "Two"; + break; + case ::vt::tests::unit::DummyEnum::Three: + name = "Three"; + break; + } + return fmt::format_to(ctx.out(), name); + } + }; +VT_FMT_NAMESPACE_END