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

Method DestroyContext

tensorflow/stream_executor/cuda/cuda_driver.cc:458–479  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

456}
457
458/* static */ void GpuDriver::DestroyContext(GpuContext* context) {
459 if (context == nullptr) {
460 return;
461 }
462 CUcontext former_context = CurrentContext();
463 CUresult res = cuCtxSetCurrent(context->context());
464 CUdevice device;
465 cuCtxGetDevice(&device);
466 cuCtxSetCurrent(former_context);
467
468 if (CudaPrimaryContextsMgr::Has(context->context())) {
469 res = cuDevicePrimaryCtxRelease(device);
470 } else {
471 res = cuCtxDestroy(context->context());
472 }
473
474 if (res != CUDA_SUCCESS) {
475 LOG(ERROR) << "failed to release CUDA context; leaking: " << ToString(res);
476 }
477
478 CreatedContexts::Remove(context->context());
479}
480
481/* static */ bool GpuDriver::FuncGetAttribute(CUfunction_attribute attribute,
482 CUfunction func,

Callers

nothing calls this directly

Calls 4

CurrentContextFunction · 0.85
HasFunction · 0.85
ToStringFunction · 0.70
contextMethod · 0.45

Tested by

no test coverage detected