Revision 5e0f3d78e08676ea56724a0aec6dbeb1e6d02990 authored by frankseide on 07 May 2016, 00:20:51 UTC, committed by frankseide on 07 May 2016, 00:20:51 UTC
1 parent 7981dd8
IDistGradAggregator.h
#pragma once
#include "DistGradHeader.h"
#include "MPIWrapper.h"
namespace Microsoft { namespace MSR { namespace CNTK {
template <class ElemType>
class IDistGradAggregator
{
public:
IDistGradAggregator(const MPIWrapperPtr& mpi)
: m_mpi(mpi)
{
}
virtual ~IDistGradAggregator()
{
}
// Returns a boolean indicating if any samples were processed
virtual bool AggregateGradients(const std::vector<Matrix<ElemType>*>& gradients, DistGradHeader* headerCPU, int epochNumber) = 0;
size_t NumProc()
{
return m_mpi->NumNodesInUse();
}
size_t MyRank()
{
return m_mpi->CurrentNodeRank();
}
void WaitAll()
{
m_mpi->WaitAll();
}
protected:
MPIWrapperPtr m_mpi;
};
#define UsingIDistGradAggregatorMembers \
\
protected: \
using IDistGradAggregator<ElemType>::m_mpi; \
using IDistGradAggregator<ElemType>::NumProc; \
using IDistGradAggregator<ElemType>::MyRank
} } }
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...