Skip to content

Commit d24e046

Browse files
committed
fix allReduce bug
1 parent a57e8a4 commit d24e046

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

paddle/fluid/framework/details/all_reduce_op_handle.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ void AllReduceOpHandle::RunImpl() {
107107
auto &trg = *this->local_scopes_[0]
108108
->FindVar(kLocalExecScopeName)
109109
->Get<Scope *>()
110-
->Var()
110+
->FindVar(in_var_handles[0]->name_)
111111
->GetMutable<framework::LoDTensor>();
112112

113113
// Reduce All Tensor to trg in CPU

python/paddle/fluid/parallel_executor.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,9 @@ def __init__(self,
121121
# performance. Worth tunning for other models in the future.
122122
exec_strategy.num_threads = len(self._places) * 4
123123
else:
124-
# Currently num_threads must be 1.
125-
exec_strategy.num_threads = 1
124+
cpu_num = int(
125+
os.environ.get('CPU_NUM', multiprocessing.cpu_count()))
126+
exec_strategy.num_threads = cpu_num
126127

127128
if build_strategy is None:
128129
build_strategy = BuildStrategy()

0 commit comments

Comments
 (0)