1

CUDA 12 introduces two new API calls, cuStreamGetId() and cuCtxGetId() which return "unique ID"s associated with a stream or a context respectively. I'm struggling to understand why this is useful, or how this would be used. Are the handles for streams and contexts not unique? i.e. does CUDA create copies of CUstream_st and CUctx_st structures with the same values, or which describe the same entities? If it does - under what circumstances?

einpoklum
  • 118,144
  • 57
  • 340
  • 684
  • Maybe one could get a unique identfier for a thread's ‘cudaStreamPerThread‘ to distinguish it from another thread‘s stream – Abator Abetor Dec 26 '22 at 12:33
  • @AbatorAbetor: Well, the thread's own identifier, such as it is, plus the stream handle, constitute a unique identifier of that stream... (and quite possibly even just the handle itself is sufficient). – einpoklum Dec 26 '22 at 13:46
  • I can see it being useful for deterministic ordering, e.g. in profiler output. Plus, as I understand it, the streams are mapped onto hardware queues, e.g. [32 in Kepler](https://opus4.kobv.de/opus4-zib/frontdoor/deliver/index/docId/5036/file/ZR-14-19.pdf). It would be interesting to see if the stream ID provides the mapping and if so, can we create false serialization by issuing work only on streams whose ID has the same modulo 32. – Homer512 Dec 26 '22 at 14:58
  • My guess would be that these are the IDs one also sees in nSight Systems, so it might be useful to identify streams (contexts) when there are many. – paleonix Dec 26 '22 at 23:34
  • @paleonix: I don't know... we already have stream name assignment for that purpose, don't we? – einpoklum Dec 27 '22 at 15:53

0 Answers0