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 {
39 } s_smpi_mpi_request_t;
41 void smpi_process_init(int *argc, char ***argv);
42 void smpi_process_destroy(void);
43 void smpi_process_finalize(void);
45 smpi_process_data_t smpi_process_data(void);
46 smpi_process_data_t smpi_process_remote_data(int index);
47 void smpi_process_set_user_data(void *);
48 void* smpi_process_get_user_data(void);
49 int smpi_process_count(void);
50 smx_rdv_t smpi_process_mailbox(void);
51 smx_rdv_t smpi_process_remote_mailbox(int index);
52 smx_rdv_t smpi_process_mailbox_small(void);
53 smx_rdv_t smpi_process_remote_mailbox_small(int index);
54 xbt_os_timer_t smpi_process_timer(void);
55 void smpi_process_simulated_start(void);
56 double smpi_process_simulated_elapsed(void);
58 void print_request(const char *message, MPI_Request request);
60 void smpi_global_init(void);
61 void smpi_global_destroy(void);
63 size_t smpi_datatype_size(MPI_Datatype datatype);
64 MPI_Aint smpi_datatype_lb(MPI_Datatype datatype);
65 MPI_Aint smpi_datatype_ub(MPI_Datatype datatype);
66 int smpi_datatype_extent(MPI_Datatype datatype, MPI_Aint * lb,
68 int smpi_datatype_copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
69 void *recvbuf, int recvcount,
70 MPI_Datatype recvtype);
72 MPI_Op smpi_op_new(MPI_User_function * function, int commute);
73 void smpi_op_destroy(MPI_Op op);
74 void smpi_op_apply(MPI_Op op, void *invec, void *inoutvec, int *len,
75 MPI_Datatype * datatype);
77 MPI_Group smpi_group_new(int size);
78 void smpi_group_destroy(MPI_Group group);
79 void smpi_group_set_mapping(MPI_Group group, int index, int rank);
80 int smpi_group_index(MPI_Group group, int rank);
81 int smpi_group_rank(MPI_Group group, int index);
82 int smpi_group_use(MPI_Group group);
83 int smpi_group_unuse(MPI_Group group);
84 int smpi_group_size(MPI_Group group);
85 int smpi_group_compare(MPI_Group group1, MPI_Group group2);
87 MPI_Comm smpi_comm_new(MPI_Group group);
88 void smpi_comm_destroy(MPI_Comm comm);
89 MPI_Group smpi_comm_group(MPI_Comm comm);
90 int smpi_comm_size(MPI_Comm comm);
91 void smpi_comm_get_name(MPI_Comm comm, char* name, int* len);
92 int smpi_comm_rank(MPI_Comm comm);
93 MPI_Comm smpi_comm_split(MPI_Comm comm, int color, int key);
95 MPI_Request smpi_mpi_send_init(void *buf, int count, MPI_Datatype datatype,
96 int dst, int tag, MPI_Comm comm);
97 MPI_Request smpi_mpi_recv_init(void *buf, int count, MPI_Datatype datatype,
98 int src, int tag, MPI_Comm comm);
99 void smpi_mpi_start(MPI_Request request);
100 void smpi_mpi_startall(int count, MPI_Request * requests);
101 void smpi_mpi_request_free(MPI_Request * request);
102 MPI_Request smpi_isend_init(void *buf, int count, MPI_Datatype datatype,
103 int dst, int tag, MPI_Comm comm);
104 MPI_Request smpi_mpi_isend(void *buf, int count, MPI_Datatype datatype,
105 int dst, int tag, MPI_Comm comm);
106 MPI_Request smpi_irecv_init(void *buf, int count, MPI_Datatype datatype,
107 int src, int tag, MPI_Comm comm);
108 MPI_Request smpi_mpi_irecv(void *buf, int count, MPI_Datatype datatype,
109 int src, int tag, MPI_Comm comm);
110 void smpi_mpi_recv(void *buf, int count, MPI_Datatype datatype, int src,
111 int tag, MPI_Comm comm, MPI_Status * status);
112 void smpi_mpi_send(void *buf, int count, MPI_Datatype datatype, int dst,
113 int tag, MPI_Comm comm);
114 void smpi_mpi_sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
115 int dst, int sendtag, void *recvbuf, int recvcount,
116 MPI_Datatype recvtype, int src, int recvtag,
117 MPI_Comm comm, MPI_Status * status);
118 int smpi_mpi_test(MPI_Request * request, MPI_Status * status);
119 int smpi_mpi_testany(int count, MPI_Request requests[], int *index,
120 MPI_Status * status);
121 int smpi_mpi_testall(int count, MPI_Request requests[],
122 MPI_Status status[]);
123 void smpi_mpi_probe(int source, int tag, MPI_Comm comm, MPI_Status* status);
124 MPI_Request smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag,
126 int smpi_mpi_get_count(MPI_Status * status, MPI_Datatype datatype);
127 void smpi_mpi_wait(MPI_Request * request, MPI_Status * status);
128 int smpi_mpi_waitany(int count, MPI_Request requests[],
129 MPI_Status * status);
130 void smpi_mpi_waitall(int count, MPI_Request requests[],
131 MPI_Status status[]);
132 int smpi_mpi_waitsome(int incount, MPI_Request requests[], int *indices,
133 MPI_Status status[]);
134 void smpi_mpi_bcast(void *buf, int count, MPI_Datatype datatype, int root,
136 void smpi_mpi_barrier(MPI_Comm comm);
137 void smpi_mpi_gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
138 void *recvbuf, int recvcount, MPI_Datatype recvtype,
139 int root, MPI_Comm comm);
140 void smpi_mpi_gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
141 void *recvbuf, int *recvcounts, int *displs,
142 MPI_Datatype recvtype, int root, MPI_Comm comm);
143 void smpi_mpi_allgather(void *sendbuf, int sendcount,
144 MPI_Datatype sendtype, void *recvbuf,
145 int recvcount, MPI_Datatype recvtype,
147 void smpi_mpi_allgatherv(void *sendbuf, int sendcount,
148 MPI_Datatype sendtype, void *recvbuf,
149 int *recvcounts, int *displs,
150 MPI_Datatype recvtype, MPI_Comm comm);
151 void smpi_mpi_scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
152 void *recvbuf, int recvcount, MPI_Datatype recvtype,
153 int root, MPI_Comm comm);
154 void smpi_mpi_scatterv(void *sendbuf, int *sendcounts, int *displs,
155 MPI_Datatype sendtype, void *recvbuf, int recvcount,
156 MPI_Datatype recvtype, int root, MPI_Comm comm);
157 void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count,
158 MPI_Datatype datatype, MPI_Op op, int root,
160 void smpi_mpi_allreduce(void *sendbuf, void *recvbuf, int count,
161 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
162 void smpi_mpi_scan(void *sendbuf, void *recvbuf, int count,
163 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
165 void nary_tree_bcast(void *buf, int count, MPI_Datatype datatype, int root,
166 MPI_Comm comm, int arity);
167 void nary_tree_barrier(MPI_Comm comm, int arity);
169 int smpi_coll_tuned_alltoall_bruck(void *sendbuf, int sendcount,
170 MPI_Datatype sendtype, void *recvbuf,
171 int recvcount, MPI_Datatype recvtype,
173 int smpi_coll_tuned_alltoall_basic_linear(void *sendbuf, int sendcount,
174 MPI_Datatype sendtype,
175 void *recvbuf, int recvcount,
176 MPI_Datatype recvtype,
178 int smpi_coll_tuned_alltoall_pairwise(void *sendbuf, int sendcount,
179 MPI_Datatype sendtype, void *recvbuf,
180 int recvcount, MPI_Datatype recvtype,
182 int smpi_coll_basic_alltoallv(void *sendbuf, int *sendcounts,
183 int *senddisps, MPI_Datatype sendtype,
184 void *recvbuf, int *recvcounts,
185 int *recvdisps, MPI_Datatype recvtype,
189 void smpi_bench_destroy(void);
190 void smpi_bench_begin(void);
191 void smpi_bench_end(void);
192 void smpi_execute_flops(double flops);
195 void mpi_init__(int*);
196 void mpi_finalize__(int*);
197 void mpi_abort__(int* comm, int* errorcode, int* ierr);
198 void mpi_comm_rank__(int* comm, int* rank, int* ierr);
199 void mpi_comm_size__(int* comm, int* size, int* ierr);
200 double mpi_wtime__(void);
202 void mpi_comm_dup__(int* comm, int* newcomm, int* ierr);
203 void mpi_comm_split__(int* comm, int* color, int* key, int* comm_out, int* ierr);
205 void mpi_send_init__(void *buf, int* count, int* datatype, int* dst, int* tag,
206 int* comm, int* request, int* ierr);
207 void mpi_isend__(void *buf, int* count, int* datatype, int* dst,
208 int* tag, int* comm, int* request, int* ierr);
209 void mpi_send__(void* buf, int* count, int* datatype, int* dst,
210 int* tag, int* comm, int* ierr);
211 void mpi_recv_init__(void *buf, int* count, int* datatype, int* src, int* tag,
212 int* comm, int* request, int* ierr);
213 void mpi_irecv__(void *buf, int* count, int* datatype, int* src, int* tag,
214 int* comm, int* request, int* ierr);
215 void mpi_recv__(void* buf, int* count, int* datatype, int* src,
216 int* tag, int* comm, MPI_Status* status, int* ierr);
217 void mpi_start__(int* request, int* ierr);
218 void mpi_startall__(int* count, int* requests, int* ierr);
219 void mpi_wait__(int* request, MPI_Status* status, int* ierr);
220 void mpi_waitany__(int* count, int* requests, int* index, MPI_Status* status, int* ierr);
221 void mpi_waitall__(int* count, int* requests, MPI_Status* status, int* ierr);
223 void mpi_barrier__(int* comm, int* ierr);
224 void mpi_bcast__(void* buf, int* count, int* datatype, int* root, int* comm, int* ierr);
225 void mpi_reduce__(void* sendbuf, void* recvbuf, int* count,
226 int* datatype, int* op, int* root, int* comm, int* ierr);
227 void mpi_allreduce__(void* sendbuf, void* recvbuf, int* count, int* datatype,
228 int* op, int* comm, int* ierr);
229 void mpi_scatter__(void* sendbuf, int* sendcount, int* sendtype,
230 void* recvbuf, int* recvcount, int* recvtype,
231 int* root, int* comm, int* ierr);
232 void mpi_gather__(void* sendbuf, int* sendcount, int* sendtype,
233 void* recvbuf, int* recvcount, int* recvtype,
234 int* root, int* comm, int* ierr);
235 void mpi_allgather__(void* sendbuf, int* sendcount, int* sendtype,
236 void* recvbuf, int* recvcount, int* recvtype,
237 int* comm, int* ierr);
238 void mpi_scan__(void* sendbuf, void* recvbuf, int* count, int* datatype,
239 int* op, int* comm, int* ierr);
240 void mpi_alltoall__(void* sendbuf, int* sendcount, int* sendtype,
241 void* recvbuf, int* recvcount, int* recvtype, int* comm, int* ierr);