Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
f6f07a6b534e07ec7b0ebf70a5bc76941e7d244d
[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 #define MPI_ANY_TAG -1
12
13 // errorcodes
14 #define MPI_SUCCESS     0
15 #define MPI_ERR_COMM    1
16 #define MPI_ERR_ARG     2
17 #define MPI_ERR_TYPE    3
18 #define MPI_ERR_REQUEST 4
19 #define MPI_ERR_INTERN  5
20 #define MPI_ERR_COUNT   6
21 #define MPI_ERR_RANK    7
22 #define MPI_ERR_TAG     8
23
24 // MPI_Comm
25 typedef struct smpi_mpi_communicator_t *smpi_mpi_communicator_t;
26 typedef smpi_mpi_communicator_t MPI_Comm;
27
28 // MPI_Datatype
29 typedef struct smpi_mpi_datatype_t *smpi_mpi_datatype_t;
30 typedef smpi_mpi_datatype_t MPI_Datatype;
31
32 // MPI_Request
33 typedef struct smpi_mpi_request_t *smpi_mpi_request_t;
34 typedef smpi_mpi_request_t MPI_Request;
35
36 // MPI_Op
37 typedef struct smpi_mpi_op_t *smpi_mpi_op_t;
38 typedef smpi_mpi_op_t MPI_Op;
39
40 // MPI_Status
41 // FIXME: status is kind of an odd duck, is this required by the standard?
42 struct smpi_mpi_status_t {
43   int MPI_SOURCE;
44   int MPI_TAG;
45   int MPI_ERROR;
46 };
47 typedef struct smpi_mpi_status_t smpi_mpi_status_t;
48 typedef smpi_mpi_status_t MPI_Status;
49
50 // global SMPI data structure
51 typedef struct smpi_mpi_global_t {
52
53         smpi_mpi_communicator_t mpi_comm_world;
54
55         smpi_mpi_datatype_t     mpi_byte;
56         smpi_mpi_datatype_t     mpi_int;
57         smpi_mpi_datatype_t     mpi_double;
58
59         smpi_mpi_op_t           mpi_land;
60         smpi_mpi_op_t           mpi_sum;
61
62 } s_smpi_mpi_global_t;
63 typedef struct 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