Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
374382dc3be87bf12e22637fcba0c391f9d1cfdf
[simgrid.git] / src / smpi / include / smpi.h
1 #define SMPI_DEFAULT_SPEED 100
2
3 #define SMPI_RAND_SEED 5
4
5 #define MPI_ANY_SOURCE -1
6
7 // errorcodes
8 #define MPI_SUCCESS     0
9 #define MPI_ERR_COMM    1
10 #define MPI_ERR_ARG     2
11 #define MPI_ERR_TYPE    3
12 #define MPI_ERR_REQUEST 4
13 #define MPI_ERR_INTERN  5
14 #define MPI_ERR_COUNT   6
15 #define MPI_ERR_RANK    7
16 #define MPI_ERR_TAG     8
17
18 #include <stdlib.h>
19
20 #include <simix/simix.h>
21
22 // MPI_Comm
23 struct smpi_mpi_communicator_t {
24   int size;
25   int barrier;
26   smx_mutex_t barrier_mutex;
27   smx_cond_t barrier_cond;
28   smx_host_t *hosts;
29   smx_process_t *processes;
30 };
31 typedef struct smpi_mpi_communicator_t smpi_mpi_communicator_t;
32 typedef smpi_mpi_communicator_t *MPI_Comm;
33 extern smpi_mpi_communicator_t smpi_mpi_comm_world;
34 #define MPI_COMM_WORLD (&smpi_mpi_comm_world)
35
36 // MPI_Status
37 struct smpi_mpi_status_t {
38   int MPI_SOURCE;
39 };
40 typedef struct smpi_mpi_status_t smpi_mpi_status_t;
41 typedef smpi_mpi_status_t MPI_Status;
42 extern smpi_mpi_status_t smpi_mpi_status_ignore;
43 #define MPI_STATUS_IGNORE (&smpi_mpi_status_ignore)
44
45 // MPI_Datatype
46 struct smpi_mpi_datatype_t {
47   size_t size;
48 };
49 typedef struct smpi_mpi_datatype_t smpi_mpi_datatype_t;
50 typedef smpi_mpi_datatype_t *MPI_Datatype;
51 // FIXME: add missing datatypes
52 extern smpi_mpi_datatype_t smpi_mpi_byte;
53 #define MPI_BYTE (&smpi_mpi_byte)
54 extern smpi_mpi_datatype_t smpi_mpi_int;
55 #define MPI_INT (&smpi_mpi_int)
56 extern smpi_mpi_datatype_t smpi_mpi_double;
57 #define MPI_DOUBLE (&smpi_mpi_double)
58
59 // MPI_Request
60 struct smpi_mpi_request_t {
61   void *buf;
62   int count;
63   smpi_mpi_datatype_t *datatype;
64   int src;
65   int dst;
66   int tag;
67   smpi_mpi_communicator_t *comm;
68   short int completed;
69   xbt_fifo_t waitlist;
70 };
71 typedef struct smpi_mpi_request_t smpi_mpi_request_t;
72 typedef smpi_mpi_request_t *MPI_Request;
73
74 // MPI_Op
75 struct smpi_mpi_op_t {
76   void (*func)(void *x, void *y, void *z);
77 };
78 typedef struct smpi_mpi_op_t smpi_mpi_op_t;
79 typedef smpi_mpi_op_t *MPI_Op;
80 extern smpi_mpi_op_t smpi_mpi_land;
81 #define MPI_LAND (&smpi_mpi_land)
82 extern smpi_mpi_op_t smpi_mpi_sum;
83 #define MPI_SUM (&smpi_mpi_sum)
84
85 // smpi_received_message_t
86 struct smpi_received_message_t {
87         void *buf;
88         smpi_mpi_communicator_t *comm;
89         int src;
90         int dst;
91         int tag;
92 };
93 typedef struct smpi_received_message_t smpi_received_message_t;
94
95 // smpi functions
96 extern int smpi_simulated_main(int argc, char **argv);
97 unsigned int smpi_sleep(unsigned int);
98 void smpi_exit(int);