Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fe73d2337c842a11aeb3efd77a67d35b13c1d805
[simgrid.git] / include / smpi / smpi.h
1 #ifndef SMPI_H
2 #define SMPI_H
3
4 #include <sys/time.h>
5 #include <xbt/function_types.h>
6
7 #define SMPI_RAND_SEED 5
8
9 #define MPI_ANY_SOURCE -1
10
11 // errorcodes
12 #define MPI_SUCCESS     0
13 #define MPI_ERR_COMM    1
14 #define MPI_ERR_ARG     2
15 #define MPI_ERR_TYPE    3
16 #define MPI_ERR_REQUEST 4
17 #define MPI_ERR_INTERN  5
18 #define MPI_ERR_COUNT   6
19 #define MPI_ERR_RANK    7
20 #define MPI_ERR_TAG     8
21
22 // MPI_Comm
23 typedef struct smpi_mpi_communicator_t *smpi_mpi_communicator_t;
24 typedef smpi_mpi_communicator_t MPI_Comm;
25
26 // MPI_Status
27 struct smpi_mpi_status_t {
28   int MPI_SOURCE;
29 };
30 typedef struct smpi_mpi_status_t smpi_mpi_status_t;
31 typedef smpi_mpi_status_t MPI_Status;
32
33 // MPI_Datatype
34 typedef struct smpi_mpi_datatype_t {
35   size_t size;
36 } s_smpi_mpi_datatype_t;
37 typedef struct smpi_mpi_datatype_t *smpi_mpi_datatype_t;
38 typedef smpi_mpi_datatype_t MPI_Datatype;
39
40 // MPI_Request
41 typedef struct smpi_mpi_request_t *smpi_mpi_request_t;
42 typedef smpi_mpi_request_t MPI_Request;
43
44 // MPI_Op
45 typedef struct smpi_mpi_op_t {
46   void (*func)(void *x, void *y, void *z);
47 } s_smpi_mpi_op_t;
48 typedef struct smpi_mpi_op_t *smpi_mpi_op_t;
49 typedef smpi_mpi_op_t MPI_Op;
50
51 // global SMPI data structure
52 typedef struct SMPI_MPI_Global {
53
54         smpi_mpi_communicator_t mpi_comm_world;
55
56         smpi_mpi_datatype_t     mpi_byte;
57         smpi_mpi_datatype_t     mpi_int;
58         smpi_mpi_datatype_t     mpi_double;
59
60         smpi_mpi_op_t           mpi_land;
61         smpi_mpi_op_t           mpi_sum;
62
63 } s_SMPI_MPI_Global_t, *SMPI_MPI_Global_t;
64 extern SMPI_MPI_Global_t smpi_mpi_global;
65
66 #define MPI_COMM_WORLD    (smpi_mpi_global->mpi_comm_world)
67
68 #define MPI_STATUS_IGNORE NULL
69
70 #define MPI_BYTE          (smpi_mpi_global->mpi_byte)
71 #define MPI_DOUBLE        (smpi_mpi_global->mpi_double)
72 #define MPI_INT           (smpi_mpi_global->mpi_int)
73
74 #define MPI_LAND          (smpi_mpi_global->mpi_land)
75 #define MPI_SUM           (smpi_mpi_glboal->mpi_sum)
76
77 // MPI Functions
78 int MPI_Init(int *argc, char ***argv);
79 int MPI_Finalize(void);
80 int MPI_Abort(MPI_Comm comm, int errorcode);
81 int MPI_Comm_size(MPI_Comm comm, int *size);
82 int MPI_Comm_rank(MPI_Comm comm, int *rank);
83 int MPI_Type_size(MPI_Datatype datatype, size_t *size);
84 int MPI_Barrier(MPI_Comm comm);
85 int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Request *request);
86 int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status *status);
87 int MPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request *request);
88 int MPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
89
90 // smpi functions
91 XBT_IMPORT_NO_EXPORT(int) smpi_simulated_main(int argc, char **argv);
92 unsigned int smpi_sleep(unsigned int);
93 void smpi_exit(int);
94 int smpi_gettimeofday(struct timeval *tv, struct timezone *tz);
95
96 #endif