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

Method Clone

tensorflow/contrib/verbs/rdma.cc:1140–1162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1138}
1139
1140void RdmaTensorResponse::Clone(const Tensor& in, const TensorProto& proto,
1141 bool is_dead) {
1142 // Clone the data to be sent later. For simplicity, we clone the tensor's
1143 // data even if it is already a copy. Performance is less of a concern here
1144 // since the meta-data hardly ever changes. The reason we create a copy, is
1145 // that some tensors share their buffer between different step-ids, so the
1146 // tensor content may change before re-request was completed.
1147 bool can_memcpy = DataTypeCanUseMemcpy(in.dtype());
1148 if (can_memcpy && (in.TotalBytes() > 0)) {
1149 AllocatorAttributes host_alloc_attrs;
1150 host_alloc_attrs.set_nic_compatible(true);
1151 host_alloc_attrs.set_on_host(true);
1152 Allocator* allocator = src_dev_->GetAllocator(host_alloc_attrs);
1153 tensor_ = new Tensor(allocator, in.dtype(), in.shape());
1154 memcpy(DMAHelper::base(tensor_), DMAHelper::base(&in), in.TotalBytes());
1155 } else {
1156 tensor_ = new Tensor(in.dtype(), in.shape());
1157 }
1158 if (!can_memcpy) {
1159 proto_ = new TensorProto(proto);
1160 }
1161 is_dead_ = is_dead;
1162}
1163
1164void RdmaTensorResponse::SendMetaData(const Tensor& in,
1165 const TensorProto& proto, bool is_dead) {

Callers

nothing calls this directly

Calls 8

DataTypeCanUseMemcpyFunction · 0.85
baseClass · 0.85
set_nic_compatibleMethod · 0.80
set_on_hostMethod · 0.80
dtypeMethod · 0.45
TotalBytesMethod · 0.45
GetAllocatorMethod · 0.45
shapeMethod · 0.45

Tested by

no test coverage detected