diff --git a/paddle/phi/kernels/gpu/c_scatter_kernel.cu b/paddle/phi/kernels/gpu/c_scatter_kernel.cu index 4ea62f468e58e..8598b787d524d 100644 --- a/paddle/phi/kernels/gpu/c_scatter_kernel.cu +++ b/paddle/phi/kernels/gpu/c_scatter_kernel.cu @@ -51,20 +51,8 @@ void CScatterOpCUDAKernel(const Context& dev_ctx, common::errors::InvalidArgument( "The ring_id (%d) for c_scatter_op must be non-negative.", ring_id)); - const auto& comm_context_manager = - phi::distributed::CommContextManager::GetInstance(); - - PADDLE_ENFORCE_EQ(comm_context_manager.Has(std::to_string(ring_id)), - true, - common::errors::InvalidArgument( - "You choose to use new communication library by " - "setting environment " - "variable FLAGS_dynamic_static_unified_comm True. " - "But ring_id(%d) is " - "not found in comm_context_manager.", - std::to_string(ring_id))); - comm_ctx = static_cast( - comm_context_manager.Get(std::to_string(ring_id))); + comm_ctx = + static_cast(dev_ctx.GetCommContext()); PADDLE_ENFORCE_NE(comm_ctx, nullptr, common::errors::Unavailable(