Array used by all the streams

Dear All

Sorry the naive question. Any array copied from host to device before a stream was created can be used by any posterior stream as I give the GPU pointer to that array? Or there is some special procedure to a stream use data in GPU transfered with "null" stream (before created any stream)?  


Luis Gonçalves


Ordinary global allocations (e.g. with cudaMalloc) have no association with a particular stream. In a single-device setting, a pointer created by cudaMalloc can be used by any stream, at any time. There is a device association for a given pointer (of this type), however, and if you associate streams with devices in a multi-device scenario (as you should) then you should use pointers in streams associated with the device those pointers were allocated on (with perhaps a few exceptions, such as P2P copies).

The situation is slightly different with Unified Memory, but that is not what your question is about, I don’t think.