forked from hxmhuang/OpenArray_Dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMPI.hpp
More file actions
63 lines (45 loc) · 1.18 KB
/
Copy pathMPI.hpp
File metadata and controls
63 lines (45 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
* MPI.hpp
* high-level interface of some useful MPI function
*
=======================================================*/
#ifndef __MPI_HPP__
#define __MPI_HPP__
#include "mpi.h"
#include <vector>
#include <iostream>
namespace oa{
class MPI{
MPI_Comm m_comm;
public:
// Constructor
MPI();
// init mpi
void init(int comm, int argc, char** argv);
// init for c-interface
void c_init(MPI_Comm comm, int argc, char** argv);
// mpi finalize
void finalize();
// get mpi_comm
MPI_Comm& comm();
// get mpi rank use default mpi_comm
int rank();
// get mpi rank use comm
int rank(MPI_Comm comm);
// get mpi size use default mpi_comm
int size();
// get mpi use comm
int size(MPI_Comm comm);
// static MPI class
static MPI* global();
// use order_start & order_end to debug
void order_start();
void order_end();
// use pthread to support asynchronous mpi communication
// this feature is not used right now
static void *wait_func(void *arg);
static void wait_begin(std::vector<MPI_Request> *mra, pthread_t * tid);
static void wait_end(pthread_t * tid);
};
}
#endif