7 #include <xbt/function_types.h>
10 #define SMPI_RAND_SEED 5
11 #define MPI_ANY_SOURCE -1
12 #define MPI_ANY_TAG -1
13 #define MPI_UNDEFINED -1
16 #define MPI_ERR_COMM 1
18 #define MPI_ERR_TYPE 3
19 #define MPI_ERR_REQUEST 4
20 #define MPI_ERR_INTERN 5
21 #define MPI_ERR_COUNT 6
22 #define MPI_ERR_RANK 7
25 typedef struct smpi_mpi_communicator_t *smpi_mpi_communicator_t;
26 typedef smpi_mpi_communicator_t MPI_Comm;
29 typedef struct smpi_mpi_datatype_t *smpi_mpi_datatype_t;
30 typedef smpi_mpi_datatype_t MPI_Datatype;
33 typedef struct smpi_mpi_request_t *smpi_mpi_request_t;
34 typedef smpi_mpi_request_t MPI_Request;
37 typedef struct smpi_mpi_op_t *smpi_mpi_op_t;
38 typedef smpi_mpi_op_t MPI_Op;
41 struct smpi_mpi_status_t {
46 typedef struct smpi_mpi_status_t smpi_mpi_status_t;
47 typedef smpi_mpi_status_t MPI_Status;
49 // global SMPI data structure
50 typedef struct smpi_mpi_global_t {
52 smpi_mpi_communicator_t mpi_comm_world;
54 smpi_mpi_datatype_t mpi_byte;
55 smpi_mpi_datatype_t mpi_char;
56 smpi_mpi_datatype_t mpi_int;
57 smpi_mpi_datatype_t mpi_float;
58 smpi_mpi_datatype_t mpi_double;
60 smpi_mpi_op_t mpi_land;
61 smpi_mpi_op_t mpi_sum;
62 smpi_mpi_op_t mpi_prod;
63 smpi_mpi_op_t mpi_min;
64 smpi_mpi_op_t mpi_max;
66 } s_smpi_mpi_global_t;
67 typedef struct smpi_mpi_global_t *smpi_mpi_global_t;
68 extern smpi_mpi_global_t smpi_mpi_global;
70 #define MPI_COMM_WORLD (smpi_mpi_global->mpi_comm_world)
71 #define MPI_COMM_NULL NULL
73 #define MPI_STATUS_IGNORE NULL
75 #define MPI_BYTE (smpi_mpi_global->mpi_byte)
76 #define MPI_CHAR (smpi_mpi_global->mpi_char)
77 #define MPI_INT (smpi_mpi_global->mpi_int)
78 #define MPI_FLOAT (smpi_mpi_global->mpi_float)
79 #define MPI_DOUBLE (smpi_mpi_global->mpi_double)
81 #define MPI_LAND (smpi_mpi_global->mpi_land)
82 #define MPI_SUM (smpi_mpi_global->mpi_sum)
83 #define MPI_PROD (smpi_mpi_global->mpi_prod)
84 #define MPI_MIN (smpi_mpi_global->mpi_min)
85 #define MPI_MAX (smpi_mpi_global->mpi_max)
88 #define MPI_Init(a, b) SMPI_MPI_Init(a, b)
89 #define MPI_Finalize() SMPI_MPI_Finalize()
90 #define MPI_Abort(a, b) SMPI_MPI_Abort(a, b)
91 #define MPI_Comm_size(a, b) SMPI_MPI_Comm_size(a, b)
92 #define MPI_Comm_rank(a, b) SMPI_MPI_Comm_rank(a, b)
93 #define MPI_Type_size(a, b) SMPI_MPI_Type_size(a, b)
94 #define MPI_Barrier(a) SMPI_MPI_Barrier(a)
95 #define MPI_Irecv(a, b, c, d, e, f, g) SMPI_MPI_Irecv(a, b, c, d, e, f, g)
96 #define MPI_Recv(a, b, c, d, e, f, g) SMPI_MPI_Recv(a, b, c, d, e, f, g)
97 #define MPI_Isend(a, b, c, d, e, f, g) SMPI_MPI_Isend(a, b, c, d, e, f, g)
98 #define MPI_Send(a, b, c, d, e, f) SMPI_MPI_Send(a, b, c, d, e, f)
99 #define MPI_Sendrecv( a, b, c, d, e, f, g, h, i, j, k, l) SMPI_MPI_Sendrecv(a, b, c, d, e, f, g, h, i, j, k, l)
100 #define MPI_Bcast(a, b, c, d, e) SMPI_MPI_Bcast(a, b, c, d, e)
101 #define MPI_Wait(a, b) SMPI_MPI_Wait(a, b)
102 #define MPI_Waitall(a, b, c) SMPI_MPI_Waitall(a, b, c)
103 #define MPI_Waitany(a, b, c, d) SMPI_MPI_Waitany(a, b, c, d)
104 #define MPI_Comm_split(a, b, c, d) SMPI_MPI_Comm_split(a, b, c, d)
105 #define MPI_Wtime() SMPI_MPI_Wtime()
106 #define MPI_Reduce( a, b, c, d, e, f, g) SMPI_MPI_Reduce( a, b, c, d, e, f, g)
107 #define MPI_Allreduce( a, b, c, d, e, f) SMPI_MPI_Allreduce( a, b, c, d, e, f)
108 #define MPI_Scatter( a, b, c, d, e, f, g, h ) SMPI_MPI_Scatter( a, b, c, d, e, f, g, h)
109 #define MPI_Alltoall( a, b, c, d, e, f, g ) SMPI_MPI_Alltoall( a, b, c, d, e, f, g)
112 XBT_PUBLIC(int) SMPI_MPI_Init(int *argc, char ***argv);
113 XBT_PUBLIC(int) SMPI_MPI_Finalize(void);
114 XBT_PUBLIC(int) SMPI_MPI_Abort(MPI_Comm comm, int errorcode);
115 XBT_PUBLIC(int) SMPI_MPI_Comm_size(MPI_Comm comm, int *size);
116 XBT_PUBLIC(int) SMPI_MPI_Comm_rank(MPI_Comm comm, int *rank);
117 XBT_PUBLIC(int) SMPI_MPI_Type_size(MPI_Datatype datatype, size_t * size);
118 XBT_PUBLIC(int) SMPI_MPI_Barrier(MPI_Comm comm);
119 XBT_PUBLIC(int) SMPI_MPI_Irecv(void *buf, int count, MPI_Datatype datatype,
120 int src, int tag, MPI_Comm comm,
121 MPI_Request * request);
122 XBT_PUBLIC(int) SMPI_MPI_Recv(void *buf, int count, MPI_Datatype datatype,
123 int src, int tag, MPI_Comm comm,
124 MPI_Status * status);
125 XBT_PUBLIC(int) SMPI_MPI_Isend(void *buf, int count, MPI_Datatype datatype,
126 int dst, int tag, MPI_Comm comm,
127 MPI_Request * request);
128 XBT_PUBLIC(int) SMPI_MPI_Send(void *buf, int count, MPI_Datatype datatype,
129 int dst, int tag, MPI_Comm comm);
131 XBT_PUBLIC(int) SMPI_MPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag,
132 void *recvbuf, int recvcount, MPI_Datatype recvtype, int source, int recvtag,
133 MPI_Comm comm, MPI_Status *status);
135 XBT_PUBLIC(int) SMPI_MPI_Bcast(void *buf, int count, MPI_Datatype datatype,
136 int root, MPI_Comm comm);
137 XBT_PUBLIC(int) SMPI_MPI_Wait(MPI_Request * request, MPI_Status * status);
138 XBT_PUBLIC(int) SMPI_MPI_Waitall(int count, MPI_Request requests[],
139 MPI_Status status[]);
140 XBT_PUBLIC(int) SMPI_MPI_Waitany(int count, MPI_Request requests[],
141 int *index, MPI_Status status[]);
142 XBT_PUBLIC(int) SMPI_MPI_Comm_split(MPI_Comm comm, int color, int key,
143 MPI_Comm * comm_out);
144 XBT_PUBLIC(double) SMPI_MPI_Wtime(void);
146 XBT_PUBLIC(int) SMPI_MPI_Reduce(void *sendbuf, void *recvbuf, int count,
147 MPI_Datatype datatype, MPI_Op op, int root,
149 XBT_PUBLIC(int) SMPI_MPI_Allreduce(void *sendbuf, void *recvbuf, int count,
150 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
152 XBT_PUBLIC(int) SMPI_MPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype datatype,
153 void *recvbuf, int recvcount, MPI_Datatype recvtype,int root, MPI_Comm comm);
155 XBT_PUBLIC(int) SMPI_MPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype datatype,
156 void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm);
159 XBT_IMPORT_NO_EXPORT(int) smpi_simulated_main(int argc, char **argv);
160 XBT_PUBLIC(unsigned int) smpi_sleep(unsigned int);
161 XBT_PUBLIC(void) smpi_exit(int);
162 XBT_PUBLIC(int) smpi_gettimeofday(struct timeval *tv, struct timezone *tz);
164 XBT_PUBLIC(void) smpi_do_once_1(const char *file, int line);
165 XBT_PUBLIC(int) smpi_do_once_2(void);
166 XBT_PUBLIC(void) smpi_do_once_3(void);
168 #define SMPI_DO_ONCE for (smpi_do_once_1(__FILE__, __LINE__); smpi_do_once_2(); smpi_do_once_3())