Sophie

Sophie

distrib > Mageia > 7 > x86_64 > media > nonfree-updates > by-pkgid > b86a85131cc739c1c53d0b55840a4328 > files > 3885

nvidia-cuda-toolkit-devel-10.1.168-1.2.mga7.nonfree.x86_64.rpm

.TH "Stream Management" 3 "24 Apr 2019" "Version 6.0" "Doxygen" \" -*- nroff -*-
.ad l
.nh
.SH NAME
Stream Management \- 
.SS "Functions"

.in +1c
.ti -1c
.RI "\fBCUresult\fP \fBcuStreamAddCallback\fP (\fBCUstream\fP hStream, \fBCUstreamCallback\fP callback, void *userData, unsigned int flags)"
.br
.RI "\fIAdd a callback to a compute stream. \fP"
.ti -1c
.RI "\fBCUresult\fP \fBcuStreamAttachMemAsync\fP (\fBCUstream\fP hStream, \fBCUdeviceptr\fP dptr, size_t length, unsigned int flags)"
.br
.RI "\fIAttach memory to a stream asynchronously. \fP"
.ti -1c
.RI "\fBCUresult\fP \fBcuStreamBeginCapture\fP (\fBCUstream\fP hStream, \fBCUstreamCaptureMode\fP mode)"
.br
.RI "\fIBegins graph capture on a stream. \fP"
.ti -1c
.RI "\fBCUresult\fP \fBcuStreamCreate\fP (\fBCUstream\fP *phStream, unsigned int Flags)"
.br
.RI "\fICreate a stream. \fP"
.ti -1c
.RI "\fBCUresult\fP \fBcuStreamCreateWithPriority\fP (\fBCUstream\fP *phStream, unsigned int flags, int priority)"
.br
.RI "\fICreate a stream with the given priority. \fP"
.ti -1c
.RI "\fBCUresult\fP \fBcuStreamDestroy\fP (\fBCUstream\fP hStream)"
.br
.RI "\fIDestroys a stream. \fP"
.ti -1c
.RI "\fBCUresult\fP \fBcuStreamEndCapture\fP (\fBCUstream\fP hStream, \fBCUgraph\fP *phGraph)"
.br
.RI "\fIEnds capture on a stream, returning the captured graph. \fP"
.ti -1c
.RI "\fBCUresult\fP \fBcuStreamGetCaptureInfo\fP (\fBCUstream\fP hStream, \fBCUstreamCaptureStatus\fP *captureStatus, cuuint64_t *id)"
.br
.RI "\fIQuery capture status of a stream. \fP"
.ti -1c
.RI "\fBCUresult\fP \fBcuStreamGetCtx\fP (\fBCUstream\fP hStream, \fBCUcontext\fP *pctx)"
.br
.RI "\fIQuery the context associated with a stream. \fP"
.ti -1c
.RI "\fBCUresult\fP \fBcuStreamGetFlags\fP (\fBCUstream\fP hStream, unsigned int *flags)"
.br
.RI "\fIQuery the flags of a given stream. \fP"
.ti -1c
.RI "\fBCUresult\fP \fBcuStreamGetPriority\fP (\fBCUstream\fP hStream, int *priority)"
.br
.RI "\fIQuery the priority of a given stream. \fP"
.ti -1c
.RI "\fBCUresult\fP \fBcuStreamIsCapturing\fP (\fBCUstream\fP hStream, \fBCUstreamCaptureStatus\fP *captureStatus)"
.br
.RI "\fIReturns a stream's capture status. \fP"
.ti -1c
.RI "\fBCUresult\fP \fBcuStreamQuery\fP (\fBCUstream\fP hStream)"
.br
.RI "\fIDetermine status of a compute stream. \fP"
.ti -1c
.RI "\fBCUresult\fP \fBcuStreamSynchronize\fP (\fBCUstream\fP hStream)"
.br
.RI "\fIWait until a stream's tasks are completed. \fP"
.ti -1c
.RI "\fBCUresult\fP \fBcuStreamWaitEvent\fP (\fBCUstream\fP hStream, \fBCUevent\fP hEvent, unsigned int Flags)"
.br
.RI "\fIMake a compute stream wait on an event. \fP"
.ti -1c
.RI "\fBCUresult\fP \fBcuThreadExchangeStreamCaptureMode\fP (\fBCUstreamCaptureMode\fP *mode)"
.br
.RI "\fISwaps the stream capture interaction mode for a thread. \fP"
.in -1c
.SH "Detailed Description"
.PP 
\\brief stream management functions of the low-level CUDA driver API (\fBcuda.h\fP)
.PP
This section describes the stream management functions of the low-level CUDA driver application programming interface. 
.SH "Function Documentation"
.PP 
.SS "\fBCUresult\fP cuStreamAddCallback (\fBCUstream\fP hStream, \fBCUstreamCallback\fP callback, void * userData, unsigned int flags)"
.PP
\fBNote:\fP
.RS 4
This function is slated for eventual deprecation and removal. If you do not require the callback to execute in case of a device error, consider using \fBcuLaunchHostFunc\fP. Additionally, this function is not supported with \fBcuStreamBeginCapture\fP and \fBcuStreamEndCapture\fP, unlike \fBcuLaunchHostFunc\fP.
.RE
.PP
Adds a callback to be called on the host after all currently enqueued items in the stream have completed. For each cuStreamAddCallback call, the callback will be executed exactly once. The callback will block later work in the stream until it is finished.
.PP
The callback may be passed \fBCUDA_SUCCESS\fP or an error code. In the event of a device error, all subsequently executed callbacks will receive an appropriate \fBCUresult\fP.
.PP
Callbacks must not make any CUDA API calls. Attempting to use a CUDA API will result in \fBCUDA_ERROR_NOT_PERMITTED\fP. Callbacks must not perform any synchronization that may depend on outstanding device work or other callbacks that are not mandated to run earlier. Callbacks without a mandated order (in independent streams) execute in undefined order and may be serialized.
.PP
For the purposes of Unified Memory, callback execution makes a number of guarantees: 
.PD 0

