29#define XMAC_SYCLMPI_TYPE_ENABLED \
51namespace mpi_sycl_interop {
54 enum op_type { Send, Recv_Probe };
56 extern comm_type current_mode;
61 static constexpr bool is_in_type_list =
62#define X(args) std::is_same<T, args>::value ||
63 XMAC_SYCLMPI_TYPE_ENABLED
false
69 "BufferMpiRequest must be one of those types : "
71#define X(args) #args " "
72 XMAC_SYCLMPI_TYPE_ENABLED
81 std::unique_ptr<sycl::buffer<T>> &sycl_buf;
84 std::unique_ptr<sycl::buffer<T>> &sycl_buf,
89 inline T *get_mpi_ptr() {
return comm_ptr; }
96 std::unique_ptr<sycl::buffer<T>> &p,
105 u32 rq_index = rq_lst.size() - 1;
107 auto &rq = rq_lst[rq_index];
109 shamcomm::mpi::Isend(
116 &(rq_lst[rq_index].mpi_rq));
118 return sizeof(T) * size_comm;
123 std::unique_ptr<sycl::buffer<T>> &p,
124 const u32 &size_comm,
125 std::vector<BufferMpiRequest<T>> &rq_lst,
130 rq_lst.push_back(BufferMpiRequest<T>(p, current_mode, Recv_Probe, size_comm));
132 u32 rq_index = rq_lst.size() - 1;
134 auto &rq = rq_lst[rq_index];
136 shamcomm::mpi::Irecv(
143 &(rq_lst[rq_index].mpi_rq));
145 return sizeof(T) * size_comm;
149 inline u64 irecv_probe(
150 std::unique_ptr<sycl::buffer<T>> &p,
151 std::vector<BufferMpiRequest<T>> &rq_lst,
162 return irecv(p, len, rq_lst, rank_source, tag, comm);
166 inline std::vector<MPI_Request> get_rqs(std::vector<BufferMpiRequest<T>> &rq_lst) {
167 std::vector<MPI_Request> addrs;
169 for (
auto a : rq_lst) {
170 addrs.push_back(a.mpi_rq);
177 inline void waitall(std::vector<BufferMpiRequest<T>> &rq_lst) {
178 std::vector<MPI_Request> addrs;
180 for (
auto a : rq_lst) {
181 addrs.push_back(a.mpi_rq);
184 std::vector<MPI_Status> st_lst(addrs.size());
187 for (
auto a : rq_lst) {
193 inline void file_write(MPI_File fh, std::unique_ptr<sycl::buffer<T>> &p,
const u32 &size_comm) {
196 BufferMpiRequest<T> rq(p, current_mode, Send, size_comm);
205namespace impl::copy_to_host {
209 T *init(
const std::unique_ptr<sycl::buffer<T>> &buf,
u32 comm_sz);
212 void finalize(T *comm_ptr);
217 T *init(
u32 comm_sz);
220 void finalize(
const std::unique_ptr<sycl::buffer<T>> &buf, T *comm_ptr,
u32 comm_sz);
225namespace impl::directgpu {
229 T *init(
const std::unique_ptr<sycl::buffer<T>> &buf,
u32 comm_sz);
232 void finalize(T *comm_ptr);
237 T *init(
u32 comm_sz);
240 void finalize(
const std::unique_ptr<sycl::buffer<T>> &buf, T *comm_ptr,
u32 comm_sz);
This header does the MPI include and wrap MPI calls.
Header file describing a Node Instance.
std::uint32_t u32
32 bit unsigned integer
std::uint64_t u64
64 bit unsigned integer
std::int32_t i32
32 bit integer
@ CopyToHost
copy data to the host and then perform the call
@ DirectGPU
copy data straight from the GPU
void Get_count(const MPI_Status *status, MPI_Datatype datatype, int *count)
MPI wrapper for MPI_Get_count.
void Probe(int source, int tag, MPI_Comm comm, MPI_Status *status)
MPI wrapper for MPI_Probe.
void Waitall(int count, MPI_Request array_of_requests[], MPI_Status *array_of_statuses)
MPI wrapper for MPI_Waitall.
void File_write(MPI_File fh, const void *buf, int count, MPI_Datatype datatype, MPI_Status *status)
MPI wrapper for MPI_File_write.