Skip to content

Commit

Permalink
slove develop bugs (PaddlePaddle#32560) (PaddlePaddle#32684)
Browse files Browse the repository at this point in the history
  • Loading branch information
Baibaifan committed May 1, 2021
1 parent 2c1ed9b commit 6a1957e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 0 additions & 2 deletions paddle/fluid/operators/collective/c_sync_comm_stream_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class CSyncCommStreamCudaKernel : public framework::OpKernel<T> {
void Compute(const framework::ExecutionContext& ctx) const override {
auto place = ctx.GetPlace();
#if defined(PADDLE_WITH_NCCL) || defined(PADDLE_WITH_RCCL)

int ring_id = ctx.Attr<int>("ring_id");
auto stream =
platform::NCCLCommContext::Instance().Get(ring_id, place)->stream();
Expand All @@ -75,7 +74,6 @@ class CSyncCommStreamCudaKernel : public framework::OpKernel<T> {
#endif

#elif defined(PADDLE_WITH_ASCEND_CL)
auto place = ctx.GetPlace();
PADDLE_ENFORCE_EQ(is_npu_place(place), true,
platform::errors::PreconditionNotMet(
"Sync stream op can run on npu place only for now."));
Expand Down
2 changes: 2 additions & 0 deletions paddle/fluid/pybind/ascend_wrapper_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,14 @@ enum AttrType {
AT_NAMEATTR
};

#ifdef PADDLE_WITH_ASCEND
void BindAscendDevice(py::module *m) {
py::class_<platform::ascend::NPUDevice>(*m, "NPUDevice")
.def_static(
"get_device_count",
static_cast<int (*)()>(&platform::ascend::NPUDevice::GetDeviceCount));
}
#endif

void BindAscendGraph(py::module *m) {
m->def("ge_initialize", &ge_initialize, "GEInitialize");
Expand Down
4 changes: 2 additions & 2 deletions python/paddle/distributed/fleet/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ def which_distributed_mode(args):

if fluid.core.is_compiled_with_cuda():
accelerators = fluid.core.get_cuda_device_count()
elif fluid.core.is_compiled_with_ascend():
accelerators = fluid.core.NPUDevice.get_device_count()
elif fluid.core.is_compiled_with_npu():
accelerators = fluid.core.get_npu_device_count()
elif fluid.core.is_compiled_with_xpu():
accelerators = fluid.core.get_xpu_device_count()
else:
Expand Down
4 changes: 2 additions & 2 deletions python/paddle/distributed/fleet/launch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,8 +653,8 @@ def get_xpus(xpus):


def get_device_mode():
if fluid.core.is_compiled_with_ascend() and \
fluid.core.NPUDevice.get_device_count() > 0:
if fluid.core.is_compiled_with_npu() and \
fluid.core.get_npu_device_count() > 0:
print("launch train in ascend npu mode!")
return DeviceMode.ASCEND_NPU

Expand Down

0 comments on commit 6a1957e

Please sign in to comment.