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

Function CurrentContext

tensorflow/stream_executor/cuda/cuda_driver.cc:88–98  ·  view source on GitHub ↗

Returns the current context and checks that it is in the set of CUDA contexts created by StreamExecutor (to ensure that the CUDA runtime didn't create a context behind our backs).

Source from the content-addressed store, hash-verified

86// created by StreamExecutor (to ensure that the CUDA runtime didn't create a
87// context behind our backs).
88CUcontext CurrentContext() {
89 CUcontext current = cuda::CurrentContextOrDie();
90 if (current != nullptr && !CreatedContexts::Has(current)) {
91 LOG(FATAL) << "current context was not created by the StreamExecutor "
92 "cuda_driver API: "
93 << current
94 << "; a CUDA runtime call "
95 "was likely performed without using a StreamExecutor context";
96 }
97 return current;
98}
99
100// CUDA driver routines may require a large amount of stack (particularly
101// cuModuleLoadDataEx, in our experience). To avoid stack overflow when using

Callers 3

ScopedActivateContextMethod · 0.85
DestroyContextMethod · 0.85

Calls 2

CurrentContextOrDieFunction · 0.85
HasFunction · 0.85

Tested by

no test coverage detected