.IP "\(bu" 2
The callback stream is considered idle for the duration of the callback. Thus, for example, a callback may always use memory attached to the callback stream. 
.IP "\(bu" 2
The start of execution of a callback has the same effect as synchronizing an event recorded in the same stream immediately prior to the callback. It thus synchronizes streams which have been 'joined' prior to the callback. 
.IP "\(bu" 2
Adding device work to any stream does not have the effect of making the stream active until all preceding host functions and stream callbacks have executed. Thus, for example, a callback might use global attached memory even if work has been added to another stream, if the work has been ordered behind the callback with an event. 
.IP "\(bu" 2
Completion of a callback does not cause a stream to become active except as described above. The callback stream will remain idle if no device work follows the callback, and will remain idle across consecutive callbacks without device work in between. Thus, for example, stream synchronization can be done by signaling from a callback at the end of the stream. 
.PP
.PP
\fBParameters:\fP
.RS 4
\fIhStream\fP - Stream to add callback to 
.br
\fIcallback\fP - The function to call once preceding stream operations are complete 
.br
\fIuserData\fP - User specified data to be passed to the callback function 
.br
\fIflags\fP - Reserved for future use, must be 0
.RE
.PP
\fBReturns:\fP
.RS 4
\fBCUDA_SUCCESS\fP, \fBCUDA_ERROR_DEINITIALIZED\fP, \fBCUDA_ERROR_NOT_INITIALIZED\fP, \fBCUDA_ERROR_INVALID_CONTEXT\fP, \fBCUDA_ERROR_INVALID_HANDLE\fP, \fBCUDA_ERROR_NOT_SUPPORTED\fP 
.RE
.PP
\fBNote:\fP
.RS 4
This function uses standard  semantics. 
.PP
Note that this function may also return error codes from previous, asynchronous launches.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBcuStreamCreate\fP, \fBcuStreamQuery\fP, \fBcuStreamSynchronize\fP, \fBcuStreamWaitEvent\fP, \fBcuStreamDestroy\fP, \fBcuMemAllocManaged\fP, \fBcuStreamAttachMemAsync\fP, cuStreamLaunchHostFunc, cudaStreamAddCallback 
.RE
.PP

