After a quick skim of the Runtime API’s Graph Management functions, I’m not seeing any information on the lifetimes of cudaGraph_t and cudaGraphExec_t objects.
I’m going to assume that the API supports destroying cudaGraph_t and cudaGraphExec_t objects as soon as they’re no longer needed.
Specifically:
cudaGraphCreate(&cg) // create the graph
// add nodes... // build the graph
cudaGraphInstantiate(&cge,cg) // build the executable
cudaGraphDestroy(cg) // we're done with the graph so destroy it
cudaGraphLaunch(cge,stream) // launch the executable
cudaGraphExecDestroy(cge) // we're done with the executable so destroy it
Please confirm!