MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / ComputeAsync

Method ComputeAsync

tensorflow/core/kernels/nccl_ops.cc:97–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95 : NcclReduceOpBase(c) {}
96
97 void ComputeAsync(OpKernelContext* c, DoneCallback done) override {
98 const Tensor* input = &c->input(0);
99 Tensor* output;
100 OP_REQUIRES_OK_ASYNC(
101 c, c->forward_input_or_allocate_output({0}, 0, input->shape(), &output),
102 done);
103 auto actual_done = [c, done](Status s) {
104 OP_REQUIRES_OK_ASYNC(c, s, done);
105 done();
106 };
107
108 auto* compute_stream = c->op_device_context()->stream();
109 auto* gpu_info = c->device()->tensorflow_gpu_device_info();
110 auto participant = absl::make_unique<NcclManager::Participant>(
111 compute_stream->parent(), compute_stream, gpu_info,
112 input, output, /*global_rank=*/-1,
113 std::move(actual_done));
114 NcclManager::instance()->AddToAllReduce(
115 std::move(participant),
116 {GetCollectiveKey(c),
117 /*num_local_devices=*/num_devices(),
118 /*num_global_devices=*/num_devices(),
119 /*communicator_key=*/"", /*source_rank=*/-1},
120 reduction_op());
121 }
122};
123REGISTER_KERNEL_BUILDER(Name("NcclAllReduce").Device(DEVICE_GPU),
124 NcclAllReduceOpKernel);

Callers

nothing calls this directly

Calls 9

AddToAllReduceMethod · 0.80
inputMethod · 0.45
shapeMethod · 0.45
streamMethod · 0.45
op_device_contextMethod · 0.45
deviceMethod · 0.45
parentMethod · 0.45

Tested by

no test coverage detected