.SS "\fBCUresult\fP cuStreamAttachMemAsync (\fBCUstream\fP hStream, \fBCUdeviceptr\fP dptr, size_t length, unsigned int flags)"
.PP
Enqueues an operation in \fChStream\fP to specify stream association of \fClength\fP bytes of memory starting from \fCdptr\fP. This function is a stream-ordered operation, meaning that it is dependent on, and will only take effect when, previous work in stream has completed. Any previous association is automatically replaced.
.PP
\fCdptr\fP must point to one of the following types of memories:
.IP "\(bu" 2
managed memory declared using the __managed__ keyword or allocated with \fBcuMemAllocManaged\fP.
.IP "\(bu" 2
a valid host-accessible region of system-allocated pageable memory. This type of memory may only be specified if the device associated with the stream reports a non-zero value for the device attribute \fBCU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS\fP.
.PP
.PP
For managed allocations, \fClength\fP must be either zero or the entire allocation's size. Both indicate that the entire allocation's stream association is being changed. Currently, it is not possible to change stream association for a portion of a managed allocation.
.PP
For pageable host allocations, \fClength\fP must be non-zero.
.PP
The stream association is specified using \fCflags\fP which must be one of \fBCUmemAttach_flags\fP. If the \fBCU_MEM_ATTACH_GLOBAL\fP flag is specified, the memory can be accessed by any stream on any device. If the \fBCU_MEM_ATTACH_HOST\fP flag is specified, the program makes a guarantee that it won't access the memory on the device from any stream on a device that has a zero value for the device attribute \fBCU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS\fP. If the \fBCU_MEM_ATTACH_SINGLE\fP flag is specified and \fChStream\fP is associated with a device that has a zero value for the device attribute \fBCU_DEVICE_ATTRIBUTE_CONCURRENT_MANAGED_ACCESS\fP, the program makes a guarantee that it will only access the memory on the device from \fChStream\fP. It is illegal to attach singly to the NULL stream, because the NULL stream is a virtual global stream and not a specific stream. An error will be returned in this case.
.PP
When memory is associated with a single stream, the Unified Memory system will allow CPU access to this memory region so long as all operations in \fChStream\fP have completed, regardless of whether other streams are active. In effect, this constrains exclusive ownership of the managed memory region by an active GPU to per-stream activity instead of whole-GPU activity.
.PP
Accessing memory on the device from streams that are not associated with it will produce undefined results. No error checking is performed by the Unified Memory system to ensure that kernels launched into other streams do not access this region.
.PP
It is a program's responsibility to order calls to \fBcuStreamAttachMemAsync\fP via events, synchronization or other means to ensure legal access to memory at all times. Data visibility and coherency will be changed appropriately for all kernels which follow a stream-association change.
.PP
If \fChStream\fP is destroyed while data is associated with it, the association is removed and the association reverts to the default visibility of the allocation as specified at \fBcuMemAllocManaged\fP. For __managed__ variables, the default association is always \fBCU_MEM_ATTACH_GLOBAL\fP. Note that destroying a stream is an asynchronous operation, and as a result, the change to default association won't happen until all work in the stream has completed.
.PP
\fBParameters:\fP
.RS 4
\fIhStream\fP - Stream in which to enqueue the attach operation 
.br
\fIdptr\fP - Pointer to memory (must be a pointer to managed memory or to a valid host-accessible region of system-allocated pageable memory) 
.br
\fIlength\fP - Length of memory 
.br
\fIflags\fP - Must be one of \fBCUmemAttach_flags\fP
.RE
.PP
\fBReturns:\fP
.RS 4
\fBCUDA_SUCCESS\fP, \fBCUDA_ERROR_DEINITIALIZED\fP, \fBCUDA_ERROR_NOT_INITIALIZED\fP, \fBCUDA_ERROR_INVALID_CONTEXT\fP, \fBCUDA_ERROR_INVALID_HANDLE\fP, \fBCUDA_ERROR_NOT_SUPPORTED\fP 
.RE
.PP
\fBNote:\fP
.RS 4
This function uses standard  semantics. 
.PP
Note that this function may also return error codes from previous, asynchronous launches.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBcuStreamCreate\fP, \fBcuStreamQuery\fP, \fBcuStreamSynchronize\fP, \fBcuStreamWaitEvent\fP, \fBcuStreamDestroy\fP, \fBcuMemAllocManaged\fP, cudaStreamAttachMemAsync 
.RE
.PP

.SS "\fBCUresult\fP cuStreamBeginCapture (\fBCUstream\fP hStream, \fBCUstreamCaptureMode\fP mode)"
.PP
Begin graph capture on \fChStream\fP. When a stream is in capture mode, all operations pushed into the stream will not be executed, but will instead be captured into a graph, which will be returned via \fBcuStreamEndCapture\fP. Capture may not be initiated if \fCstream\fP is CU_STREAM_LEGACY. Capture must be ended on the same stream in which it was initiated, and it may only be initiated if the stream is not already in capture mode. The capture mode may be queried via \fBcuStreamIsCapturing\fP. A unique id representing the capture sequence may be queried via \fBcuStreamGetCaptureInfo\fP.
.PP
If \fCmode\fP is not CU_STREAM_CAPTURE_MODE_RELAXED, \fBcuStreamEndCapture\fP must be called on this stream from the same thread.
.PP
\fBParameters:\fP
.RS 4
\fIhStream\fP - Stream in which to initiate capture 
.br
\fImode\fP - Controls the interaction of this capture sequence with other API calls that are potentially unsafe. For more details see \fBcuThreadExchangeStreamCaptureMode\fP.
.RE
.PP
\fBNote:\fP
.RS 4
Kernels captured using this API must not use texture and surface references. Reading or writing through any texture or surface reference is undefined behavior. This restriction does not apply to texture and surface objects.
.RE
.PP
\fBReturns:\fP
.RS 4
\fBCUDA_SUCCESS\fP, \fBCUDA_ERROR_DEINITIALIZED\fP, \fBCUDA_ERROR_NOT_INITIALIZED\fP, \fBCUDA_ERROR_INVALID_VALUE\fP 
.RE
.PP
\fBNote:\fP
.RS 4
Note that this function may also return error codes from previous, asynchronous launches.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBcuStreamCreate\fP, \fBcuStreamIsCapturing\fP, \fBcuStreamEndCapture\fP, \fBcuThreadExchangeStreamCaptureMode\fP 
.RE
.PP

