ALP User Documentation  0.8.preview
Algebraic Programming User Documentation
collectives.hpp
Go to the documentation of this file.
1 
2 /*
3  * Copyright 2021 Huawei Technologies Co., Ltd.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
28 #ifndef _H_GRB_COLL_BASE
29 #define _H_GRB_COLL_BASE
30 
31 #include <graphblas/backends.hpp>
33 #include <graphblas/rc.hpp>
34 
35 
36 namespace grb {
37 
45  template< enum Backend implementation >
46  class collectives {
47 
48  private:
49 
51  collectives() {}
52 
53 
54  public:
55 
116  template<
118  typename Operator,
119  typename IOType
120  >
121  static RC allreduce( IOType &inout, const Operator op = Operator() ) {
122  (void) inout;
123  (void)op;
124  return PANIC;
125  }
126 
186  template<
188  typename Operator,
189  typename IOType
190  >
191  static RC reduce(
192  IOType &inout,
193  const size_t root = 0,
194  const Operator op = Operator()
195  ) {
196  (void) inout;
197  (void) op;
198  (void) root;
199  return PANIC;
200  }
201 
243  template< typename IOType >
244  static RC broadcast( IOType &inout, const size_t root = 0 ) {
245  (void) inout;
246  (void) root;
247  return PANIC;
248  }
249 
256  template< Descriptor descr = descriptors::no_operation, typename IOType >
257  static RC broadcast(
258  IOType * inout,
259  const size_t size,
260  const size_t root = 0
261  ) {
262  (void) inout;
263  (void) size;
264  (void) root;
265  return PANIC;
266  }
267 
268  }; // end class ``collectives''
269 
270 } // end namespace grb
271 
272 #endif // end _H_GRB_COLL_BASE
273 
Defines the ALP error codes.
This file contains a register of all backends that are either implemented, under implementation,...
RC
Return codes of ALP primitives.
Definition: rc.hpp:47
static RC broadcast(IOType &inout, const size_t root=0)
Schedules a broadcast operation of a single object of type IOType per process.
Definition: collectives.hpp:244
static constexpr Descriptor no_operation
Indicates no additional pre- or post-processing on any of the GraphBLAS function arguments.
Definition: descriptors.hpp:63
unsigned int Descriptor
Descriptors indicate pre- or post-processing for some or all of the arguments to an ALP/GraphBLAS cal...
Definition: descriptors.hpp:54
A static class defining various collective operations on scalars.
Definition: collectives.hpp:46
static RC allreduce(IOType &inout, const Operator op=Operator())
Schedules an allreduce operation of a single object of type IOType per process.
Definition: collectives.hpp:121
Defines all ALP/GraphBLAS descriptors.
static RC reduce(IOType &inout, const size_t root=0, const Operator op=Operator())
Schedules a reduce operation of a single object of type IOType per process.
Definition: collectives.hpp:191
The ALP/GraphBLAS namespace.
Definition: graphblas.hpp:477
Generic fatal error code.
Definition: rc.hpp:68
size_t size(const Vector< DataType, backend, Coords > &x) noexcept
Request the size of a given vector.
Definition: io.hpp:235
static RC broadcast(IOType *inout, const size_t size, const size_t root=0)
Broadcast on an array of IOType.
Definition: collectives.hpp:257