MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / Tensor2Pinned

Function Tensor2Pinned

paddle/fluid/framework/hogwild_worker.cc:152–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150#endif
151template <typename TStream>
152inline void Tensor2Pinned(phi::DenseTensor *tensor, const TStream &stream) {
153#if defined(PADDLE_WITH_CUDA)
154 const size_t mem_len = tensor->memory_size();
155 auto place = phi::GPUPinnedPlace();
156 auto holder = memory::AllocShared(place, mem_len);
157 memory::Copy(
158 place, holder->ptr(), tensor->place(), tensor->data(), mem_len, stream);
159 tensor->ResetHolderWithType(holder, tensor->dtype());
160#endif
161}
162template <typename TCopyer>
163void HogwildWorker::OffLoadVarInfo::CopyInputs(const Scope *root,
164 const phi::Place &place,

Callers 1

CreateThreadScopeMethod · 0.85

Calls 9

GPUPinnedPlaceClass · 0.85
ResetHolderWithTypeMethod · 0.80
AllocSharedFunction · 0.50
CopyFunction · 0.50
memory_sizeMethod · 0.45
ptrMethod · 0.45
placeMethod · 0.45
dataMethod · 0.45
dtypeMethod · 0.45

Tested by

no test coverage detected