Open t-hishinuma opened 3 years ago
interface idea
test_dot(...){
monolish::mpi::comm &comm = monolish::mpi::get_instance();
....
return comm.Allreduce<double>(ans);
}
int main(argc, argv){
monolish::mpi::comm comm; // singleton
//or comm(external_comm);
comm.Init(argc, argv);
....
ans = test_dot(x, y); //dont need comm
....
comm.Finalize();
}
The comm class should be a singleton. In monolish, only one comm is created per process. There is not need to pass comm to functions.
class interface idea
class monolish::mpi::comm{
private:
MPI_COMM COMM;
comm() = default;
~comm() {};
public:
comm(const comm &) = delete;
comm &operator=(const comm &) = delete;
comm(comm &&) = delete;
comm &operator=(comm &&) = delete;
static comm &get_instance() {
static comm instance;
return comm;
}
void Init(.....);
void Finalize();
double Allreduce(double val);
float Allreduce(float val);
....
MPI program need:
#include "monolish_mpi.hpp"
monolish_*_mpi.so
Remove "request" from "waitall" and wait for all communications at once.
in monolish::mpi