.SS "\fBCUresult\fP cuStreamCreate (\fBCUstream\fP * phStream, unsigned int Flags)"
.PP
Creates a stream and returns a handle in \fCphStream\fP. The \fCFlags\fP argument determines behaviors of the stream. Valid values for \fCFlags\fP are:
.IP "\(bu" 2
\fBCU_STREAM_DEFAULT\fP: Default stream creation flag.
.IP "\(bu" 2
\fBCU_STREAM_NON_BLOCKING\fP: Specifies that work running in the created stream may run concurrently with work in stream 0 (the NULL stream), and that the created stream should perform no implicit synchronization with stream 0.
.PP
.PP
\fBParameters:\fP
.RS 4
\fIphStream\fP - Returned newly created stream 
.br
\fIFlags\fP - Parameters for stream creation
.RE
.PP
\fBReturns:\fP
.RS 4
\fBCUDA_SUCCESS\fP, \fBCUDA_ERROR_DEINITIALIZED\fP, \fBCUDA_ERROR_NOT_INITIALIZED\fP, \fBCUDA_ERROR_INVALID_CONTEXT\fP, \fBCUDA_ERROR_INVALID_VALUE\fP, \fBCUDA_ERROR_OUT_OF_MEMORY\fP 
.RE
.PP
\fBNote:\fP
.RS 4
Note that this function may also return error codes from previous, asynchronous launches.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBcuStreamDestroy\fP, \fBcuStreamCreateWithPriority\fP, \fBcuStreamGetPriority\fP, \fBcuStreamGetFlags\fP, \fBcuStreamWaitEvent\fP, \fBcuStreamQuery\fP, \fBcuStreamSynchronize\fP, \fBcuStreamAddCallback\fP, cudaStreamCreate, cudaStreamCreateWithFlags 
.RE
.PP

.SS "\fBCUresult\fP cuStreamCreateWithPriority (\fBCUstream\fP * phStream, unsigned int flags, int priority)"
.PP
Creates a stream with the specified priority and returns a handle in \fCphStream\fP. This API alters the scheduler priority of work in the stream. Work in a higher priority stream may preempt work already executing in a low priority stream.
.PP
\fCpriority\fP follows a convention where lower numbers represent higher priorities. '0' represents default priority. The range of meaningful numerical priorities can be queried using \fBcuCtxGetStreamPriorityRange\fP. If the specified priority is outside the numerical range returned by \fBcuCtxGetStreamPriorityRange\fP, it will automatically be clamped to the lowest or the highest number in the range.
.PP
\fBParameters:\fP
.RS 4
\fIphStream\fP - Returned newly created stream 
.br
\fIflags\fP - Flags for stream creation. See \fBcuStreamCreate\fP for a list of valid flags 
.br
\fIpriority\fP - Stream priority. Lower numbers represent higher priorities. See \fBcuCtxGetStreamPriorityRange\fP for more information about meaningful stream priorities that can be passed.
.RE
.PP
\fBReturns:\fP
.RS 4
\fBCUDA_SUCCESS\fP, \fBCUDA_ERROR_DEINITIALIZED\fP, \fBCUDA_ERROR_NOT_INITIALIZED\fP, \fBCUDA_ERROR_INVALID_CONTEXT\fP, \fBCUDA_ERROR_INVALID_VALUE\fP, \fBCUDA_ERROR_OUT_OF_MEMORY\fP 
.RE
.PP
\fBNote:\fP
.RS 4
Note that this function may also return error codes from previous, asynchronous launches.
.PP
Stream priorities are supported only on GPUs with compute capability 3.5 or higher.
.PP
In the current implementation, only compute kernels launched in priority streams are affected by the stream's priority. Stream priorities have no effect on host-to-device and device-to-host memory operations.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBcuStreamDestroy\fP, \fBcuStreamCreate\fP, \fBcuStreamGetPriority\fP, \fBcuCtxGetStreamPriorityRange\fP, \fBcuStreamGetFlags\fP, \fBcuStreamWaitEvent\fP, \fBcuStreamQuery\fP, \fBcuStreamSynchronize\fP, \fBcuStreamAddCallback\fP, cudaStreamCreateWithPriority 
.RE
.PP

