Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Offer the possibility to change smpi bandwidth and latency factor into tag config...
[simgrid.git] / src / smpi / private.h
1 /* Copyright (c) 2007, 2009, 2010. The SimGrid Team.
2  * All rights reserved.                                                     */
3
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. */
6
7 #ifndef SMPI_PRIVATE_H
8 #define SMPI_PRIVATE_H
9
10 #include "xbt.h"
11 #include "xbt/xbt_os_time.h"
12 #include "simix/simix.h"
13 #include "smpi/smpi.h"
14 #include "smpi/smpif.h"
15 #include "smpi/smpi_cocci.h"
16 #include "instr/instr_private.h"
17
18 struct s_smpi_process_data;
19 typedef struct s_smpi_process_data *smpi_process_data_t;
20
21 #define PERSISTENT     0x1
22 #define NON_PERSISTENT 0x2
23 #define SEND           0x4
24 #define RECV           0x8
25
26 typedef struct s_smpi_mpi_request {
27   void *buf;
28   size_t size;
29   int src;
30   int dst;
31   int tag;
32   MPI_Comm comm;
33   smx_action_t action;
34   unsigned flags;
35 #ifdef HAVE_TRACING
36   int send;
37   int recv;
38 #endif
39 } s_smpi_mpi_request_t;
40
41 void smpi_process_init(int *argc, char ***argv);
42 void smpi_process_destroy(void);
43 void smpi_process_finalize(void);
44
45 smpi_process_data_t smpi_process_data(void);
46 smpi_process_data_t smpi_process_remote_data(int index);
47 int smpi_process_count(void);
48 smx_rdv_t smpi_process_mailbox(void);
49 smx_rdv_t smpi_process_remote_mailbox(int index);
50 xbt_os_timer_t smpi_process_timer(void);
51 void smpi_process_simulated_start(void);
52 double smpi_process_simulated_elapsed(void);
53
54 void print_request(const char *message, MPI_Request request);
55
56 void smpi_global_init(void);
57 void smpi_global_destroy(void);
58
59 size_t smpi_datatype_size(MPI_Datatype datatype);
60 MPI_Aint smpi_datatype_lb(MPI_Datatype datatype);
61 MPI_Aint smpi_datatype_ub(MPI_Datatype datatype);
62 int smpi_datatype_extent(MPI_Datatype datatype, MPI_Aint * lb,
63                          MPI_Aint * extent);
64 int smpi_datatype_copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
65                        void *recvbuf, int recvcount,
66                        MPI_Datatype recvtype);
67
68 MPI_Op smpi_op_new(MPI_User_function * function, int commute);
69 void smpi_op_destroy(MPI_Op op);
70 void smpi_op_apply(MPI_Op op, void *invec, void *inoutvec, int *len,
71                    MPI_Datatype * datatype);
72
73 MPI_Group smpi_group_new(int size);
74 void smpi_group_destroy(MPI_Group group);
75 void smpi_group_set_mapping(MPI_Group group, int index, int rank);
76 int smpi_group_index(MPI_Group group, int rank);
77 int smpi_group_rank(MPI_Group group, int index);
78 int smpi_group_use(MPI_Group group);
79 int smpi_group_unuse(MPI_Group group);
80 int smpi_group_size(MPI_Group group);
81 int smpi_group_compare(MPI_Group group1, MPI_Group group2);
82
83 MPI_Comm smpi_comm_new(MPI_Group group);
84 void smpi_comm_destroy(MPI_Comm comm);
85 MPI_Group smpi_comm_group(MPI_Comm comm);
86 int smpi_comm_size(MPI_Comm comm);
87 void smpi_comm_get_name(MPI_Comm comm, char* name, int* len);
88 int smpi_comm_rank(MPI_Comm comm);
89 MPI_Comm smpi_comm_split(MPI_Comm comm, int color, int key);
90
91 MPI_Request smpi_mpi_send_init(void *buf, int count, MPI_Datatype datatype,
92                                int dst, int tag, MPI_Comm comm);
93 MPI_Request smpi_mpi_recv_init(void *buf, int count, MPI_Datatype datatype,
94                                int src, int tag, MPI_Comm comm);
95 void smpi_mpi_start(MPI_Request request);
96 void smpi_mpi_startall(int count, MPI_Request * requests);
97 void smpi_mpi_request_free(MPI_Request * request);
98 MPI_Request smpi_isend_init(void *buf, int count, MPI_Datatype datatype,
99                             int dst, int tag, MPI_Comm comm);
100 MPI_Request smpi_mpi_isend(void *buf, int count, MPI_Datatype datatype,
101                            int dst, int tag, MPI_Comm comm);
102 MPI_Request smpi_irecv_init(void *buf, int count, MPI_Datatype datatype,
103                             int src, int tag, MPI_Comm comm);
104 MPI_Request smpi_mpi_irecv(void *buf, int count, MPI_Datatype datatype,
105                            int src, int tag, MPI_Comm comm);
106 void smpi_mpi_recv(void *buf, int count, MPI_Datatype datatype, int src,
107                    int tag, MPI_Comm comm, MPI_Status * status);
108 void smpi_mpi_send(void *buf, int count, MPI_Datatype datatype, int dst,
109                    int tag, MPI_Comm comm);
110 void smpi_mpi_sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
111                        int dst, int sendtag, void *recvbuf, int recvcount,
112                        MPI_Datatype recvtype, int src, int recvtag,
113                        MPI_Comm comm, MPI_Status * status);
114 int smpi_mpi_test(MPI_Request * request, MPI_Status * status);
115 int smpi_mpi_testany(int count, MPI_Request requests[], int *index,
116                      MPI_Status * status);
117 int smpi_mpi_get_count(MPI_Status * status, MPI_Datatype datatype);
118 void smpi_mpi_wait(MPI_Request * request, MPI_Status * status);
119 int smpi_mpi_waitany(int count, MPI_Request requests[],
120                      MPI_Status * status);
121 void smpi_mpi_waitall(int count, MPI_Request requests[],
122                       MPI_Status status[]);
123 int smpi_mpi_waitsome(int incount, MPI_Request requests[], int *indices,
124                       MPI_Status status[]);
125 void smpi_mpi_bcast(void *buf, int count, MPI_Datatype datatype, int root,
126                     MPI_Comm comm);
127 void smpi_mpi_barrier(MPI_Comm comm);
128 void smpi_mpi_gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
129                      void *recvbuf, int recvcount, MPI_Datatype recvtype,
130                      int root, MPI_Comm comm);
131 void smpi_mpi_gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
132                       void *recvbuf, int *recvcounts, int *displs,
133                       MPI_Datatype recvtype, int root, MPI_Comm comm);
134 void smpi_mpi_allgather(void *sendbuf, int sendcount,
135                         MPI_Datatype sendtype, void *recvbuf,
136                         int recvcount, MPI_Datatype recvtype,
137                         MPI_Comm comm);
138 void smpi_mpi_allgatherv(void *sendbuf, int sendcount,
139                          MPI_Datatype sendtype, void *recvbuf,
140                          int *recvcounts, int *displs,
141                          MPI_Datatype recvtype, MPI_Comm comm);
142 void smpi_mpi_scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
143                       void *recvbuf, int recvcount, MPI_Datatype recvtype,
144                       int root, MPI_Comm comm);
145 void smpi_mpi_scatterv(void *sendbuf, int *sendcounts, int *displs,
146                        MPI_Datatype sendtype, void *recvbuf, int recvcount,
147                        MPI_Datatype recvtype, int root, MPI_Comm comm);
148 void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count,
149                      MPI_Datatype datatype, MPI_Op op, int root,
150                      MPI_Comm comm);
151 void smpi_mpi_allreduce(void *sendbuf, void *recvbuf, int count,
152                         MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
153 void smpi_mpi_scan(void *sendbuf, void *recvbuf, int count,
154                    MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
155
156 void nary_tree_bcast(void *buf, int count, MPI_Datatype datatype, int root,
157                      MPI_Comm comm, int arity);
158 void nary_tree_barrier(MPI_Comm comm, int arity);
159
160 int smpi_coll_tuned_alltoall_bruck(void *sendbuf, int sendcount,
161                                    MPI_Datatype sendtype, void *recvbuf,
162                                    int recvcount, MPI_Datatype recvtype,
163                                    MPI_Comm comm);
164 int smpi_coll_tuned_alltoall_basic_linear(void *sendbuf, int sendcount,
165                                           MPI_Datatype sendtype,
166                                           void *recvbuf, int recvcount,
167                                           MPI_Datatype recvtype,
168                                           MPI_Comm comm);
169 int smpi_coll_tuned_alltoall_pairwise(void *sendbuf, int sendcount,
170                                       MPI_Datatype sendtype, void *recvbuf,
171                                       int recvcount, MPI_Datatype recvtype,
172                                       MPI_Comm comm);
173 int smpi_coll_basic_alltoallv(void *sendbuf, int *sendcounts,
174                               int *senddisps, MPI_Datatype sendtype,
175                               void *recvbuf, int *recvcounts,
176                               int *recvdisps, MPI_Datatype recvtype,
177                               MPI_Comm comm);
178
179 // utilities
180 void smpi_bench_destroy(void);
181 void smpi_bench_begin(void);
182 void smpi_bench_end(void);
183
184 // f77 wrappers
185 void mpi_init__(int*);
186 void mpi_finalize__(int*);
187 void mpi_abort__(int* comm, int* errorcode, int* ierr);
188 void mpi_comm_rank__(int* comm, int* rank, int* ierr);
189 void mpi_comm_size__(int* comm, int* size, int* ierr);
190 double mpi_wtime__(void);
191
192 void mpi_comm_dup__(int* comm, int* newcomm, int* ierr);
193 void mpi_comm_split__(int* comm, int* color, int* key, int* comm_out, int* ierr);
194
195 void mpi_send_init__(void *buf, int* count, int* datatype, int* dst, int* tag,
196                      int* comm, int* request, int* ierr);
197 void mpi_isend__(void *buf, int* count, int* datatype, int* dst,
198                  int* tag, int* comm, int* request, int* ierr);
199 void mpi_send__(void* buf, int* count, int* datatype, int* dst,
200                 int* tag, int* comm, int* ierr);
201 void mpi_recv_init__(void *buf, int* count, int* datatype, int* src, int* tag,
202                      int* comm, int* request, int* ierr);
203 void mpi_irecv__(void *buf, int* count, int* datatype, int* src, int* tag,
204                  int* comm, int* request, int* ierr);
205 void mpi_recv__(void* buf, int* count, int* datatype, int* src,
206                 int* tag, int* comm, MPI_Status* status, int* ierr);
207 void mpi_start__(int* request, int* ierr);
208 void mpi_startall__(int* count, int* requests, int* ierr);
209 void mpi_wait__(int* request, MPI_Status* status, int* ierr);
210 void mpi_waitany__(int* count, int* requests, int* index, MPI_Status* status, int* ierr);
211 void mpi_waitall__(int* count, int* requests, MPI_Status* status, int* ierr);
212
213 void mpi_barrier__(int* comm, int* ierr);
214 void mpi_bcast__(void* buf, int* count, int* datatype, int* root, int* comm, int* ierr);
215 void mpi_reduce__(void* sendbuf, void* recvbuf, int* count,
216                   int* datatype, int* op, int* root, int* comm, int* ierr);
217 void mpi_allreduce__(void* sendbuf, void* recvbuf, int* count, int* datatype,
218                      int* op, int* comm, int* ierr);
219 void mpi_scatter__(void* sendbuf, int* sendcount, int* sendtype,
220                    void* recvbuf, int* recvcount, int* recvtype, 
221                    int* root, int* comm, int* ierr);
222 void mpi_gather__(void* sendbuf, int* sendcount, int* sendtype,
223                   void* recvbuf, int* recvcount, int* recvtype,
224                   int* root, int* comm, int* ierr);
225 void mpi_allgather__(void* sendbuf, int* sendcount, int* sendtype,
226                      void* recvbuf, int* recvcount, int* recvtype,
227                      int* comm, int* ierr);
228 void mpi_scan__(void* sendbuf, void* recvbuf, int* count, int* datatype,
229                 int* op, int* comm, int* ierr);
230 void mpi_alltoall__(void* sendbuf, int* sendcount, int* sendtype,
231                     void* recvbuf, int* recvcount, int* recvtype, int* comm, int* ierr);
232
233 #endif