| 273 | } |
| 274 | |
| 275 | Result<std::shared_ptr<Device::Stream>> CudaDevice::MakeStream(unsigned int flags) { |
| 276 | ARROW_ASSIGN_OR_RAISE(auto context, GetContext()); |
| 277 | ContextSaver set_temporary(reinterpret_cast<CUcontext>(context.get()->handle())); |
| 278 | |
| 279 | CUstream stream; |
| 280 | CU_RETURN_NOT_OK("cuStreamCreate", cuStreamCreate(&stream, flags)); |
| 281 | return std::shared_ptr<Device::Stream>( |
| 282 | new CudaDevice::Stream(context, new CUstream(stream), [](void* st) { |
| 283 | auto typed_stream = reinterpret_cast<CUstream*>(st); |
| 284 | // DCHECK_OK still evaluates its argument in release mode |
| 285 | // but in debug mode it'll also throw if it fails |
| 286 | DCHECK_OK( |
| 287 | internal::StatusFromCuda(cuStreamDestroy(*typed_stream), "cuStreamDestroy")); |
| 288 | delete typed_stream; |
| 289 | })); |
| 290 | } |
| 291 | |
| 292 | Result<std::shared_ptr<Device::Stream>> CudaDevice::WrapStream( |
| 293 | void* stream, Device::Stream::release_fn_t release_fn) { |
nothing calls this directly
no test coverage detected