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

Method Compute

tensorflow/core/kernels/sendrecv_ops.cc:77–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77void SendOp::Compute(OpKernelContext* ctx) {
78 OP_REQUIRES(
79 ctx, ctx->rendezvous() != nullptr,
80 errors::Internal("Op kernel context needs to provide a rendezvous."));
81
82 // The device context may be passed between the Send/Recv
83 // boundary, so that the device context used to produce the Tensor
84 // is used when performing the copy on the recv side (which may be
85 // a different device).
86 Rendezvous::Args args;
87 args.device_context = ctx->op_device_context();
88 args.alloc_attrs = ctx->input_alloc_attr(0);
89
90 FrameAndIter frame_iter = GetFrameAndIter(ctx, hostmem_sendrecv_);
91 if (frame_iter == FrameAndIter(0, 0)) {
92 // Use the cached rendezvous key.
93 VLOG(2) << "Send " << parsed_key_.buf_;
94 ctx->SetStatus(ctx->rendezvous()->Send(parsed_key_, args, ctx->input(0),
95 ctx->is_input_dead()));
96 return;
97 } else {
98 Rendezvous::ParsedKey in_loop_parsed;
99 GetRendezvousKey(key_prefix_, frame_iter, &in_loop_parsed.buf_);
100 VLOG(2) << "Send " << in_loop_parsed.buf_;
101 OP_REQUIRES_OK(ctx,
102 Rendezvous::ParseKey(in_loop_parsed.buf_, &in_loop_parsed));
103
104 ctx->SetStatus(ctx->rendezvous()->Send(in_loop_parsed, args, ctx->input(0),
105 ctx->is_input_dead()));
106 return;
107 }
108}
109
110REGISTER_KERNEL_BUILDER(Name("_Send").Device(DEVICE_CPU), SendOp);
111REGISTER_KERNEL_BUILDER(Name("_Send").Device(DEVICE_DEFAULT), SendOp);

Callers

nothing calls this directly

Calls 13

InternalFunction · 0.85
FrameAndIterClass · 0.85
rendezvousMethod · 0.80
input_alloc_attrMethod · 0.80
is_input_deadMethod · 0.80
input_refMethod · 0.80
GetFrameAndIterFunction · 0.70
GetRendezvousKeyFunction · 0.70
input_ref_mutexMethod · 0.60
op_device_contextMethod · 0.45
SetStatusMethod · 0.45
SendMethod · 0.45

Tested by

no test coverage detected