1 /* Copyright (c) 2007, 2009, 2010. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
11 #include "xbt/xbt_os_time.h"
12 #include "simgrid/simix.h"
13 #include "smpi/smpi.h"
14 #include "smpi/smpif.h"
15 #include "smpi/smpi_cocci.h"
16 #include "instr/instr_private.h"
18 struct s_smpi_process_data;
19 typedef struct s_smpi_process_data *smpi_process_data_t;
21 #define PERSISTENT 0x1
22 #define NON_PERSISTENT 0x2
26 typedef struct s_smpi_mpi_request {
43 } s_smpi_mpi_request_t;
45 void smpi_process_init(int *argc, char ***argv);
46 void smpi_process_destroy(void);
47 void smpi_process_finalize(void);
49 smpi_process_data_t smpi_process_data(void);
50 smpi_process_data_t smpi_process_remote_data(int index);
51 void smpi_process_set_user_data(void *);
52 void* smpi_process_get_user_data(void);
53 int smpi_process_count(void);
54 smx_rdv_t smpi_process_mailbox(void);
55 smx_rdv_t smpi_process_remote_mailbox(int index);
56 smx_rdv_t smpi_process_mailbox_small(void);
57 smx_rdv_t smpi_process_remote_mailbox_small(int index);
58 xbt_os_timer_t smpi_process_timer(void);
59 void smpi_process_simulated_start(void);
60 double smpi_process_simulated_elapsed(void);
62 void print_request(const char *message, MPI_Request request);
64 void smpi_global_init(void);
65 void smpi_global_destroy(void);
67 size_t smpi_datatype_size(MPI_Datatype datatype);
68 size_t smpi_datatype_contiguous(MPI_Datatype datatype);
69 size_t smpi_datatype_block_stride(MPI_Datatype datatype);
70 size_t smpi_datatype_block_length(MPI_Datatype datatype);
71 size_t smpi_datatype_block_count(MPI_Datatype datatype);
72 MPI_Aint smpi_datatype_lb(MPI_Datatype datatype);
73 MPI_Aint smpi_datatype_ub(MPI_Datatype datatype);
74 int smpi_datatype_extent(MPI_Datatype datatype, MPI_Aint * lb,
76 int smpi_datatype_copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
77 void *recvbuf, int recvcount,
78 MPI_Datatype recvtype);
79 int smpi_datatype_contiguous(int count, MPI_Datatype old_type,
80 MPI_Datatype* new_type);
81 int smpi_datatype_vector(int count, int blocklen, int stride,
82 MPI_Datatype old_type, MPI_Datatype* new_type);
84 int smpi_datatype_hvector(int count, int blocklen, MPI_Aint stride,
85 MPI_Datatype old_type, MPI_Datatype* new_type);
86 int smpi_datatype_indexed(int count, int* blocklens, int* indices,
87 MPI_Datatype old_type, MPI_Datatype* new_type);
88 int smpi_datatype_hindexed(int count, int* blocklens, MPI_Aint* indices,
89 MPI_Datatype old_type, MPI_Datatype* new_type);
90 int smpi_datatype_struct(int count, int* blocklens, MPI_Aint* indices,
91 MPI_Datatype* old_types, MPI_Datatype* new_type);
92 void smpi_datatype_create(MPI_Datatype* new_type, int size, int flags);
93 void smpi_datatype_free(MPI_Datatype* type);
94 void smpi_datatype_commit(MPI_Datatype* datatype);
98 MPI_Op smpi_op_new(MPI_User_function * function, int commute);
99 void smpi_op_destroy(MPI_Op op);
100 void smpi_op_apply(MPI_Op op, void *invec, void *inoutvec, int *len,
101 MPI_Datatype * datatype);
103 MPI_Group smpi_group_new(int size);
104 void smpi_group_destroy(MPI_Group group);
105 void smpi_group_set_mapping(MPI_Group group, int index, int rank);
106 int smpi_group_index(MPI_Group group, int rank);
107 int smpi_group_rank(MPI_Group group, int index);
108 int smpi_group_use(MPI_Group group);
109 int smpi_group_unuse(MPI_Group group);
110 int smpi_group_size(MPI_Group group);
111 int smpi_group_compare(MPI_Group group1, MPI_Group group2);
113 MPI_Comm smpi_comm_new(MPI_Group group);
114 void smpi_comm_destroy(MPI_Comm comm);
115 MPI_Group smpi_comm_group(MPI_Comm comm);
116 int smpi_comm_size(MPI_Comm comm);
117 void smpi_comm_get_name(MPI_Comm comm, char* name, int* len);
118 int smpi_comm_rank(MPI_Comm comm);
119 MPI_Comm smpi_comm_split(MPI_Comm comm, int color, int key);
121 MPI_Request smpi_mpi_send_init(void *buf, int count, MPI_Datatype datatype,
122 int dst, int tag, MPI_Comm comm);
123 MPI_Request smpi_mpi_recv_init(void *buf, int count, MPI_Datatype datatype,
124 int src, int tag, MPI_Comm comm);
125 void smpi_mpi_start(MPI_Request request);
126 void smpi_mpi_startall(int count, MPI_Request * requests);
127 void smpi_mpi_request_free(MPI_Request * request);
128 MPI_Request smpi_isend_init(void *buf, int count, MPI_Datatype datatype,
129 int dst, int tag, MPI_Comm comm);
130 MPI_Request smpi_mpi_isend(void *buf, int count, MPI_Datatype datatype,
131 int dst, int tag, MPI_Comm comm);
132 MPI_Request smpi_irecv_init(void *buf, int count, MPI_Datatype datatype,
133 int src, int tag, MPI_Comm comm);
134 MPI_Request smpi_mpi_irecv(void *buf, int count, MPI_Datatype datatype,
135 int src, int tag, MPI_Comm comm);
136 void smpi_mpi_recv(void *buf, int count, MPI_Datatype datatype, int src,
137 int tag, MPI_Comm comm, MPI_Status * status);
138 void smpi_mpi_send(void *buf, int count, MPI_Datatype datatype, int dst,
139 int tag, MPI_Comm comm);
140 void smpi_mpi_sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
141 int dst, int sendtag, void *recvbuf, int recvcount,
142 MPI_Datatype recvtype, int src, int recvtag,
143 MPI_Comm comm, MPI_Status * status);
144 int smpi_mpi_test(MPI_Request * request, MPI_Status * status);
145 int smpi_mpi_testany(int count, MPI_Request requests[], int *index,
146 MPI_Status * status);
147 int smpi_mpi_testall(int count, MPI_Request requests[],
148 MPI_Status status[]);
149 void smpi_mpi_probe(int source, int tag, MPI_Comm comm, MPI_Status* status);
150 MPI_Request smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag,
152 int smpi_mpi_get_count(MPI_Status * status, MPI_Datatype datatype);
153 void smpi_mpi_wait(MPI_Request * request, MPI_Status * status);
154 int smpi_mpi_waitany(int count, MPI_Request requests[],
155 MPI_Status * status);
156 void smpi_mpi_waitall(int count, MPI_Request requests[],
157 MPI_Status status[]);
158 int smpi_mpi_waitsome(int incount, MPI_Request requests[], int *indices,
159 MPI_Status status[]);
160 void smpi_mpi_bcast(void *buf, int count, MPI_Datatype datatype, int root,
162 void smpi_mpi_barrier(MPI_Comm comm);
163 void smpi_mpi_gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
164 void *recvbuf, int recvcount, MPI_Datatype recvtype,
165 int root, MPI_Comm comm);
166 void smpi_mpi_gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
167 void *recvbuf, int *recvcounts, int *displs,
168 MPI_Datatype recvtype, int root, MPI_Comm comm);
169 void smpi_mpi_allgather(void *sendbuf, int sendcount,
170 MPI_Datatype sendtype, void *recvbuf,
171 int recvcount, MPI_Datatype recvtype,
173 void smpi_mpi_allgatherv(void *sendbuf, int sendcount,
174 MPI_Datatype sendtype, void *recvbuf,
175 int *recvcounts, int *displs,
176 MPI_Datatype recvtype, MPI_Comm comm);
177 void smpi_mpi_scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
178 void *recvbuf, int recvcount, MPI_Datatype recvtype,
179 int root, MPI_Comm comm);
180 void smpi_mpi_scatterv(void *sendbuf, int *sendcounts, int *displs,
181 MPI_Datatype sendtype, void *recvbuf, int recvcount,
182 MPI_Datatype recvtype, int root, MPI_Comm comm);
183 void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count,
184 MPI_Datatype datatype, MPI_Op op, int root,
186 void smpi_mpi_allreduce(void *sendbuf, void *recvbuf, int count,
187 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
188 void smpi_mpi_scan(void *sendbuf, void *recvbuf, int count,
189 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
191 void nary_tree_bcast(void *buf, int count, MPI_Datatype datatype, int root,
192 MPI_Comm comm, int arity);
193 void nary_tree_barrier(MPI_Comm comm, int arity);
195 int smpi_coll_tuned_alltoall_bruck(void *sendbuf, int sendcount,
196 MPI_Datatype sendtype, void *recvbuf,
197 int recvcount, MPI_Datatype recvtype,
199 int smpi_coll_tuned_alltoall_basic_linear(void *sendbuf, int sendcount,
200 MPI_Datatype sendtype,
201 void *recvbuf, int recvcount,
202 MPI_Datatype recvtype,
204 int smpi_coll_tuned_alltoall_pairwise(void *sendbuf, int sendcount,
205 MPI_Datatype sendtype, void *recvbuf,
206 int recvcount, MPI_Datatype recvtype,
208 int smpi_coll_basic_alltoallv(void *sendbuf, int *sendcounts,
209 int *senddisps, MPI_Datatype sendtype,
210 void *recvbuf, int *recvcounts,
211 int *recvdisps, MPI_Datatype recvtype,
215 void smpi_bench_destroy(void);
216 void smpi_bench_begin(void);
217 void smpi_bench_end(void);
218 void smpi_execute_flops(double flops);
221 void mpi_init__(int*);
222 void mpi_finalize__(int*);
223 void mpi_abort__(int* comm, int* errorcode, int* ierr);
224 void mpi_comm_rank__(int* comm, int* rank, int* ierr);
225 void mpi_comm_size__(int* comm, int* size, int* ierr);
226 double mpi_wtime__(void);
228 void mpi_comm_dup__(int* comm, int* newcomm, int* ierr);
229 void mpi_comm_split__(int* comm, int* color, int* key, int* comm_out, int* ierr);
231 void mpi_send_init__(void *buf, int* count, int* datatype, int* dst, int* tag,
232 int* comm, int* request, int* ierr);
233 void mpi_isend__(void *buf, int* count, int* datatype, int* dst,
234 int* tag, int* comm, int* request, int* ierr);
235 void mpi_send__(void* buf, int* count, int* datatype, int* dst,
236 int* tag, int* comm, int* ierr);
237 void mpi_recv_init__(void *buf, int* count, int* datatype, int* src, int* tag,
238 int* comm, int* request, int* ierr);
239 void mpi_irecv__(void *buf, int* count, int* datatype, int* src, int* tag,
240 int* comm, int* request, int* ierr);
241 void mpi_recv__(void* buf, int* count, int* datatype, int* src,
242 int* tag, int* comm, MPI_Status* status, int* ierr);
243 void mpi_start__(int* request, int* ierr);
244 void mpi_startall__(int* count, int* requests, int* ierr);
245 void mpi_wait__(int* request, MPI_Status* status, int* ierr);
246 void mpi_waitany__(int* count, int* requests, int* index, MPI_Status* status, int* ierr);
247 void mpi_waitall__(int* count, int* requests, MPI_Status* status, int* ierr);
249 void mpi_barrier__(int* comm, int* ierr);
250 void mpi_bcast__(void* buf, int* count, int* datatype, int* root, int* comm, int* ierr);
251 void mpi_reduce__(void* sendbuf, void* recvbuf, int* count,
252 int* datatype, int* op, int* root, int* comm, int* ierr);
253 void mpi_allreduce__(void* sendbuf, void* recvbuf, int* count, int* datatype,
254 int* op, int* comm, int* ierr);
255 void mpi_scatter__(void* sendbuf, int* sendcount, int* sendtype,
256 void* recvbuf, int* recvcount, int* recvtype,
257 int* root, int* comm, int* ierr);
258 void mpi_gather__(void* sendbuf, int* sendcount, int* sendtype,
259 void* recvbuf, int* recvcount, int* recvtype,
260 int* root, int* comm, int* ierr);
261 void mpi_allgather__(void* sendbuf, int* sendcount, int* sendtype,
262 void* recvbuf, int* recvcount, int* recvtype,
263 int* comm, int* ierr);
264 void mpi_scan__(void* sendbuf, void* recvbuf, int* count, int* datatype,
265 int* op, int* comm, int* ierr);
266 void mpi_alltoall__(void* sendbuf, int* sendcount, int* sendtype,
267 void* recvbuf, int* recvcount, int* recvtype, int* comm, int* ierr);