26 bool validate_comm_internal(std::shared_ptr<sham::DeviceScheduler> &device_sched) {
32 std::vector<u8> host_data(nbytes);
33 for (
u32 i = 0; i < nbytes; i++) {
34 host_data[i] = i % 100;
36 buf_comp.copy_from_stdvec(host_data);
72 std::vector<u8> acc1 = buf_comp.copy_to_stdvec();
75 std::string id_err_list =
"errors in id : ";
78 for (
u32 i = 0; i < acc1.size(); i++) {
79 if (!sham::equals(acc1[i], acc2[i])) {
91 void validate_comm(std::shared_ptr<sham::DeviceScheduler> &sched) {
94 bool call_abort =
false;
96 bool dgpu_mode = sched->ctx->device->mpi_prop.is_mpi_direct_capable;
98 using namespace shambase::term_colors;
100 if (validate_comm_internal(sched)) {
102 logger::raw_ln(
" - MPI use Direct Comm :",
col8b_green() +
"Working" +
reset());
105 logger::raw_ln(
" - MPI use Direct Comm :",
col8b_red() +
"Fail" +
reset());
107 logger::err_ln(
"Sys",
"the select comm mode failed, try forcing dgpu mode off");
111 if (validate_comm_internal(sched)) {
117 logger::raw_ln(
" - MPI use Copy to Host :",
col8b_red() +
"Fail" +
reset());
125 MPI_Abort(MPI_COMM_WORLD, 26);
Shamrock communication buffers.
std::uint32_t u32
32 bit unsigned integer
A buffer allocated in USM (Unified Shared Memory)
std::vector< T > copy_to_stdvec() const
Copy the content of the buffer to a std::vector.
Shamrock communication buffers.
static sham::DeviceBuffer< u8 > convert_usm(CommunicationBuffer &&buf)
destroy the buffer and recover the held object
Use this header to include MPI properly.
namespace for communication related stuff
i32 world_rank()
Gives the rank of the current process in the MPI communicator.
i32 world_size()
Gives the size of the MPI communicator.
const std::string reset()
Get the reset terminal escape char.
const std::string col8b_green()
Get the green terminal escape char.
const std::string col8b_red()
Get the red terminal escape char.
Functions related to the MPI communicator.
void Irecv(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request *request)
MPI wrapper for MPI_Irecv.
void Barrier(MPI_Comm comm)
MPI wrapper for MPI_Barrier.
void Wait(MPI_Request *request, MPI_Status *status)
MPI wrapper for MPI_Wait.
void Isend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request)
MPI wrapper for MPI_Isend.