|
| 1 | +#ifndef SC__PRIMITIVES_MPI_H__ |
| 2 | +#define SC__PRIMITIVES_MPI_H__ |
| 3 | +/** |
| 4 | + * \file |
| 5 | + * Session C runtime library MPI backend (libsc-mpi) |
| 6 | + * communication primitives module. |
| 7 | + */ |
| 8 | + |
| 9 | +#include <stdarg.h> |
| 10 | + |
| 11 | +#include "sc/types-mpi.h" |
| 12 | + |
| 13 | +#define SC_REQ_MGR_SEND 0 |
| 14 | +#define SC_REQ_MGR_RECV 1 |
| 15 | + |
| 16 | +/** |
| 17 | + * \brief Send integer. |
| 18 | + * |
| 19 | + * @param[in] vals Values to send |
| 20 | + * @param[in] count Number of elements to send |
| 21 | + * @param[in] r Role to send to |
| 22 | + * @param[in] label Message label |
| 23 | + * |
| 24 | + * \returns SC_SUCCESS (==MPI_SUCCESS) if successful. |
| 25 | + */ |
| 26 | +int send_int(int *vals, int count, role *r, int label); |
| 27 | + |
| 28 | + |
| 29 | +/** |
| 30 | + * \brief Receive integer (pre-allocated). |
| 31 | + * |
| 32 | + * @param[out] vals Pointer to variable storing recevied value |
| 33 | + * @param[in] count Number of elements to receive |
| 34 | + * @param[in] r Role to receive from |
| 35 | + * @param[in] match_label Message label to match |
| 36 | + * |
| 37 | + * \returns SC_SUCCESS (==MPI_SUCCESS) if successful. |
| 38 | + */ |
| 39 | +int recv_int(int *vals, int count, role *r, int match_label); |
| 40 | + |
| 41 | + |
| 42 | +/** |
| 43 | + * \brief All-Broadcast integer. |
| 44 | + * |
| 45 | + * @param[in,out] vals Value to send |
| 46 | + * @param[in] count Number of elements to send/receive |
| 47 | + * @param[in] g Group role to broadcast to |
| 48 | + * |
| 49 | + * \returns SC_SUCCESS (==MPI_SUCCESS) if successful. |
| 50 | + */ |
| 51 | +int alltoall_int(int *vals, int count, role *g); |
| 52 | + |
| 53 | + |
| 54 | +/** |
| 55 | + * \brief Send double. |
| 56 | + * |
| 57 | + * @param[in] vals Values to send |
| 58 | + * @param[in] count Number of elements to send |
| 59 | + * @param[in] r Role to send to |
| 60 | + * @param[in] label Message label |
| 61 | + * |
| 62 | + * \returns SC_SUCCESS (==MPI_SUCCESS) if successful. |
| 63 | + */ |
| 64 | +int send_double(double *vals, int count, role *r, int label); |
| 65 | + |
| 66 | + |
| 67 | +/** |
| 68 | + * \brief Receive double (pre-allocated). |
| 69 | + * |
| 70 | + * @param[out] vals Pointer to variable storing recevied value |
| 71 | + * @param[in] count Number of elements to receive |
| 72 | + * @param[in] r Role to receive from |
| 73 | + * @param[in] match_label Message label to match |
| 74 | + * |
| 75 | + * \returns SC_SUCCESS (==MPI_SUCCESS) if successful. |
| 76 | + */ |
| 77 | +int recv_double(double *vals, int count, role *r, int match_label); |
| 78 | + |
| 79 | + |
| 80 | +/** |
| 81 | + * \brief All-Broadcast integer. |
| 82 | + * |
| 83 | + * @param[in,out] vals Value to send |
| 84 | + * @param[in] count Number of elements to send/receive |
| 85 | + * @param[in] g Group role to broadcast to |
| 86 | + * |
| 87 | + * \returns SC_SUCCESS (==MPI_SUCCESS) if successful. |
| 88 | + */ |
| 89 | +int alltoall_double(double *vals, int count, role *g); |
| 90 | + |
| 91 | + |
| 92 | +/** |
| 93 | + * \brief Barrier synchronisation. |
| 94 | + * |
| 95 | + * @param[in] s Session to perform barrier synchronisation on |
| 96 | + * |
| 97 | + * \returns SC_SUCCESS (==MPI_SUCCESS) if successful. |
| 98 | + */ |
| 99 | +int barrier(session *s, int buffersync); |
| 100 | + |
| 101 | +#endif // SC__PRIMITIVES_MPI_H_ |
0 commit comments