.SS "\fBCUresult\fP cuStreamDestroy (\fBCUstream\fP hStream)"
.PP
Destroys the stream specified by \fChStream\fP.
.PP
In case the device is still doing work in the stream \fChStream\fP when \fBcuStreamDestroy()\fP is called, the function will return immediately and the resources associated with \fChStream\fP will be released automatically once the device has completed all work in \fChStream\fP.
.PP
\fBParameters:\fP
.RS 4
\fIhStream\fP - Stream to destroy
.RE
.PP
\fBReturns:\fP
.RS 4
\fBCUDA_SUCCESS\fP, \fBCUDA_ERROR_DEINITIALIZED\fP, \fBCUDA_ERROR_NOT_INITIALIZED\fP, \fBCUDA_ERROR_INVALID_CONTEXT\fP, \fBCUDA_ERROR_INVALID_VALUE\fP, \fBCUDA_ERROR_INVALID_HANDLE\fP 
.RE
.PP
\fBNote:\fP
.RS 4
Note that this function may also return error codes from previous, asynchronous launches.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBcuStreamCreate\fP, \fBcuStreamWaitEvent\fP, \fBcuStreamQuery\fP, \fBcuStreamSynchronize\fP, \fBcuStreamAddCallback\fP, cudaStreamDestroy 
.RE
.PP

.SS "\fBCUresult\fP cuStreamEndCapture (\fBCUstream\fP hStream, \fBCUgraph\fP * phGraph)"
.PP
End capture on \fChStream\fP, returning the captured graph via \fCphGraph\fP. Capture must have been initiated on \fChStream\fP via a call to \fBcuStreamBeginCapture\fP. If capture was invalidated, due to a violation of the rules of stream capture, then a NULL graph will be returned.
.PP
If the \fCmode\fP argument to \fBcuStreamBeginCapture\fP was not CU_STREAM_CAPTURE_MODE_RELAXED, this call must be from the same thread as \fBcuStreamBeginCapture\fP.
.PP
\fBParameters:\fP
.RS 4
\fIhStream\fP - Stream to query 
.br
\fIphGraph\fP - The captured graph
.RE
.PP
\fBReturns:\fP
.RS 4
\fBCUDA_SUCCESS\fP, \fBCUDA_ERROR_DEINITIALIZED\fP, \fBCUDA_ERROR_NOT_INITIALIZED\fP, \fBCUDA_ERROR_INVALID_VALUE\fP, \fBCUDA_ERROR_STREAM_CAPTURE_WRONG_THREAD\fP 
.RE
.PP
\fBNote:\fP
.RS 4
Note that this function may also return error codes from previous, asynchronous launches.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBcuStreamCreate\fP, \fBcuStreamBeginCapture\fP, \fBcuStreamIsCapturing\fP 
.RE
.PP

.SS "\fBCUresult\fP cuStreamGetCaptureInfo (\fBCUstream\fP hStream, \fBCUstreamCaptureStatus\fP * captureStatus, cuuint64_t * id)"
.PP
Query the capture status of a stream and and get an id for the capture sequence, which is unique over the lifetime of the process.
.PP
If called on \fBCU_STREAM_LEGACY\fP (the 'null stream') while a stream not created with \fBCU_STREAM_NON_BLOCKING\fP is capturing, returns \fBCUDA_ERROR_STREAM_CAPTURE_IMPLICIT\fP.
.PP
A valid id is returned only if both of the following are true:
.IP "\(bu" 2
the call returns CUDA_SUCCESS
.IP "\(bu" 2
captureStatus is set to \fBCU_STREAM_CAPTURE_STATUS_ACTIVE\fP
.PP
.PP
\fBReturns:\fP
.RS 4
\fBCUDA_SUCCESS\fP, \fBCUDA_ERROR_STREAM_CAPTURE_IMPLICIT\fP 
.RE
.PP
\fBNote:\fP
.RS 4
Note that this function may also return error codes from previous, asynchronous launches.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBcuStreamBeginCapture\fP, \fBcuStreamIsCapturing\fP 
.RE
.PP

.SS "\fBCUresult\fP cuStreamGetCtx (\fBCUstream\fP hStream, \fBCUcontext\fP * pctx)"
.PP
Returns the CUDA context that the stream is associated with.
.PP
The stream handle \fChStream\fP can refer to any of the following: 
.PD 0

