2 * Copyright 2009-2013 Distene SAS
6 #ifndef __MESHGEMS_MPI_H__
7 #define __MESHGEMS_MPI_H__
9 #define MESHGEMS_MPI_SUCCESS 0
10 #define MESHGEMS_MPI_ERR 1
12 #define MESHGEMS_MPI_ANY_SOURCE -1
14 /* Declare these as int rather than enum to be able to create dynamic types/operations */
16 typedef int meshgems_mpi_datatype;
17 typedef int meshgems_mpi_op;
19 #define meshgems_mpi_datatype_none 0
20 #define meshgems_mpi_datatype_i4 1
21 #define meshgems_mpi_datatype_i8 2
22 #define meshgems_mpi_datatype_r4 3
23 #define meshgems_mpi_datatype_r8 4
24 #define meshgems_mpi_datatype_enum_count 5
26 #define meshgems_mpi_op_none 0
27 #define meshgems_mpi_op_max 1
28 #define meshgems_mpi_op_sum 2
29 #define meshgems_mpi_op_enum_count 3
31 int meshgems_mpi_type_new(int count, int *array_of_blocklengths, long *array_of_displacements,
32 meshgems_mpi_datatype *array_of_types, meshgems_mpi_datatype *newtype);
33 int meshgems_mpi_type_delete(meshgems_mpi_datatype datatype);
35 struct meshgems_mpi_handler_;
36 typedef struct meshgems_mpi_handler_ meshgems_mpi_handler;
38 meshgems_mpi_handler *meshgems_mpi_handler_new(void);
39 void meshgems_mpi_handler_delete(meshgems_mpi_handler *handler);
41 int meshgems_mpi_init(int *argc, char ***argv);
42 int meshgems_mpi_rank(int *r);
43 int meshgems_mpi_size(int *n);
44 int meshgems_mpi_finalize(void);
46 int meshgems_mpi_send(void* buffer, int count, meshgems_mpi_datatype datatype, int dest, int tag);
47 int meshgems_mpi_isend(void* buffer, int count, meshgems_mpi_datatype datatype, int dest, int tag,
48 meshgems_mpi_handler *handler);
49 int meshgems_mpi_wait(meshgems_mpi_handler *handler);
51 int meshgems_mpi_recv(void* buffer, int count, meshgems_mpi_datatype, int src, int tag);
53 int meshgems_mpi_reduce(void *sendbuf, void *recvbuf, int count, meshgems_mpi_datatype datatype,
54 meshgems_mpi_op op, int root);
56 int meshgems_mpi_allreduce(void *sendbuf, void *recvbuf, int count, meshgems_mpi_datatype datatype,
59 int meshgems_mpi_gather(void *sendbuf, int sendcount, meshgems_mpi_datatype sendtype, void *recvbuf,
60 int recvcount, meshgems_mpi_datatype recvtype, int root);
62 int meshgems_mpi_allgather(void *sendbuf, int sendcount, meshgems_mpi_datatype sendtype,
63 void *recvbuf, int recvcount, meshgems_mpi_datatype recvtype);
65 int meshgems_mpi_allgatherv(void *sendbuf, int sendcount, meshgems_mpi_datatype sendtype,
66 void *recvbuf, int *recvcount, int *displs, meshgems_mpi_datatype recvtype);
68 int meshgems_mpi_barrier(void);
70 int meshgems_mpi_abort(int errorcode);