55 "MPI capabilities have not been fetched yet");
63 "MPI capabilities have not been fetched yet");
68 std::optional<StateMPI_Aware> _forced_state;
72 _forced_state = forced_state;
74 logs::debug_ln(
"Comm",
"fetching mpi capabilities...");
76 logs::debug_mpi_ln(
"Comm",
"FOUND_MPI_EXT is defined");
78 #if defined(MPIX_CUDA_AWARE_SUPPORT)
79 logs::debug_mpi_ln(
"Comm",
"MPIX_CUDA_AWARE_SUPPORT is defined");
80 if (1 == MPIX_Query_cuda_support()) {
90 #if defined(MPIX_ROCM_AWARE_SUPPORT)
91 logs::debug_mpi_ln(
"Comm",
"MPIX_ROCM_AWARE_SUPPORT is defined");
92 if (1 == MPIX_Query_rocm_support()) {
116 using namespace shambase::term_colors;
118 auto print_state = [](
const std::string &log,
StateMPI_Aware state) {
120 case Yes:
logs::print_ln(
" - " + log +
" :", col8b_green() +
"Yes" + reset());
break;
121 case No :
logs::print_ln(
" - " + log +
" :", col8b_red() +
"No" + reset());
break;
123 logs::print_ln(
" - " + log +
" :", col8b_yellow() +
"Unknown" + reset());
126 logs::print_ln(
" - " + log +
" :", col8b_yellow() +
"Forced Yes" + reset());
129 logs::print_ln(
" - " + log +
" :", col8b_yellow() +
"Forced No" + reset());
138 print_state(
"MPI Forced DGPU ", *_forced_state);
150 char processor_name[MPI_MAX_PROCESSOR_NAME];
153 int err_code = MPI_Get_processor_name(processor_name, &name_len);
155 if (err_code != MPI_SUCCESS) {
159 return {processor_name};
Provide information about MPI capabilities.
Use this header to include MPI properly.
void print_ln()
Prints a log message with multiple arguments followed by a newline.
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.
namespace for communication related stuff
void print_mpi_comm_info()
Print the MPI communicator infos.
StateMPI_Aware mpi_rocm_aware
MPI ROCm aware capability.
StateMPI_Aware
Enum to describe the MPI capabilities.
@ ForcedYes
Feature forced on by the user.
@ Unknown
The MPI implementation does not if the feature is supported.
@ ForcedNo
Feature forced off by the user.
@ No
The MPI implementation does not support the feature.
@ Yes
The MPI implementation supports the feature.
std::optional< StateMPI_Aware > should_force_dgpu_state()
Should DGPU should be forced.
i32 world_size()
Gives the size of the MPI communicator.
i32 mpi_max_tag_value()
Gets the maximum value of the MPI tag.
void fetch_mpi_capabilities(std::optional< StateMPI_Aware > forced_state)
Fetch the MPI capabilities.
StateMPI_Aware get_mpi_cuda_aware_status()
Get the MPI CUDA aware capability.
std::string get_process_name()
Get the process name.
StateMPI_Aware get_mpi_rocm_aware_status()
Get the MPI ROCM aware capability.
void print_mpi_capabilities()
Print the MPI capabilities.
bool fetched
Has the MPI capabilities been fetched?
StateMPI_Aware mpi_cuda_aware
MPI CUDA aware capability.
Functions related to the MPI communicator.