diff --git a/paddle/fluid/operators/collective/recv_v2_op.cu.cc b/paddle/fluid/operators/collective/recv_v2_op.cu.cc index f0dd8aee23588c40cbfc21ccbc90a776bbcaea5e..892056f21359dd66fe5f2cb92e17accc0975fbaf 100644 --- a/paddle/fluid/operators/collective/recv_v2_op.cu.cc +++ b/paddle/fluid/operators/collective/recv_v2_op.cu.cc @@ -26,6 +26,7 @@ template class RecvOpV2CUDAKernel : public framework::OpKernel { public: void Compute(const framework::ExecutionContext &ctx) const override { +#if defined(PADDLE_WITH_NCCL) && NCCL_VERSION_CODE >= 2703 int rid = ctx.Attr("ring_id"); PADDLE_ENFORCE_GE( rid, 0, @@ -44,7 +45,6 @@ class RecvOpV2CUDAKernel : public framework::OpKernel { framework::proto::VarType::Type type = framework::proto::VarType::Type(data_type); -#if defined(PADDLE_WITH_NCCL) && NCCL_VERSION_CODE >= 2703 cudaStream_t stream = nullptr; auto place = ctx.GetPlace(); auto comm = platform::NCCLCommContext::Instance().Get(rid, place); diff --git a/paddle/fluid/operators/collective/send_v2_op.cu.cc b/paddle/fluid/operators/collective/send_v2_op.cu.cc index 9f925b2eede027a49a570d76dbd020c8af859c01..4de3f47ccc66b3053cda4d5cb45fe173e435e92a 100644 --- a/paddle/fluid/operators/collective/send_v2_op.cu.cc +++ b/paddle/fluid/operators/collective/send_v2_op.cu.cc @@ -26,6 +26,7 @@ template class SendOpV2CUDAKernel : public framework::OpKernel { public: void Compute(const framework::ExecutionContext& ctx) const override { +#if defined(PADDLE_WITH_NCCL) && NCCL_VERSION_CODE >= 2703 auto x = ctx.Input("X"); int numel = x->numel(); @@ -42,7 +43,6 @@ class SendOpV2CUDAKernel : public framework::OpKernel { "The peer (%d) for send_v2 op must be non-negative.", peer)); cudaStream_t stream = nullptr; auto place = ctx.GetPlace(); -#if defined(PADDLE_WITH_NCCL) && NCCL_VERSION_CODE >= 2703 auto comm = platform::NCCLCommContext::Instance().Get(rid, place); if (ctx.Attr("use_calc_stream")) { auto dev_ctx = platform::DeviceContextPool::Instance().Get(place);