![]() |
Shamrock 2025.10.0
Astrophysical Code
|
namespace for communication related stuff More...
Classes | |
| class | CommunicationBuffer |
| Shamrock communication buffers. More... | |
Enumerations | |
| enum | CommunicationProtocol { CopyToHost , DirectGPU } |
| enum | StateMPI_Aware { Unknown , Yes , No , ForcedYes , ForcedNo } |
| Enum to describe the MPI capabilities. More... | |
Functions | |
| void | validate_comm (std::shared_ptr< sham::DeviceScheduler > &sched) |
| CommunicationProtocol | get_protocol (sham::Device &device) |
| bool | validate_comm_internal (std::shared_ptr< sham::DeviceScheduler > &device_sched) |
| void | open_reset_file (MPI_File &fh, const std::string &fname) |
| Open a MPI file and remove its content. | |
| void | open_read_only_file (MPI_File &fh, const std::string &fname) |
| Open a mpi file in read only mode. | |
| std::optional< u32 > | node_local_rank () |
| bool | is_main_node_rank (u32 main_local_rank_id=0) |
| void | check_mpi_return (int ret, const char *log) |
| Check a MPI return code. | |
| bool | is_direct_comm_aware (const StateMPI_Aware &v) |
| StateMPI_Aware | get_mpi_cuda_aware_status () |
| Get the MPI CUDA aware capability. | |
| StateMPI_Aware | get_mpi_rocm_aware_status () |
| Get the MPI ROCM aware capability. | |
| std::optional< StateMPI_Aware > | should_force_dgpu_state () |
| Should DGPU should be forced. | |
| void | fetch_mpi_capabilities (std::optional< StateMPI_Aware > forced_state) |
| Fetch the MPI capabilities. | |
| void | print_mpi_capabilities () |
| Print the MPI capabilities. | |
| void | print_mpi_comm_info () |
| Print the MPI communicator infos. | |
| std::string | get_process_name () |
| Get the process name. | |
| i32 | world_rank () |
| Gives the rank of the current process in the MPI communicator. | |
| i32 | world_size () |
| Gives the size of the MPI communicator. | |
| i32 | mpi_max_tag_value () |
| Gets the maximum value of the MPI tag. | |
| std::string | mpi_process_name () |
| Gets the name of the MPI process. | |
| void | fetch_world_info () |
| Gets the information about the MPI communicator. | |
| bool | is_mpi_initialized () |
| Check if MPI is initialized. | |
| __attribute__ ((no_sanitize_address)) void fetch_mpi_process_name() | |
| void | set_callstack_process_identifier () |
Variables | |
| const std::optional< std::string > | MV2_COMM_WORLD_LOCAL_RANK = shamcmdopt::getenv_str("MV2_COMM_WORLD_LOCAL_RANK") |
| const std::optional< std::string > | OMPI_COMM_WORLD_LOCAL_RANK = shamcmdopt::getenv_str("OMPI_COMM_WORLD_LOCAL_RANK") |
| const std::optional< std::string > | MPI_LOCALRANKID = shamcmdopt::getenv_str("MPI_LOCALRANKID") |
| const std::optional< std::string > | SLURM_PROCID = shamcmdopt::getenv_str("SLURM_PROCID") |
| const std::optional< std::string > | LOCAL_RANK = shamcmdopt::getenv_str("LOCAL_RANK") |
| const std::optional< std::string > | PALS_LOCAL_RANKID = shamcmdopt::getenv_str("PALS_LOCAL_RANKID") |
| const std::optional< std::string > | PSM2_CUDA = shamcmdopt::getenv_str("PSM2_CUDA") |
| StateMPI_Aware | mpi_cuda_aware = StateMPI_Aware::Unknown |
| MPI CUDA aware capability. | |
| StateMPI_Aware | mpi_rocm_aware = StateMPI_Aware::Unknown |
| MPI ROCm aware capability. | |
| bool | fetched = false |
| Has the MPI capabilities been fetched? | |
| std::optional< StateMPI_Aware > | _forced_state |
| i32 | _world_rank |
| i32 | _world_size |
| std::optional< i32 > | _max_tag = std::nullopt |
| std::string | _mpi_process_name |
namespace for communication related stuff
| Enumerator | |
|---|---|
| CopyToHost | copy data to the host and then perform the call |
| DirectGPU | copy data straight from the GPU |
Definition at line 28 of file CommunicationBufferImpl.hpp.
Enum to describe the MPI capabilities.
Definition at line 28 of file mpiInfo.hpp.
| shamcomm::__attribute__ | ( | (no_sanitize_address) | ) |
Definition at line 44 of file worldInfo.cpp.
| void shamcomm::check_mpi_return | ( | int | ret, |
| const char * | log | ||
| ) |
Check a MPI return code.
This function checks the return code of an MPI call and aborts the program if an error occured. The function prints an error message indicating where the error occured (using the provided log string)
| ret | The MPI return code to check |
| log | A string indicating where the error occured |
Definition at line 21 of file mpiErrorCheck.cpp.
| void shamcomm::fetch_mpi_capabilities | ( | std::optional< StateMPI_Aware > | forced_state | ) |
Fetch the MPI capabilities.
This function fetches the MPI capabilities of the current process.
| forced_state | Force the MPI CUDA & ROCM aware capability to be reported as ForcedOn |
Definition at line 70 of file mpiInfo.cpp.
| void shamcomm::fetch_world_info | ( | ) |
Gets the information about the MPI communicator.
This function queries the MPI communicator size and rank. It should be called once in the program.
Definition at line 64 of file worldInfo.cpp.
Here is the call graph for this function:| StateMPI_Aware shamcomm::get_mpi_cuda_aware_status | ( | ) |
Get the MPI CUDA aware capability.
This function returns the MPI CUDA aware capability of the current process. If the capability has not been fetched yet, it raises a std::runtime_error
Definition at line 52 of file mpiInfo.cpp.
Here is the call graph for this function:| StateMPI_Aware shamcomm::get_mpi_rocm_aware_status | ( | ) |
Get the MPI ROCM aware capability.
This function returns the MPI ROCM aware capability of the current process. If the capability has not been fetched yet, it raises a std::runtime_error
Definition at line 60 of file mpiInfo.cpp.
Here is the call graph for this function:| std::string shamcomm::get_process_name | ( | ) |
Get the process name.
Definition at line 147 of file mpiInfo.cpp.
Here is the call graph for this function:
|
inline |
Definition at line 41 of file CommunicationBufferImpl.hpp.
|
inline |
Definition at line 51 of file mpiInfo.hpp.
| bool shamcomm::is_main_node_rank | ( | u32 | main_local_rank_id = 0 | ) |
Definition at line 51 of file local_rank.cpp.
| bool shamcomm::is_mpi_initialized | ( | ) |
Check if MPI is initialized.
This function returns true if MPI has been initialized, false otherwise.
Definition at line 89 of file worldInfo.cpp.
| i32 shamcomm::mpi_max_tag_value | ( | ) |
Gets the maximum value of the MPI tag.
Definition at line 36 of file worldInfo.cpp.
Here is the call graph for this function:| std::string shamcomm::mpi_process_name | ( | ) |
Gets the name of the MPI process.
Definition at line 42 of file worldInfo.cpp.
| std::optional< u32 > shamcomm::node_local_rank | ( | ) |
Definition at line 22 of file local_rank.cpp.
| void shamcomm::open_read_only_file | ( | MPI_File & | fh, |
| const std::string & | fname | ||
| ) |
| void shamcomm::open_reset_file | ( | MPI_File & | fh, |
| const std::string & | fname | ||
| ) |
Open a MPI file and remove its content.
This function opens the MPI file fname with write-exclusive permission and remove its content if the file already exists.
| [out] | fh | The MPI file handle to open |
| fname | The name of the file to open |
Definition at line 24 of file io.cpp.
Here is the call graph for this function:| void shamcomm::print_mpi_capabilities | ( | ) |
Print the MPI capabilities.
Definition at line 115 of file mpiInfo.cpp.
Here is the call graph for this function:| void shamcomm::print_mpi_comm_info | ( | ) |
Print the MPI communicator infos.
Definition at line 142 of file mpiInfo.cpp.
Here is the call graph for this function:| void shamcomm::set_callstack_process_identifier | ( | ) |
Definition at line 53 of file worldInfo.cpp.
| std::optional< StateMPI_Aware > shamcomm::should_force_dgpu_state | ( | ) |
Should DGPU should be forced.
Definition at line 113 of file mpiInfo.cpp.
| void shamcomm::validate_comm | ( | std::shared_ptr< sham::DeviceScheduler > & | sched | ) |
Definition at line 91 of file CommunicationBuffer.cpp.
| bool shamcomm::validate_comm_internal | ( | std::shared_ptr< sham::DeviceScheduler > & | device_sched | ) |
Definition at line 26 of file CommunicationBuffer.cpp.
| i32 shamcomm::world_rank | ( | ) |
Gives the rank of the current process in the MPI communicator.
Definition at line 40 of file worldInfo.cpp.
| i32 shamcomm::world_size | ( | ) |
Gives the size of the MPI communicator.
Definition at line 38 of file worldInfo.cpp.
| std::optional<StateMPI_Aware> shamcomm::_forced_state |
Definition at line 68 of file mpiInfo.cpp.
| std::optional<i32> shamcomm::_max_tag = std::nullopt |
Definition at line 32 of file worldInfo.cpp.
| std::string shamcomm::_mpi_process_name |
Definition at line 34 of file worldInfo.cpp.
| i32 shamcomm::_world_rank |
Definition at line 28 of file worldInfo.cpp.
| i32 shamcomm::_world_size |
Definition at line 30 of file worldInfo.cpp.
| bool shamcomm::fetched = false |
Has the MPI capabilities been fetched?
This variable is set to true once the fetch_mpi_capabilities function has been called.
Definition at line 50 of file mpiInfo.cpp.
| const std::optional<std::string> shamcomm::LOCAL_RANK = shamcmdopt::getenv_str("LOCAL_RANK") |
Definition at line 31 of file env_variables.hpp.
| StateMPI_Aware shamcomm::mpi_cuda_aware = StateMPI_Aware::Unknown |
MPI CUDA aware capability.
This variable contains the MPI CUDA aware capability of the current process. It is set to Unknown at the beginning and is updated by the fetch_mpi_capabilities function.
Definition at line 33 of file mpiInfo.cpp.
| const std::optional<std::string> shamcomm::MPI_LOCALRANKID = shamcmdopt::getenv_str("MPI_LOCALRANKID") |
Definition at line 29 of file env_variables.hpp.
| StateMPI_Aware shamcomm::mpi_rocm_aware = StateMPI_Aware::Unknown |
MPI ROCm aware capability.
This variable contains the MPI ROCm aware capability of the current process. It is set to Unknown at the beginning and is updated by the fetch_mpi_capabilities function.
Definition at line 42 of file mpiInfo.cpp.
| const std::optional<std::string> shamcomm::MV2_COMM_WORLD_LOCAL_RANK = shamcmdopt::getenv_str("MV2_COMM_WORLD_LOCAL_RANK") |
Definition at line 25 of file env_variables.hpp.
| const std::optional<std::string> shamcomm::OMPI_COMM_WORLD_LOCAL_RANK = shamcmdopt::getenv_str("OMPI_COMM_WORLD_LOCAL_RANK") |
Definition at line 27 of file env_variables.hpp.
| const std::optional<std::string> shamcomm::PALS_LOCAL_RANKID = shamcmdopt::getenv_str("PALS_LOCAL_RANKID") |
Definition at line 32 of file env_variables.hpp.
| const std::optional<std::string> shamcomm::PSM2_CUDA = shamcmdopt::getenv_str("PSM2_CUDA") |
Definition at line 35 of file env_variables.hpp.
| const std::optional<std::string> shamcomm::SLURM_PROCID = shamcmdopt::getenv_str("SLURM_PROCID") |
Definition at line 30 of file env_variables.hpp.