Logo AND Algorithmique Numérique Distribuée

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