diff --git a/paddle/fluid/framework/parallel_executor.cc b/paddle/fluid/framework/parallel_executor.cc index 485d89aa562fe85ac549c9a967ab321b94e3fcfe..b53a6f43fbd1f23e69d23ad0fcc54d5c25d352a3 100644 --- a/paddle/fluid/framework/parallel_executor.cc +++ b/paddle/fluid/framework/parallel_executor.cc @@ -166,7 +166,7 @@ void ParallelExecutor::BCastParamsToGPUs( void *buffer; if ((initializing && i == 0) || - (!initializing && i == static_cast(var_dev_id))) { + (!initializing && static_cast(i) == var_dev_id)) { buffer = const_cast(main_tensor.data()); } else { auto local_scope = member_->local_scopes_[i]; @@ -187,7 +187,7 @@ void ParallelExecutor::BCastParamsToGPUs( platform::dynload::ncclBcast(buffers[i], numel, data_type, 0, nccl_ctx.comm_, nccl_ctx.stream()); } else { - if (static_cast(var_dev_id)) { + if (var_dev_id >= 0) { platform::dynload::ncclBcast(buffers[i], numel, data_type, var_dev_id, nccl_ctx.comm_, nccl_ctx.stream());