Vowpal Wabbit
vw_allreduce.h
Go to the documentation of this file.
1 /*
2 Copyright (c) by respective owners including Yahoo!, Microsoft, and
3 individual contributors. All rights reserved. Released under a BSD
4 license as described in the file LICENSE.
5 */
6 
7 #pragma once
8 
9 #include "vw.h"
10 #include "allreduce.h"
11 
12 template <class T, void (*f)(T&, const T&)>
13 void all_reduce(vw& all, T* buffer, const size_t n)
14 {
15  switch (all.all_reduce_type)
16  {
18  ((AllReduceSockets*)all.all_reduce)->all_reduce<T, f>(buffer, n);
19  break;
20 
22  ((AllReduceThreads*)all.all_reduce)->all_reduce<T, f>(buffer, n);
23  break;
24  }
25 }
AllReduce * all_reduce
Definition: global_data.h:381
AllReduceType all_reduce_type
Definition: global_data.h:380
void all_reduce(vw &all, T *buffer, const size_t n)
Definition: vw_allreduce.h:13
float f
Definition: cache.cc:40