| 245 | } |
| 246 | |
| 247 | Result<std::shared_ptr<CudaContext>> CudaDevice::GetContext() { |
| 248 | // XXX should we cache a default context in CudaDevice instance? |
| 249 | auto context = std::shared_ptr<CudaContext>(new CudaContext()); |
| 250 | auto self = checked_pointer_cast<CudaDevice>(shared_from_this()); |
| 251 | RETURN_NOT_OK(context->impl_->Init(self)); |
| 252 | return context; |
| 253 | } |
| 254 | |
| 255 | Result<std::shared_ptr<CudaContext>> CudaDevice::GetSharedContext(void* handle) { |
| 256 | auto context = std::shared_ptr<CudaContext>(new CudaContext()); |