| 45 | } |
| 46 | |
| 47 | bool CapturedGraph::begin(void* stream, std::string& err) { |
| 48 | if (graph_ || exec_) { err = "begin: this CapturedGraph is already recorded"; return false; } |
| 49 | const cudaError_t e = cudaStreamBeginCapture((cudaStream_t) stream, cudaStreamCaptureModeThreadLocal); |
| 50 | if (e != cudaSuccess) return fail(err, "cudaStreamBeginCapture", e); |
| 51 | return true; |
| 52 | } |
| 53 | |
| 54 | bool CapturedGraph::end(void* stream, std::string& err) { |
| 55 | cudaError_t e = cudaStreamEndCapture((cudaStream_t) stream, &graph_); |