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

Method SyncDeviceContext

paddle/phi/api/lib/context_pool.cc:28–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26namespace paddle::experimental {
27
28void DeviceContextPool::SyncDeviceContext(const Place& place) {
29 if (!phi::DeviceContextPool::IsInitialized()) {
30 phi::memory_utils::InitDevices();
31 }
32 // only when we need the specific DeviceContext, get and cache it
33 auto* dev_ctx = phi::DeviceContextPool::Instance().Get(place);
34 {
35 std::lock_guard<std::mutex> lock(mutex_);
36 context_map_[place] = dev_ctx;
37 }
38}
39
40DeviceContextPool& DeviceContextPool::Instance() {
41 static DeviceContextPool g_device_context_pool;

Callers 2

RunMethod · 0.80
ZeroCopyRunMethod · 0.80

Calls 3

InstanceFunction · 0.85
InitDevicesFunction · 0.50
GetMethod · 0.45

Tested by

no test coverage detected