Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Support for Fortran code in SMPI based on f2c, some perl and some dirty hacks.
[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/private.h"
16
17 struct s_smpi_process_data;
18 typedef struct s_smpi_process_data *smpi_process_data_t;
19
20 #define PERSISTENT     0x0
21 #define NON_PERSISTENT 0x1
22 #define SEND           0x0
23 #define RECV           0x2
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_rdv_t rdv;
33   smx_comm_t pair;
34   int complete;
35   MPI_Request match;
36   unsigned flags;
37 #ifdef HAVE_TRACING
38   int send;
39   int recv;
40 #endif
41 } s_smpi_mpi_request_t;
42
43 void smpi_process_init(int *argc, char ***argv);
44 void smpi_process_destroy(void);
45
46 smpi_process_data_t smpi_process_data(void);
47 smpi_process_data_t smpi_process_remote_data(int index);
48 int smpi_process_count(void);
49 int smpi_process_index(void);
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 void smpi_process_post_send(MPI_Comm comm, MPI_Request request);
56 void smpi_process_post_recv(MPI_Request request);
57
58 void smpi_global_init(void);
59 void smpi_global_destroy(void);
60
61 size_t smpi_datatype_size(MPI_Datatype datatype);
62 MPI_Aint smpi_datatype_lb(MPI_Datatype datatype);
63 MPI_Aint smpi_datatype_ub(MPI_Datatype datatype);
64 int smpi_datatype_extent(MPI_Datatype datatype, MPI_Aint * lb,
65                          MPI_Aint * extent);
66 int smpi_datatype_copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
67                        void *recvbuf, int recvcount,
68                        MPI_Datatype recvtype);
69
70 MPI_Op smpi_op_new(MPI_User_function * function, int commute);
71 void smpi_op_destroy(MPI_Op op);
72 void smpi_op_apply(MPI_Op op, void *invec, void *inoutvec, int *len,
73                    MPI_Datatype * datatype);
74
75 MPI_Group smpi_group_new(int size);
76 void smpi_group_destroy(MPI_Group group);
77 void smpi_group_set_mapping(MPI_Group group, int index, int rank);
78 int smpi_group_index(MPI_Group group, int rank);
79 int smpi_group_rank(MPI_Group group, int index);
80 int smpi_group_use(MPI_Group group);
81 int smpi_group_unuse(MPI_Group group);
82 int smpi_group_size(MPI_Group group);
83 int smpi_group_compare(MPI_Group group1, MPI_Group group2);
84
85 MPI_Comm smpi_comm_new(MPI_Group group);
86 void smpi_comm_destroy(MPI_Comm comm);
87 MPI_Group smpi_comm_group(MPI_Comm comm);
88 int smpi_comm_size(MPI_Comm comm);
89 int smpi_comm_rank(MPI_Comm comm);
90 MPI_Comm smpi_comm_split(MPI_Comm comm, int color, int key);
91
92 MPI_Request smpi_mpi_send_init(void *buf, int count, MPI_Datatype datatype,
93                                int dst, int tag, MPI_Comm comm);
94 MPI_Request smpi_mpi_recv_init(void *buf, int count, MPI_Datatype datatype,
95                                int src, int tag, MPI_Comm comm);
96 void smpi_mpi_start(MPI_Request request);
97 void smpi_mpi_startall(int count, MPI_Request * requests);
98 void smpi_mpi_request_free(MPI_Request * request);
99 MPI_Request smpi_isend_init(void *buf, int count, MPI_Datatype datatype,
100                             int dst, int tag, MPI_Comm comm);
101 MPI_Request smpi_mpi_isend(void *buf, int count, MPI_Datatype datatype,
102                            int dst, int tag, MPI_Comm comm);
103 MPI_Request smpi_irecv_init(void *buf, int count, MPI_Datatype datatype,
104                             int src, int tag, MPI_Comm comm);
105 MPI_Request smpi_mpi_irecv(void *buf, int count, MPI_Datatype datatype,
106                            int src, int tag, MPI_Comm comm);
107 void smpi_mpi_recv(void *buf, int count, MPI_Datatype datatype, int src,
108                    int tag, MPI_Comm comm, MPI_Status * status);
109 void smpi_mpi_send(void *buf, int count, MPI_Datatype datatype, int dst,
110                    int tag, MPI_Comm comm);
111 void smpi_mpi_sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
112                        int dst, int sendtag, void *recvbuf, int recvcount,
113                        MPI_Datatype recvtype, int src, int recvtag,
114                        MPI_Comm comm, MPI_Status * status);
115 int smpi_mpi_test(MPI_Request * request, MPI_Status * status);
116 int smpi_mpi_testany(int count, MPI_Request requests[], int *index,
117                      MPI_Status * status);
118 int smpi_mpi_get_count(MPI_Status * status, MPI_Datatype datatype);
119 void smpi_mpi_wait(MPI_Request * request, MPI_Status * status);
120 int smpi_mpi_waitany(int count, MPI_Request requests[],
121                      MPI_Status * status);
122 void smpi_mpi_waitall(int count, MPI_Request requests[],
123                       MPI_Status status[]);
124 int smpi_mpi_waitsome(int incount, MPI_Request requests[], int *indices,
125                       MPI_Status status[]);
126 void smpi_mpi_bcast(void *buf, int count, MPI_Datatype datatype, int root,
127                     MPI_Comm comm);
128 void smpi_mpi_barrier(MPI_Comm comm);
129 void smpi_mpi_gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
130                      void *recvbuf, int recvcount, MPI_Datatype recvtype,
131                      int root, MPI_Comm comm);
132 void smpi_mpi_gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
133                       void *recvbuf, int *recvcounts, int *displs,
134                       MPI_Datatype recvtype, int root, MPI_Comm comm);
135 void smpi_mpi_allgather(void *sendbuf, int sendcount,
136                         MPI_Datatype sendtype, void *recvbuf,
137                         int recvcount, MPI_Datatype recvtype,
138                         MPI_Comm comm);
139 void smpi_mpi_allgatherv(void *sendbuf, int sendcount,
140                          MPI_Datatype sendtype, void *recvbuf,
141                          int *recvcounts, int *displs,
142                          MPI_Datatype recvtype, MPI_Comm comm);
143 void smpi_mpi_scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
144                       void *recvbuf, int recvcount, MPI_Datatype recvtype,
145                       int root, MPI_Comm comm);
146 void smpi_mpi_scatterv(void *sendbuf, int *sendcounts, int *displs,
147                        MPI_Datatype sendtype, void *recvbuf, int recvcount,
148                        MPI_Datatype recvtype, int root, MPI_Comm comm);
149 void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count,
150                      MPI_Datatype datatype, MPI_Op op, int root,
151                      MPI_Comm comm);
152 void smpi_mpi_allreduce(void *sendbuf, void *recvbuf, int count,
153                         MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
154 void smpi_mpi_scan(void *sendbuf, void *recvbuf, int count,
155                    MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
156
157 void nary_tree_bcast(void *buf, int count, MPI_Datatype datatype, int root,
158                      MPI_Comm comm, int arity);
159 void nary_tree_barrier(MPI_Comm comm, int arity);
160
161 int smpi_coll_tuned_alltoall_bruck(void *sendbuf, int sendcount,
162                                    MPI_Datatype sendtype, void *recvbuf,
163                                    int recvcount, MPI_Datatype recvtype,
164                                    MPI_Comm comm);
165 int smpi_coll_tuned_alltoall_basic_linear(void *sendbuf, int sendcount,
166                                           MPI_Datatype sendtype,
167                                           void *recvbuf, int recvcount,
168                                           MPI_Datatype recvtype,
169                                           MPI_Comm comm);
170 int smpi_coll_tuned_alltoall_pairwise(void *sendbuf, int sendcount,
171                                       MPI_Datatype sendtype, void *recvbuf,
172                                       int recvcount, MPI_Datatype recvtype,
173                                       MPI_Comm comm);
174 int smpi_coll_basic_alltoallv(void *sendbuf, int *sendcounts,
175                               int *senddisps, MPI_Datatype sendtype,
176                               void *recvbuf, int *recvcounts,
177                               int *recvdisps, MPI_Datatype recvtype,
178                               MPI_Comm comm);
179
180 // utilities
181 void smpi_bench_destroy(void);
182 void smpi_bench_begin(int rank, const char *mpi_call);
183 void smpi_bench_end(int rank, const char *mpi_call);
184
185 // f77 wrappers
186 void mpi_init__(int*);
187 void mpi_finalize__(int*);
188 void mpi_comm_rank__(MPI_Comm** comm, int* rank, int* ierr);
189 void mpi_comm_size__(MPI_Comm** comm, int* size, int* ierr);
190 double mpi_wtime__(void);
191
192 void mpi_send__(void* buf, int* count, MPI_Datatype** datatype, int* dst,
193                 int* tag, MPI_Comm** comm, int* ierr);
194 void mpi_recv__(void* buf, int* count, MPI_Datatype** datatype, int* src,
195                 int* tag, MPI_Comm** comm, MPI_Status* status, int* ierr);
196
197 #endif