Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
wrapper.hpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
10#pragma once
11
21#include "shamcomm/mpi.hpp"
22#include <unordered_map>
23#include <string>
24#include <vector>
25
26namespace shamcomm::mpi {
27
29 void register_time(std::string timername, f64 time);
30
32 f64 get_timer(std::string timername);
33
35 const std::unordered_map<std::string, f64> &get_timers();
36
38 const std::vector<std::string> &get_possible_keys();
39
41 void Allreduce(
42 const void *sendbuf,
43 void *recvbuf,
44 int count,
45 MPI_Datatype datatype,
46 MPI_Op op,
47 MPI_Comm comm);
48
50 void Allgather(
51 const void *sendbuf,
52 int sendcount,
53 MPI_Datatype sendtype,
54 void *recvbuf,
55 int recvcount,
56 MPI_Datatype recvtype,
57 MPI_Comm comm);
58
60 void Allgatherv(
61 const void *sendbuf,
62 int sendcount,
63 MPI_Datatype sendtype,
64 void *recvbuf,
65 const int recvcounts[],
66 const int displs[],
67 MPI_Datatype recvtype,
68 MPI_Comm comm);
69
71 void Isend(
72 const void *buf,
73 int count,
74 MPI_Datatype datatype,
75 int dest,
76 int tag,
77 MPI_Comm comm,
78 MPI_Request *request);
79
81 void Irecv(
82 void *buf,
83 int count,
84 MPI_Datatype datatype,
85 int source,
86 int tag,
87 MPI_Comm comm,
88 MPI_Request *request);
89
91 void Exscan(
92 const void *sendbuf,
93 void *recvbuf,
94 int count,
95 MPI_Datatype datatype,
96 MPI_Op op,
97 MPI_Comm comm);
98
100 void Wait(MPI_Request *request, MPI_Status *status);
101
103 void Waitall(int count, MPI_Request array_of_requests[], MPI_Status *array_of_statuses);
104
106 void Barrier(MPI_Comm comm);
107
109 void Probe(int source, int tag, MPI_Comm comm, MPI_Status *status);
110
112 void Recv(
113 void *buf,
114 int count,
115 MPI_Datatype datatype,
116 int source,
117 int tag,
118 MPI_Comm comm,
119 MPI_Status *status);
120
122 void Get_count(const MPI_Status *status, MPI_Datatype datatype, int *count);
123
125 void Send(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm);
126
128 void File_set_view(
129 MPI_File fh,
130 MPI_Offset disp,
131 MPI_Datatype etype,
132 MPI_Datatype filetype,
133 const char *datarep,
134 MPI_Info info);
135
137 void Type_size(MPI_Datatype type, int *size);
138
140 void File_write_all(
141 MPI_File fh, const void *buf, int count, MPI_Datatype datatype, MPI_Status *status);
142
144 void File_write(
145 MPI_File fh, const void *buf, int count, MPI_Datatype datatype, MPI_Status *status);
146
148 void File_read(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status);
149
151 void File_write_at(
152 MPI_File fh,
153 MPI_Offset offset,
154 const void *buf,
155 int count,
156 MPI_Datatype datatype,
157 MPI_Status *status);
158
160 void File_read_at(
161 MPI_File fh,
162 MPI_Offset offset,
163 void *buf,
164 int count,
165 MPI_Datatype datatype,
166 MPI_Status *status);
167
169 void File_close(MPI_File *fh);
170
172 void File_open(MPI_Comm comm, const char *filename, int amode, MPI_Info info, MPI_File *fh);
173
175 void Test(MPI_Request *request, int *flag, MPI_Status *status);
176
178 void Gather(
179 const void *sendbuf,
180 int sendcount,
181 MPI_Datatype sendtype,
182 void *recvbuf,
183 int recvcount,
184 MPI_Datatype recvtype,
185 int root,
186 MPI_Comm comm);
187
189 void Gatherv(
190 const void *sendbuf,
191 int sendcount,
192 MPI_Datatype sendtype,
193 void *recvbuf,
194 const int recvcounts[],
195 const int displs[],
196 MPI_Datatype recvtype,
197 int root,
198 MPI_Comm comm);
199
200} // namespace shamcomm::mpi
double f64
Alias for double.
Use this header to include MPI properly.
void File_set_view(MPI_File fh, MPI_Offset disp, MPI_Datatype etype, MPI_Datatype filetype, const char *datarep, MPI_Info info)
MPI wrapper for MPI_File_set_view.
Definition wrapper.cpp:236
void Get_count(const MPI_Status *status, MPI_Datatype datatype, int *count)
MPI wrapper for MPI_Get_count.
Definition wrapper.cpp:222
void Recv(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status)
MPI wrapper for MPI_Recv.
Definition wrapper.cpp:208
void Irecv(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request *request)
MPI wrapper for MPI_Irecv.
Definition wrapper.cpp:102
void Exscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
MPI wrapper for MPI_Exscan.
Definition wrapper.cpp:166
void Gatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, const int recvcounts[], const int displs[], MPI_Datatype recvtype, int root, MPI_Comm comm)
MPI wrapper for MPI_Gatherv.
Definition wrapper.cpp:342
void Probe(int source, int tag, MPI_Comm comm, MPI_Status *status)
MPI wrapper for MPI_Probe.
Definition wrapper.cpp:201
void Barrier(MPI_Comm comm)
MPI wrapper for MPI_Barrier.
Definition wrapper.cpp:194
void File_close(MPI_File *fh)
MPI wrapper for MPI_File_close.
Definition wrapper.cpp:305
void File_read(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status)
MPI wrapper for MPI_File_read.
Definition wrapper.cpp:272
void Allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, const int recvcounts[], const int displs[], MPI_Datatype recvtype, MPI_Comm comm)
MPI wrapper for MPI_Allgatherv.
Definition wrapper.cpp:149
const std::vector< std::string > & get_possible_keys()
return all possible keys for the internal timers
Definition wrapper.cpp:60
void register_time(std::string timername, f64 time)
Register a timer value.
Definition wrapper.cpp:33
f64 get_timer(std::string timername)
get a timer value
Definition wrapper.cpp:44
void File_write_at(MPI_File fh, MPI_Offset offset, const void *buf, int count, MPI_Datatype datatype, MPI_Status *status)
MPI wrapper for MPI_File_write_at.
Definition wrapper.cpp:279
void File_open(MPI_Comm comm, const char *filename, int amode, MPI_Info info, MPI_File *fh)
MPI wrapper for MPI_File_open.
Definition wrapper.cpp:312
void Allreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
MPI wrapper for MPI_Allreduce.
Definition wrapper.cpp:119
void Waitall(int count, MPI_Request array_of_requests[], MPI_Status *array_of_statuses)
MPI wrapper for MPI_Waitall.
Definition wrapper.cpp:187
void Wait(MPI_Request *request, MPI_Status *status)
MPI wrapper for MPI_Wait.
Definition wrapper.cpp:180
void Type_size(MPI_Datatype type, int *size)
MPI wrapper for MPI_Type_size.
Definition wrapper.cpp:249
const std::unordered_map< std::string, f64 > & get_timers()
return all internal timers
Definition wrapper.cpp:46
void Gather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
MPI wrapper for MPI_Gather.
Definition wrapper.cpp:326
void File_write(MPI_File fh, const void *buf, int count, MPI_Datatype datatype, MPI_Status *status)
MPI wrapper for MPI_File_write.
Definition wrapper.cpp:264
void Test(MPI_Request *request, int *flag, MPI_Status *status)
MPI wrapper for MPI_Test.
Definition wrapper.cpp:319
void Allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm)
MPI wrapper for MPI_Allgather.
Definition wrapper.cpp:133
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.
Definition wrapper.cpp:85
void File_read_at(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status)
MPI wrapper for MPI_File_read_at.
Definition wrapper.cpp:292
void File_write_all(MPI_File fh, const void *buf, int count, MPI_Datatype datatype, MPI_Status *status)
MPI wrapper for MPI_File_write_all.
Definition wrapper.cpp:256