提交 999d0fdb 编写于 作者: Y yuyang18

By default is all reduce

上级 c8f3ed23
......@@ -27,7 +27,7 @@ struct BuildStrategy {
kCustomized = 2,
};
ReduceStrategy reduce_{ReduceStrategy::kReduce};
ReduceStrategy reduce_{ReduceStrategy::kAllReduce};
GradientScaleStrategy gradient_scale_{GradientScaleStrategy::kCoeffNumDevice};
};
......
......@@ -44,12 +44,6 @@ void FetchOpHandle::WaitAndMergeCPUTensors() const {
data_->at(offset_).MergeLoDTensor(tensors_ptr, platform::CPUPlace());
}
template <typename T, typename... ARGS>
inline T &Ref(T *ptr, ARGS &&... args) {
PADDLE_ENFORCE(ptr != nullptr, args...);
return *ptr;
}
void FetchOpHandle::RunImpl() {
WaitInputVarGenerated(platform::CPUPlace());
......@@ -59,14 +53,10 @@ void FetchOpHandle::RunImpl() {
platform::CPUPlace cpu;
auto &scopes = *local_scopes_;
PADDLE_ENFORCE_EQ(inputs_.size(), scopes.size());
for (size_t i = 0; i < scopes.size(); ++i) {
auto &scope = scopes[i];
auto *var = Ref(Ref(scope->FindVar(kLocalExecScopeName), "Cannot find %s",
kLocalExecScopeName)
.Get<Scope *>(),
"Cannot get scope")
.FindVar(var_name);
auto *var =
scope->FindVar(kLocalExecScopeName)->Get<Scope *>()->FindVar(var_name);
PADDLE_ENFORCE_NOT_NULL(var, "Cannot find variable %s in execution scope",
var_name);
auto &t = var->Get<framework::LoDTensor>();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册