Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix copyright headers
[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
15 struct s_smpi_process_data;
16 typedef struct s_smpi_process_data* smpi_process_data_t;
17
18 #define PERSISTENT     0x0
19 #define NON_PERSISTENT 0x1
20 #define SEND           0x0
21 #define RECV           0x2
22
23 typedef struct s_smpi_mpi_request {
24   void* buf;
25   size_t size;
26   int src;
27   int dst;
28   int tag;
29   MPI_Comm comm;
30   smx_rdv_t rdv;
31   smx_comm_t pair;
32   int complete;
33   MPI_Request match;
34   unsigned flags;
35   MPI_Request ack;
36 } s_smpi_mpi_request_t;
37
38 void smpi_process_init(int* argc, char*** argv);
39 void smpi_process_destroy(void);
40
41 smpi_process_data_t smpi_process_data(void);
42 smpi_process_data_t smpi_process_remote_data(int index);
43 int smpi_process_count(void);
44 int smpi_process_index(void);
45 xbt_os_timer_t smpi_process_timer(void);
46 void print_request(const char* message, MPI_Request request);
47 void smpi_process_post_send(MPI_Comm comm, MPI_Request request);
48 void smpi_process_post_recv(MPI_Request request);
49
50 void smpi_global_init(void);
51 void smpi_global_destroy(void);
52
53 size_t smpi_datatype_size(MPI_Datatype datatype);
54 MPI_Aint smpi_datatype_lb(MPI_Datatype datatype);
55 MPI_Aint smpi_datatype_ub(MPI_Datatype datatype);
56 int smpi_datatype_extent(MPI_Datatype datatype, MPI_Aint* lb, MPI_Aint * extent);
57 int smpi_datatype_copy(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype);
58
59 MPI_Op smpi_op_new(MPI_User_function* function, int commute);
60 void smpi_op_destroy(MPI_Op op);
61 void smpi_op_apply(MPI_Op op, void* invec, void* inoutvec, int* len, MPI_Datatype* datatype);
62
63 MPI_Group smpi_group_new(int size);
64 void smpi_group_destroy(MPI_Group group);
65 void smpi_group_set_mapping(MPI_Group group, int index, int rank);
66 int smpi_group_index(MPI_Group group, int rank);
67 int smpi_group_rank(MPI_Group group, int index);
68 int smpi_group_use(MPI_Group group);
69 int smpi_group_unuse(MPI_Group group);
70 int smpi_group_size(MPI_Group group);
71 int smpi_group_compare(MPI_Group group1, MPI_Group group2);
72
73 MPI_Comm smpi_comm_new(MPI_Group group);
74 void smpi_comm_destroy(MPI_Comm comm);
75 MPI_Group smpi_comm_group(MPI_Comm comm);
76 int smpi_comm_size(MPI_Comm comm);
77 int smpi_comm_rank(MPI_Comm comm);
78
79 MPI_Request smpi_mpi_send_init(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
80 MPI_Request smpi_mpi_recv_init(void* buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm);
81 void smpi_mpi_start(MPI_Request request);
82 void smpi_mpi_startall(int count, MPI_Request* requests);
83 void smpi_mpi_request_free(MPI_Request* request);
84 MPI_Request smpi_isend_init(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
85 MPI_Request smpi_mpi_isend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
86 MPI_Request smpi_irecv_init(void* buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm);
87 MPI_Request smpi_mpi_irecv(void* buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm);
88 void smpi_mpi_recv(void* buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status* status);
89 void smpi_mpi_send(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
90 void smpi_mpi_sendrecv(void* sendbuf, int sendcount, MPI_Datatype sendtype, int dst, int sendtag, void* recvbuf, int recvcount, MPI_Datatype recvtype, int src, int recvtag, MPI_Comm comm, MPI_Status* status);
91 int smpi_mpi_test(MPI_Request* request, MPI_Status* status);
92 int smpi_mpi_testany(int count, MPI_Request requests[], int* index, MPI_Status* status);
93 void smpi_mpi_wait(MPI_Request* request, MPI_Status* status);
94 int smpi_mpi_waitany(int count, MPI_Request requests[], MPI_Status* status);
95 void smpi_mpi_waitall(int count, MPI_Request requests[],  MPI_Status status[]);
96 int smpi_mpi_waitsome(int incount, MPI_Request requests[], int* indices, MPI_Status status[]);
97 void smpi_mpi_bcast(void* buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm);
98 void smpi_mpi_barrier(MPI_Comm comm);
99 void smpi_mpi_gather(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm);
100 void smpi_mpi_gatherv(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int* recvcounts, int* displs, MPI_Datatype recvtype, int root, MPI_Comm comm);
101 void smpi_mpi_allgather(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm);
102 void smpi_mpi_allgatherv(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int* recvcounts, int* displs, MPI_Datatype recvtype, MPI_Comm comm);
103 void smpi_mpi_scatter(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm);
104 void smpi_mpi_scatterv(void* sendbuf, int* sendcounts, int* displs, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm);
105 void smpi_mpi_reduce(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm);
106 void smpi_mpi_allreduce(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
107 void smpi_mpi_scan(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
108
109 void nary_tree_bcast(void* buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm, int arity);
110 void nary_tree_barrier(MPI_Comm comm, int arity);
111
112 int smpi_coll_tuned_alltoall_bruck(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm);
113 int smpi_coll_tuned_alltoall_basic_linear(void *sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm);
114 int smpi_coll_tuned_alltoall_pairwise(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm);
115 int smpi_coll_basic_alltoallv(void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype sendtype, void* recvbuf, int *recvcounts, int* recvdisps, MPI_Datatype recvtype, MPI_Comm comm);
116
117 // utilities
118 void smpi_bench_begin(int rank, const char* mpi_call);
119 void smpi_bench_end(int rank, const char* mpi_call);
120
121 #endif