cudaStreamCreate() calls in OptixHello and OptixTriangle samples

Hi,

I have a small suggestion to make.

The above two samples issue a call to cudaStreamCreate() just before the call to optixLaunch().

Here is where I see the problem: these two samples in particular are likely to act as a starting point for a lot of people, so I imagine that the call to cudaStreamCreate() can easily creep into the main loop, potentially causing a memory leak if it’s not destroyed. At the very least this happened to me.

So I’d suggest to either add a call to cudaStreamDestroy() just before exiting the “launch” block, or just use nullptr as the stream argument for optixLaunch().

PS: on a side note I have another question. When running Nsight Compute via CLI, it will print context and stream information (e.g. >kernel<, >date<, Context 1, Stream 13). Where can I find this information in the GUI?

Hi @kebiro, welcome!

Thanks for the suggestion, we’ll take it under advisement. We do want to explicitly model using CUDA streams and encourage people to know how to work with streams as a best practice, but it’s a good point that it’s not being explicitly cleaned up in the samples. At the very least maybe we can add a comment.

For the Nsight Compute question, I don’t know about context and stream IDs, but date and kernel and lots of other stats are available on the Session and Details pages, and the kernel to inspect is available in the “Result” drop-down near the top left, next to the “Page” drop down.


David.

1 Like