static */
| 721 | } |
| 722 | |
| 723 | /* static */ port::StatusOr<CUdevice> GpuDriver::DeviceFromContext( |
| 724 | GpuContext* context) { |
| 725 | ScopedActivateContext activated{context}; |
| 726 | CUdevice device = -1; |
| 727 | CUresult result = cuCtxGetDevice(&device); |
| 728 | if (result == CUDA_SUCCESS) { |
| 729 | return device; |
| 730 | } |
| 731 | |
| 732 | return port::Status( |
| 733 | port::error::INTERNAL, |
| 734 | absl::StrCat("failed to get device for context: ", ToString(result))); |
| 735 | } |
| 736 | |
| 737 | /* static */ bool GpuDriver::CreateStream(GpuContext* context, |
| 738 | CUstream* stream, |