Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

impl. C++ template MPI Library #51

Open
14 of 21 tasks
t-hishinuma opened this issue May 12, 2021 · 4 comments
Open
14 of 21 tasks

impl. C++ template MPI Library #51

t-hishinuma opened this issue May 12, 2021 · 4 comments
Labels

Comments

@t-hishinuma
Copy link
Contributor

t-hishinuma commented May 12, 2021

in monolish::mpi

  • MPI_Allgatherv();
  • MPI_Alloc_mem();
  • MPI_Allreduce();
  • MPI_Alltoall();
  • MPI_Barrier();
  • MPI_Comm_rank();
  • MPI_Comm_size();
  • MPI_Finalize();
  • MPI_Get_count();
  • MPI_Init();
  • MPI_Initialized();
  • MPI_recv();
  • MPI_send();
  • MPI_Irecv();
  • MPI_Isend();
  • MPI_Scatterv();
  • MPI_Waitall();
  • MPI_Bcast()
  • MPI_Gather()
  • MPI_Scatter()
  • MPI_Allgather();
@t-hishinuma t-hishinuma changed the title impl. template MPI Library impl. C++ template MPI Library May 12, 2021
@t-hishinuma
Copy link
Contributor Author

t-hishinuma commented May 13, 2021

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.

@t-hishinuma
Copy link
Contributor Author

t-hishinuma commented May 13, 2021

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);
  ....

@t-hishinuma
Copy link
Contributor Author

MPI program need:

  • #include "monolish_mpi.hpp"
  • link monolish_*_mpi.so

@t-hishinuma
Copy link
Contributor Author

Remove "request" from "waitall" and wait for all communications at once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant