MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / cudaStream_t GetCurrentCUDAStream

Function cudaStream_t GetCurrentCUDAStream

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

Source from the content-addressed store, hash-verified

89}
90#elif defined(PADDLE_WITH_XPU)
91PADDLE_API cudaStream_t GetCurrentCUDAStream(const phi::Place& place) {
92 PADDLE_ENFORCE_EQ(place.GetType(),
93 phi::AllocationType::XPU,
94 common::errors::InvalidArgument(
95 "GetCurrentCUDAStream only supports XPUPlace input. "
96 "However, your input is place=%s",
97 place));
98
99 auto& pool = paddle::experimental::DeviceContextPool::Instance();
100 const phi::XPUContext* dev_ctx =
101 static_cast<const phi::XPUContext*>(pool.Get(place));
102 return reinterpret_cast<cudaStream_t>(dev_ctx->stream());
103}
104#endif
105
106} // namespace paddle

Callers

nothing calls this directly

Calls 4

InstanceFunction · 0.85
GetTypeMethod · 0.45
GetMethod · 0.45
streamMethod · 0.45

Tested by

no test coverage detected