How to call CUDA api with optional location?

I wonder what is the best way to call those API with optional location. For example:
CUresult cuStreamGetCaptureInfo_v2 ( CUstream hStream, CUstreamCaptureStatus* captureStatus_out, cuuint64_t* id_out, CUgraph* graph_out, const CUgraphNode** dependencies_out, size_t* numDependencies_out )
The document says id_out, graph_out are optional location. In python, if it is optional, we don’t need to specify it. If i wanted to pass in only id_out, how can I achieve that without getting the "too few arguments" error?

>Solution :

In C or C++, for a function with a prototype like that, all arguments must be specified in order to get anything to compile. This doesn’t have anything to do with CUDA.

For that particular function, all optional arguments are pointer arguments. It should be safe to pass a null pointer for any "optional" argument that you don’t wish to specify.

Leave a Reply