.IP "\(bu" 2
a stream created via any of the CUDA driver APIs such as \fBcuStreamCreate\fP and \fBcuStreamCreateWithPriority\fP, or their runtime API equivalents such as cudaStreamCreate, cudaStreamCreateWithFlags and cudaStreamCreateWithPriority. The returned context is the context that was active in the calling thread when the stream was created. Passing an invalid handle will result in undefined behavior. 
.IP "\(bu" 2
any of the special streams such as the NULL stream, \fBCU_STREAM_LEGACY\fP and \fBCU_STREAM_PER_THREAD\fP. The runtime API equivalents of these are also accepted, which are NULL, cudaStreamLegacy and cudaStreamPerThread respectively. Specifying any of the special handles will return the context current to the calling thread. If no context is current to the calling thread, \fBCUDA_ERROR_INVALID_CONTEXT\fP is returned. 
.PP
.PP
\fBParameters:\fP
.RS 4
\fIhStream\fP - Handle to the stream to be queried 
.br
\fIpctx\fP - Returned context associated with the stream
.RE
.PP
\fBReturns:\fP
.RS 4
\fBCUDA_SUCCESS\fP, \fBCUDA_ERROR_DEINITIALIZED\fP, \fBCUDA_ERROR_NOT_INITIALIZED\fP, \fBCUDA_ERROR_INVALID_CONTEXT\fP, \fBCUDA_ERROR_INVALID_HANDLE\fP, 
.RE
.PP
\fBNote:\fP
.RS 4
Note that this function may also return error codes from previous, asynchronous launches.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBcuStreamDestroy\fP, \fBcuStreamCreateWithPriority\fP, \fBcuStreamGetPriority\fP, \fBcuStreamGetFlags\fP, \fBcuStreamWaitEvent\fP, \fBcuStreamQuery\fP, \fBcuStreamSynchronize\fP, \fBcuStreamAddCallback\fP, cudaStreamCreate, cudaStreamCreateWithFlags 
.RE
.PP

.SS "\fBCUresult\fP cuStreamGetFlags (\fBCUstream\fP hStream, unsigned int * flags)"
.PP
Query the flags of a stream created using \fBcuStreamCreate\fP or \fBcuStreamCreateWithPriority\fP and return the flags in \fCflags\fP.
.PP
\fBParameters:\fP
.RS 4
\fIhStream\fP - Handle to the stream to be queried 
.br
\fIflags\fP - Pointer to an unsigned integer in which the stream's flags are returned The value returned in \fCflags\fP is a logical 'OR' of all flags that were used while creating this stream. See \fBcuStreamCreate\fP for the list of valid flags 
.RE
.PP
\fBReturns:\fP
.RS 4
\fBCUDA_SUCCESS\fP, \fBCUDA_ERROR_DEINITIALIZED\fP, \fBCUDA_ERROR_NOT_INITIALIZED\fP, \fBCUDA_ERROR_INVALID_CONTEXT\fP, \fBCUDA_ERROR_INVALID_VALUE\fP, \fBCUDA_ERROR_INVALID_HANDLE\fP, \fBCUDA_ERROR_OUT_OF_MEMORY\fP 
.RE
.PP
\fBNote:\fP
.RS 4
Note that this function may also return error codes from previous, asynchronous launches.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBcuStreamDestroy\fP, \fBcuStreamCreate\fP, \fBcuStreamGetPriority\fP, cudaStreamGetFlags 
.RE
.PP

.SS "\fBCUresult\fP cuStreamGetPriority (\fBCUstream\fP hStream, int * priority)"
.PP
Query the priority of a stream created using \fBcuStreamCreate\fP or \fBcuStreamCreateWithPriority\fP and return the priority in \fCpriority\fP. Note that if the stream was created with a priority outside the numerical range returned by \fBcuCtxGetStreamPriorityRange\fP, this function returns the clamped priority. See \fBcuStreamCreateWithPriority\fP for details about priority clamping.
.PP
\fBParameters:\fP
.RS 4
\fIhStream\fP - Handle to the stream to be queried 
.br
\fIpriority\fP - Pointer to a signed integer in which the stream's priority is returned 
.RE
.PP
\fBReturns:\fP
.RS 4
\fBCUDA_SUCCESS\fP, \fBCUDA_ERROR_DEINITIALIZED\fP, \fBCUDA_ERROR_NOT_INITIALIZED\fP, \fBCUDA_ERROR_INVALID_CONTEXT\fP, \fBCUDA_ERROR_INVALID_VALUE\fP, \fBCUDA_ERROR_INVALID_HANDLE\fP, \fBCUDA_ERROR_OUT_OF_MEMORY\fP 
.RE
.PP
\fBNote:\fP
.RS 4
Note that this function may also return error codes from previous, asynchronous launches.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBcuStreamDestroy\fP, \fBcuStreamCreate\fP, \fBcuStreamCreateWithPriority\fP, \fBcuCtxGetStreamPriorityRange\fP, \fBcuStreamGetFlags\fP, cudaStreamGetPriority 
.RE
.PP

