Some confusion about green context default stream

cuGreenCtxCreate api

  • CU_GREEN_CTX_DEFAULT_STREAM : Creates a default stream to use inside the green context. Required.

1.what is different between this deault stream with cuda system null stream

2.what is difference between this deault stream with stream create by cuGreenCtxStreamCreate

3. can I use green context stream with normal stream simultaneously on the same device?

4. can I use grenn context stream with deault stream simultaneously ?

It is the same. The notion of a green context is that it is a reduced context - not fully featured. For example you must explicitly create or add SMs to it. Likewise, you have to explicitly create or add the default stream, also called the null stream.

The API call cuGreenCtxStreamCreate creates an “ordinary” created stream for the green context. This stream is different from the green context default stream in the same way that an ordinary created stream for an ordinary context is different from the default stream for an ordinary context.

Yes, if you have both types of contexts created for that device.

Yes, if you have both types of contexts and streams created.

                green context                                           ordinary context
                /           \                                           /             \
 green_ctx_default_stream  green_ctx_ordinary_stream ordinary_ctx_default_stream  ordinary_ctx_ordinary_stream
   cuGreenCtxCreate         cuGreenCtxStreamCreate           cuCtxCreate                      cuStreamCreate

In the diagram above, the default streams are required and always present when their respective contexts are created. The ordinary streams are created if you create them.