Skip to content
Merged
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
22 changes: 16 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ set(mpi
${default_mpi}
CACHE BOOL "Use MPI")

set(gpu_aware_mpi
${default_gpu_aware_mpi}
CACHE BOOL "Enable GPU-aware MPI")

# -------------------------- Compilation settings -------------------------- #
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down Expand Up @@ -90,10 +94,18 @@ include_directories(${plog_SRC}/include)
set_precision(${precision})
if("${Kokkos_DEVICES}" MATCHES "CUDA")
add_compile_options("-D CUDA_ENABLED")
set(DEVICE_ENABLED ON)
add_compile_options("-D DEVICE_ENABLED")
elseif("${Kokkos_DEVICES}" MATCHES "HIP")
add_compile_options("-D HIP_ENABLED")
set(DEVICE_ENABLED ON)
add_compile_options("-D DEVICE_ENABLED")
elseif("${Kokkos_DEVICES}" MATCHES "SYCL")
add_compile_options("-D SYCL_ENABLED")
set(DEVICE_ENABLED ON)
add_compile_options("-D DEVICE_ENABLED")
else()
set(DEVICE_ENABLED OFF)
endif()

if(("${Kokkos_DEVICES}" MATCHES "CUDA")
Expand All @@ -110,14 +122,12 @@ if(${mpi})
include_directories(${MPI_CXX_INCLUDE_PATH})
add_compile_options("-D MPI_ENABLED")
set(DEPENDENCIES ${DEPENDENCIES} MPI::MPI_CXX)

if(${DEVICE_ENABLED})
set(mpi_device_copy
${default_mpi_device_copy}
CACHE BOOL "Use explicit copy when using MPI + GPU")
add_compile_options("-D MPI_DEVICE_COPY")
if(${gpu_aware_mpi})
add_compile_options("-D GPU_AWARE_MPI")
endif()
else()
set(mpi_device_copy
set(gpu_aware_mpi
OFF
CACHE BOOL "Use explicit copy when using MPI + GPU")
endif()
Expand Down
12 changes: 12 additions & 0 deletions cmake/defaults.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,15 @@ else()
endif()

set_property(CACHE default_mpi PROPERTY TYPE BOOL)

if(DEFINED ENV{Entity_ENABLE_GPU_AWARE_MPI})
set(default_gpu_aware_mpi
$ENV{Entity_ENABLE_GPU_AWARE_MPI}
CACHE INTERNAL "Default flag for GPU-aware MPI")
else()
set(default_gpu_aware_mpi
ON
CACHE INTERNAL "Default flag for GPU-aware MPI")
endif()

set_property(CACHE default_gpu_aware_mpi PROPERTY TYPE BOOL)
25 changes: 12 additions & 13 deletions cmake/report.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,17 @@ printchoices(
"${Green}"
MPI_REPORT
46)
if(${mpi} AND ${DEVICE_ENABLED})
printchoices(
"GPU-aware MPI"
"gpu_aware_mpi"
"${ON_OFF_VALUES}"
${gpu_aware_mpi}
OFF
"${Green}"
GPU_AWARE_MPI_REPORT
46)
endif()
printchoices(
"Debug mode"
"DEBUG"
Expand All @@ -65,18 +76,6 @@ printchoices(
DEBUG_REPORT
46)

if(${mpi} AND ${DEVICE_ENABLED})
printchoices(
"MPI explicit copy"
"mpi_device_copy"
"${ON_OFF_VALUES}"
${mpi_device_copy}
OFF
"${Green}"
MPI_DEVICE_COPY_REPORT
46)
endif()

if(NOT ${PROJECT_VERSION_TWEAK} EQUAL 0)
set(VERSION_SYMBOL "v${PROJECT_VERSION_MAJOR}." "${PROJECT_VERSION_MINOR}.")
string(APPEND VERSION_SYMBOL
Expand Down Expand Up @@ -134,7 +133,7 @@ string(
"\n")

if(${mpi} AND ${DEVICE_ENABLED})
string(APPEND REPORT_TEXT " " ${MPI_DEVICE_COPY_REPORT} "\n")
string(APPEND REPORT_TEXT " " ${GPU_AWARE_MPI_REPORT} "\n")
endif()

string(
Expand Down
73 changes: 71 additions & 2 deletions src/engines/engine_printer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ namespace ntt {
color::RESET);
}

auto bytes_to_human_readable(
std::size_t bytes) -> std::pair<long double, std::string> {
auto bytes_to_human_readable(std::size_t bytes)
-> std::pair<long double, std::string> {
const std::vector<std::string> units { "B", "KB", "MB", "GB", "TB" };
idx_t unit_idx = 0;
auto size = static_cast<long double>(bytes);
Expand Down Expand Up @@ -214,6 +214,10 @@ namespace ntt {
report += "\n\n";
add_header(report, { entity_version }, { color::BRIGHT_GREEN });
report += "\n";

/*
* Backend
*/
add_category(report, 4, "Backend");
add_param(report, 4, "Build hash", "%s", hash.c_str());
add_param(report, 4, "CXX", "%s [%s]", ccx.c_str(), cpp_standard.c_str());
Expand All @@ -223,11 +227,76 @@ namespace ntt {
add_param(report, 4, "HIP", "%s", hip_version.c_str());
#endif
add_param(report, 4, "MPI", "%s", mpi_version.c_str());
#if defined(MPI_ENABLED) && defined(DEVICE_ENABLED)
#if defined(GPU_AWARE_MPI)
const std::string gpu_aware_mpi = "ON";
#else
const std::string gpu_aware_mpi = "OFF";
#endif
add_param(report, 4, "GPU-aware MPI", "%s", gpu_aware_mpi.c_str());
#endif
add_param(report, 4, "Kokkos", "%s", kokkos_version.c_str());
add_param(report, 4, "ADIOS2", "%s", adios2_version.c_str());
add_param(report, 4, "Precision", "%s", precision);
add_param(report, 4, "Debug", "%s", dbg.c_str());
report += "\n";

/*
* Compilation flags
*/
add_category(report, 4, "Compilation flags");
#if defined(SINGLE_PRECISION)
add_param(report, 4, "SINGLE_PRECISION", "%s", "ON");
#else
add_param(report, 4, "SINGLE_PRECISION", "%s", "OFF");
#endif

#if defined(OUTPUT_ENABLED)
add_param(report, 4, "OUTPUT_ENABLED", "%s", "ON");
#else
add_param(report, 4, "OUTPUT_ENABLED", "%s", "OFF");
#endif

#if defined(DEBUG)
add_param(report, 4, "DEBUG", "%s", "ON");
#else
add_param(report, 4, "DEBUG", "%s", "OFF");
#endif

#if defined(CUDA_ENABLED)
add_param(report, 4, "CUDA_ENABLED", "%s", "ON");
#else
add_param(report, 4, "CUDA_ENABLED", "%s", "OFF");
#endif

#if defined(HIP_ENABLED)
add_param(report, 4, "HIP_ENABLED", "%s", "ON");
#else
add_param(report, 4, "HIP_ENABLED", "%s", "OFF");
#endif

#if defined(DEVICE_ENABLED)
add_param(report, 4, "DEVICE_ENABLED", "%s", "ON");
#else
add_param(report, 4, "DEVICE_ENABLED", "%s", "OFF");
#endif

#if defined(MPI_ENABLED)
add_param(report, 4, "MPI_ENABLED", "%s", "ON");
#else
add_param(report, 4, "MPI_ENABLED", "%s", "OFF");
#endif

#if defined(GPU_AWARE_MPI)
add_param(report, 4, "GPU_AWARE_MPI", "%s", "ON");
#else
add_param(report, 4, "GPU_AWARE_MPI", "%s", "OFF");
#endif
report += "\n";

/*
* Simulation configs
*/
add_category(report, 4, "Configuration");
add_param(report,
4,
Expand Down
Loading