1 | /** |
2 | * Copyright (c) 2017-present, Facebook, Inc. |
3 | * All rights reserved. |
4 | * |
5 | * This source code is licensed under the BSD-style license found in the |
6 | * LICENSE file in the root directory of this source tree. |
7 | */ |
8 | |
9 | #pragma once |
10 | |
11 | #include "gloo/algorithm.h" |
12 | #include "gloo/context.h" |
13 | |
14 | namespace gloo { |
15 | |
16 | template <typename T> |
17 | class AllreduceLocal : public Algorithm { |
18 | public: |
19 | AllreduceLocal( |
20 | const std::shared_ptr<Context>& context, |
21 | const std::vector<T*>& ptrs, |
22 | const int count, |
23 | const ReductionFunction<T>* fn = ReductionFunction<T>::sum); |
24 | |
25 | virtual ~AllreduceLocal() = default; |
26 | |
27 | virtual void run() override; |
28 | |
29 | protected: |
30 | std::vector<T*> ptrs_; |
31 | const int count_; |
32 | const int bytes_; |
33 | const ReductionFunction<T>* fn_; |
34 | }; |
35 | |
36 | } // namespace gloo |
37 | |