Logo AND Algorithmique Numérique Distribuée

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