Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
7728984e27057ad2af65d9df2f9fa52bf1e85923
[simgrid.git] / src / smpi / smpi_coll.hpp
1 /*High level handling of collective algorithms*/
2 /* Copyright (c) 2009-2010, 2012-2014. The SimGrid Team.
3  * All rights reserved.                                                     */
4
5 /* This program is free software; you can redistribute it and/or modify it
6  * under the terms of the license (GNU LGPL) which comes with this package. */
7
8 #ifndef SMPI_COLL_HPP
9 #define SMPI_COLL_HPP
10
11 #include <xbt/base.h>
12
13 #include "private.h"
14
15 namespace simgrid{
16 namespace smpi{
17
18 class Colls{
19   private:
20   public:
21     static void set_collectives();
22     static void set_gather(const char* name);
23     static void set_allgather(const char* name);
24     static void set_allgatherv(const char* name);
25     static void set_alltoall(const char* name);
26     static void set_alltoallv(const char* name);
27     static void set_allreduce(const char* name);
28     static void set_reduce(const char* name);
29     static void set_reduce_scatter(const char* name);
30     static void set_scatter(const char* name);
31     static void set_barrier(const char* name);
32     static void set_bcast(const char* name);
33
34     static void coll_help(const char *category, s_mpi_coll_description_t * table);
35
36     static int (*gather)(void *, int, MPI_Datatype, void*, int, MPI_Datatype, int root, MPI_Comm);
37     static int (*allgather)(void *, int, MPI_Datatype, void*, int, MPI_Datatype, MPI_Comm);
38     static int (*allgatherv)(void *, int, MPI_Datatype, void*, int*, int*, MPI_Datatype, MPI_Comm);
39     static int (*allreduce)(void *sbuf, void *rbuf, int rcount, MPI_Datatype dtype, MPI_Op op, MPI_Comm comm);
40     static int (*alltoall)(void *, int, MPI_Datatype, void*, int, MPI_Datatype, MPI_Comm);
41     static int (*alltoallv)(void *, int*, int*, MPI_Datatype, void*, int*, int*, MPI_Datatype, MPI_Comm);
42     static int (*bcast)(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm com);
43     static int (*reduce)(void *buf, void *rbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm);
44     static int (*reduce_scatter)(void *sbuf, void *rbuf, int *rcounts,MPI_Datatype dtype,MPI_Op  op,MPI_Comm  comm);
45     static int (*scatter)(void *sendbuf, int sendcount, MPI_Datatype sendtype,void *recvbuf, int recvcount, MPI_Datatype recvtype,int root, MPI_Comm comm);
46     static int (*barrier)(MPI_Comm comm);
47
48 //These fairly unused collectives only have one implementation in SMPI
49
50     static int gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int *recvcounts, int *displs, MPI_Datatype recvtype, int root, MPI_Comm comm);
51     static int scatterv(void *sendbuf, int *sendcounts, int *displs, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm);
52     static int scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
53     static int exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
54 };
55
56 class Coll_algo{
57   private:
58     char* description_;
59   public:
60     char* description();
61 };
62
63 class Coll_gather : public Coll_algo {
64   private:
65   public:
66     static int gather (void *, int, MPI_Datatype, void*, int, MPI_Datatype, int root, MPI_Comm);
67 };
68
69 class Coll_allgather : public Coll_algo {
70   private:
71   public:
72     static int allgather (void *, int, MPI_Datatype, void*, int, MPI_Datatype, MPI_Comm);
73 };
74
75 class Coll_allgatherv : public Coll_algo {
76   private:
77   public:
78     static int allgatherv (void *, int, MPI_Datatype, void*, int*, int*, MPI_Datatype, MPI_Comm);
79 };
80
81 class Coll_allreduce : public Coll_algo {
82   private:
83   public:
84     static int allreduce (void *sbuf, void *rbuf, int rcount, MPI_Datatype dtype, MPI_Op op, MPI_Comm comm);
85 };
86
87 class Coll_alltoall : public Coll_algo {
88   private:
89   public:
90     static int alltoall (void *, int, MPI_Datatype, void*, int, MPI_Datatype, MPI_Comm);
91 };
92
93 class Coll_alltoallv : public Coll_algo {
94   private:
95   public:
96     static int alltoallv (void *, int*, int*, MPI_Datatype, void*, int*, int*, MPI_Datatype, MPI_Comm);
97 };
98
99 class Coll_bcast : public Coll_algo {
100   private:
101   public:
102     static int bcast (void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm com);
103 };
104
105 class Coll_reduce : public Coll_algo {
106   private:
107   public:
108     static int reduce (void *buf, void *rbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm);
109 };
110
111 class Coll_reduce_scatter : public Coll_algo {
112   private:
113   public:
114     static int reduce_scatter (void *sbuf, void *rbuf, int *rcounts,MPI_Datatype dtype,MPI_Op  op,MPI_Comm  comm);
115 };
116
117 class Coll_scatter : public Coll_algo {
118   private:
119   public:
120     static int scatter (void *sendbuf, int sendcount, MPI_Datatype sendtype,void *recvbuf, int recvcount, MPI_Datatype recvtype,int root, MPI_Comm comm);
121 };
122
123 class Coll_barrier : public Coll_algo {
124   private:
125   public:
126     static int barrier (MPI_Comm);
127 };
128
129
130 }
131 }
132
133 #endif