.SS "\fBCUresult\fP cuStreamIsCapturing (\fBCUstream\fP hStream, \fBCUstreamCaptureStatus\fP * captureStatus)"
.PP
Return the capture status of \fChStream\fP via \fCcaptureStatus\fP. After a successful call, \fC*captureStatus\fP will contain one of the following:
.IP "\(bu" 2
\fBCU_STREAM_CAPTURE_STATUS_NONE\fP: The stream is not capturing.
.IP "\(bu" 2
\fBCU_STREAM_CAPTURE_STATUS_ACTIVE\fP: The stream is capturing.
.IP "\(bu" 2
\fBCU_STREAM_CAPTURE_STATUS_INVALIDATED\fP: The stream was capturing but an error has invalidated the capture sequence. The capture sequence must be terminated with \fBcuStreamEndCapture\fP on the stream where it was initiated in order to continue using \fChStream\fP.
.PP
.PP
Note that, if this is called on \fBCU_STREAM_LEGACY\fP (the 'null stream') while a blocking stream in the same context is capturing, it will return \fBCUDA_ERROR_STREAM_CAPTURE_IMPLICIT\fP and \fC*captureStatus\fP is unspecified after the call. The blocking stream capture is not invalidated.
.PP
When a blocking stream is capturing, the legacy stream is in an unusable state until the blocking stream capture is terminated. The legacy stream is not supported for stream capture, but attempted use would have an implicit dependency on the capturing stream(s).
.PP
\fBParameters:\fP
.RS 4
\fIhStream\fP - Stream to query 
.br
\fIcaptureStatus\fP - Returns the stream's capture status
.RE
.PP
\fBReturns:\fP
.RS 4
\fBCUDA_SUCCESS\fP, \fBCUDA_ERROR_DEINITIALIZED\fP, \fBCUDA_ERROR_NOT_INITIALIZED\fP, \fBCUDA_ERROR_INVALID_VALUE\fP, \fBCUDA_ERROR_STREAM_CAPTURE_IMPLICIT\fP 
.RE
.PP
\fBNote:\fP
.RS 4
Note that this function may also return error codes from previous, asynchronous launches.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBcuStreamCreate\fP, \fBcuStreamBeginCapture\fP, \fBcuStreamEndCapture\fP 
.RE
.PP

.SS "\fBCUresult\fP cuStreamQuery (\fBCUstream\fP hStream)"
.PP
Returns \fBCUDA_SUCCESS\fP if all operations in the stream specified by \fChStream\fP have completed, or \fBCUDA_ERROR_NOT_READY\fP if not.
.PP
For the purposes of Unified Memory, a return value of \fBCUDA_SUCCESS\fP is equivalent to having called \fBcuStreamSynchronize()\fP.
.PP
\fBParameters:\fP
.RS 4
\fIhStream\fP - Stream to query status of
.RE
.PP
\fBReturns:\fP
.RS 4
\fBCUDA_SUCCESS\fP, \fBCUDA_ERROR_DEINITIALIZED\fP, \fBCUDA_ERROR_NOT_INITIALIZED\fP, \fBCUDA_ERROR_INVALID_CONTEXT\fP, \fBCUDA_ERROR_INVALID_HANDLE\fP, \fBCUDA_ERROR_NOT_READY\fP 
.RE
.PP
\fBNote:\fP
.RS 4
This function uses standard  semantics. 
.PP
Note that this function may also return error codes from previous, asynchronous launches.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBcuStreamCreate\fP, \fBcuStreamWaitEvent\fP, \fBcuStreamDestroy\fP, \fBcuStreamSynchronize\fP, \fBcuStreamAddCallback\fP, cudaStreamQuery 
.RE
.PP

.SS "\fBCUresult\fP cuStreamSynchronize (\fBCUstream\fP hStream)"
.PP
Waits until the device has completed all operations in the stream specified by \fChStream\fP. If the context was created with the \fBCU_CTX_SCHED_BLOCKING_SYNC\fP flag, the CPU thread will block until the stream is finished with all of its tasks.
.PP
\fBParameters:\fP
.RS 4
\fIhStream\fP - Stream to wait for
.RE
.PP
\fBReturns:\fP
.RS 4
\fBCUDA_SUCCESS\fP, \fBCUDA_ERROR_DEINITIALIZED\fP, \fBCUDA_ERROR_NOT_INITIALIZED\fP, \fBCUDA_ERROR_INVALID_CONTEXT\fP, \fBCUDA_ERROR_INVALID_HANDLE\fP
.RE
.PP
\fBNote:\fP
.RS 4
This function uses standard  semantics. 
.PP
Note that this function may also return error codes from previous, asynchronous launches.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBcuStreamCreate\fP, \fBcuStreamDestroy\fP, \fBcuStreamWaitEvent\fP, \fBcuStreamQuery\fP, \fBcuStreamAddCallback\fP, cudaStreamSynchronize 
.RE
.PP

