HILA
Loading...
Searching...
No Matches
hilapp_mpi.h
1#ifndef HILA_HILAPP_MPI_H_
2#define HILA_HILAPP_MPI_H_
3
4
5////////////////////////////////////////////////////////////////////////////
6/// This header introduces MPI functions for hilapp, not for final compile
7/// Useful because (statically compiled) hilapp does not automatically know
8/// the location of mpi.h, and saves the trouble of finding it
9////////////////////////////////////////////////////////////////////////////
10
11
12// Selection of MPI datatypes - if needed add here
13enum MPI_Datatype : int {
14 MPI_BYTE,
15 MPI_CHAR,
16 MPI_SHORT,
17 MPI_INT,
18 MPI_LONG,
19 MPI_FLOAT,
20 MPI_DOUBLE,
21 MPI_LONG_DOUBLE,
22 MPI_C_DOUBLE_COMPLEX,
23 MPI_C_FLOAT_COMPLEX,
24 MPI_UNSIGNED,
25 MPI_UNSIGNED_LONG,
26 MPI_INT64_T,
27 MPI_UINT64_T,
28 MPI_2INT,
29 MPI_LONG_INT,
30 MPI_FLOAT_INT,
31 MPI_DOUBLE_INT,
32 MPI_LONG_DOUBLE_INT
33};
34
35enum MPI_Op : int { MPI_SUM, MPI_PROD, MPI_MAX, MPI_MIN, MPI_MAXLOC, MPI_MINLOC };
36
37typedef void *MPI_Comm;
38typedef void *MPI_Request;
39typedef struct ompi_status_public_t MPI_Status;
40typedef void *MPI_Comm;
41typedef int MPI_Fint;
42typedef int MPI_Aint;
43typedef void *MPI_Errhandler;
44#define MPI_IN_PLACE nullptr
45#define MPI_COMM_WORLD nullptr
46#define MPI_STATUS_IGNORE nullptr
47#define MPI_ERRORS_RETURN nullptr
48#define MPI_REQUEST_NULL nullptr
49#define MPI_SUCCESS 1
50
51enum MPI_thread_level : int {
52 MPI_THREAD_SINGLE,
53 MPI_THREAD_FUNNELED,
54 MPI_THREAD_SERIALIZED,
55 MPI_THREAD_MULTIPLE
56};
57
58struct ompi_status_public_t {
59 /* These fields are publicly defined in the MPI specification.
60 User applications may freely read from these fields. */
61 int MPI_SOURCE;
62 int MPI_TAG;
63 int MPI_ERROR;
64 /* The following two fields are internal to the Open MPI
65 implementation and should not be accessed by MPI applications.
66 They are subject to change at any time. These are not the
67 droids you're looking for. */
68 int _cancelled;
69 size_t _ucount;
70};
71
72int MPI_Init(int *argc, char ***argv);
73
74int MPI_Init_thread(int *argc, char ***argv, int threadlevel, int *provided);
75
76int MPI_Comm_rank(MPI_Comm comm, int *rank);
77
78int MPI_Comm_size(MPI_Comm comm, int *size);
79
80int MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *newcomm);
81
82int MPI_Comm_set_errhandler(MPI_Comm comm, MPI_Errhandler errhandler);
83
84int MPI_Bcast(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm);
85
86int MPI_Reduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
87 MPI_Op op, int root, MPI_Comm comm);
88
89int MPI_Ireduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
90 MPI_Op op, int root, MPI_Comm comm, MPI_Request *request);
91
92int MPI_Allreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
93 MPI_Op op, MPI_Comm comm);
94
95int MPI_Iallreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
96 MPI_Op op, MPI_Comm comm, MPI_Request *request);
97
98int MPI_Send(const void *buf, int count, MPI_Datatype datatype, int dest, int tag,
99 MPI_Comm comm);
100
101int MPI_Isend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag,
102 MPI_Comm comm, MPI_Request *request);
103
104int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int source, int tag,
105 MPI_Comm comm, MPI_Status *status);
106
107int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int source, int tag,
108 MPI_Comm comm, MPI_Request *request);
109
110int MPI_Wait(MPI_Request *request, MPI_Status *status);
111
112int MPI_Waitall(int count, MPI_Request array_of_requests[],
113 MPI_Status *array_of_statuses);
114
115int MPI_Barrier(MPI_Comm comm);
116
117int MPI_Ibarrier(MPI_Comm comm, MPI_Request *request);
118
119int MPI_Cancel(MPI_Request *request);
120
121int MPI_Test(MPI_Request *request, int *flag, MPI_Status *status);
122
123int MPI_Test_cancelled(const MPI_Status *status, int *flag);
124
125int MPI_Request_free(MPI_Request *request);
126
127int MPI_Abort(MPI_Comm comm, int errorcode);
128
129MPI_Fint MPI_Comm_c2f(MPI_Comm comm);
130
131int MPI_Finalize();
132
133int MPI_Get_address(const void *location, MPI_Aint *address);
134
135int MPI_Type_create_struct(int count,
136 const int array_of_blocklengths[],
137 const MPI_Aint array_of_displacements[],
138 const MPI_Datatype array_of_types[],
139 MPI_Datatype *newtype);
140
141int MPI_Type_commit(MPI_Datatype *datatype);
142
143typedef void MPI_User_function(void *invec, void *inoutvec, int *len, MPI_Datatype *datatype);
144
145int MPI_Op_create(MPI_User_function *user_fn, int commute, MPI_Op *op);
146
147
148#endif