.SS "\fBCUresult\fP cuStreamWaitEvent (\fBCUstream\fP hStream, \fBCUevent\fP hEvent, unsigned int Flags)"
.PP
Makes all future work submitted to \fChStream\fP wait for all work captured in \fChEvent\fP. See \fBcuEventRecord()\fP for details on what is captured by an event. The synchronization will be performed efficiently on the device when applicable. \fChEvent\fP may be from a different context or device than \fChStream\fP.
.PP
\fBParameters:\fP
.RS 4
\fIhStream\fP - Stream to wait 
.br
\fIhEvent\fP - Event to wait on (may not be NULL) 
.br
\fIFlags\fP - Parameters for the operation (must be 0)
.RE
.PP
\fBReturns:\fP
.RS 4
\fBCUDA_SUCCESS\fP, \fBCUDA_ERROR_DEINITIALIZED\fP, \fBCUDA_ERROR_NOT_INITIALIZED\fP, \fBCUDA_ERROR_INVALID_CONTEXT\fP, \fBCUDA_ERROR_INVALID_HANDLE\fP, 
.RE
.PP
\fBNote:\fP
.RS 4
This function uses standard  semantics. 
.PP
Note that this function may also return error codes from previous, asynchronous launches.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBcuStreamCreate\fP, \fBcuEventRecord\fP, \fBcuStreamQuery\fP, \fBcuStreamSynchronize\fP, \fBcuStreamAddCallback\fP, \fBcuStreamDestroy\fP, cudaStreamWaitEvent 
.RE
.PP

.SS "\fBCUresult\fP cuThreadExchangeStreamCaptureMode (\fBCUstreamCaptureMode\fP * mode)"
.PP
Sets the calling thread's stream capture interaction mode to the value contained in \fC*mode\fP, and overwrites \fC*mode\fP with the previous mode for the thread. To facilitate deterministic behavior across function or module boundaries, callers are encouraged to use this API in a push-pop fashion: 
.PP
.nf
     CUstreamCaptureMode mode = desiredMode;
     cuThreadExchangeStreamCaptureMode(&mode);
     ...
     cuThreadExchangeStreamCaptureMode(&mode); // restore previous mode

.fi
.PP
.PP
During stream capture (see \fBcuStreamBeginCapture\fP), some actions, such as a call to cudaMalloc, may be unsafe. In the case of cudaMalloc, the operation is not enqueued asynchronously to a stream, and is not observed by stream capture. Therefore, if the sequence of operations captured via \fBcuStreamBeginCapture\fP depended on the allocation being replayed whenever the graph is launched, the captured graph would be invalid.
.PP
Therefore, stream capture places restrictions on API calls that can be made within or concurrently to a \fBcuStreamBeginCapture\fP-\fBcuStreamEndCapture\fP sequence. This behavior can be controlled via this API and flags to \fBcuStreamBeginCapture\fP.
.PP
A thread's mode is one of the following:
.IP "\(bu" 2
\fCCU_STREAM_CAPTURE_MODE_GLOBAL:\fP This is the default mode. If the local thread has an ongoing capture sequence that was not initiated with \fCCU_STREAM_CAPTURE_MODE_RELAXED\fP at \fCcuStreamBeginCapture\fP, or if any other thread has a concurrent capture sequence initiated with \fCCU_STREAM_CAPTURE_MODE_GLOBAL\fP, this thread is prohibited from potentially unsafe API calls.
.IP "\(bu" 2
\fCCU_STREAM_CAPTURE_MODE_THREAD_LOCAL:\fP If the local thread has an ongoing capture sequence not initiated with \fCCU_STREAM_CAPTURE_MODE_RELAXED\fP, it is prohibited from potentially unsafe API calls. Concurrent capture sequences in other threads are ignored.
.IP "\(bu" 2
\fCCU_STREAM_CAPTURE_MODE_RELAXED:\fP The local thread is not prohibited from potentially unsafe API calls. Note that the thread is still prohibited from API calls which necessarily conflict with stream capture, for example, attempting \fBcuEventQuery\fP on an event that was last recorded inside a capture sequence.
.PP
.PP
\fBParameters:\fP
.RS 4
\fImode\fP - Pointer to mode value to swap with the current mode
.RE
.PP
\fBReturns:\fP
.RS 4
\fBCUDA_SUCCESS\fP, \fBCUDA_ERROR_DEINITIALIZED\fP, \fBCUDA_ERROR_NOT_INITIALIZED\fP, \fBCUDA_ERROR_INVALID_VALUE\fP 
.RE
.PP
\fBNote:\fP
.RS 4
Note that this function may also return error codes from previous, asynchronous launches.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBcuStreamBeginCapture\fP 
.RE
.PP

.SH "Author"
.PP 
Generated automatically by Doxygen from the source code.