Library/ManagedCuda/CudaStream.cs
/// <summary> 
/// Here the Stream is the NULL stream<para/>
/// 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.
/// <para/>
/// The callback may be passed <see cref="CUResult.Success"/> or an error code.  In the event
/// of a device error, all subsequently executed callbacks will receive an
/// appropriate <see cref="CUResult"/>.
/// <para/>
/// Callbacks must not make any CUDA API calls.  Attempting to use a CUDA API
/// will result in <see cref="CUResult.ErrorNotPermitted"/>.  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.
/// <para/>
/// This API requires compute capability 1.1 or greater.  See
/// cuDeviceGetAttribute or ::cuDeviceGetProperties to query compute
/// capability.  Attempting to use this API with earlier compute versions will
/// return <see cref="CUResult.ErrorNotSupported"/>.
/// </summary>
/// <param name="callback">The function to call once preceding stream operations are complete</param>
/// <param name="userData">User specified data to be passed to the callback function. Use GCAlloc to pin a managed object</param>
/// <param name="flags">Callback flags (must be CUStreamAddCallbackFlags.None)</param>
Here the Stream is the NULL stream
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.

The callback may be passed  or an error code.  In the event
of a device error, all subsequently executed callbacks will receive an
appropriate .

Callbacks must not make any CUDA API calls.  Attempting to use a CUDA API
will result in .  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.

This API requires compute capability 1.1 or greater.  See
cuDeviceGetAttribute or ::cuDeviceGetProperties to query compute
capability.  Attempting to use this API with earlier compute versions will
return .
Here the Stream is the NULL stream 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 . The callback may be passed or an error code . In the event of a device error all subsequently executed callbacks will receive an appropriate . Callbacks must not make any CUDA API calls . Attempting to use a CUDA API will result in . 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 . This API requires compute capability 1 . 1 or greater . See cuDeviceGetAttribute or :: cuDeviceGetProperties to query compute capability . Attempting to use this API with earlier compute versions will return .
public static void AddCallbackToNullStream(CUstreamCallback callback, IntPtr userData, CUStreamAddCallbackFlags flags)
		{
			CUResult res = DriverAPINativeMethods.Streams.cuStreamAddCallback(new CUstream(), callback, userData, flags);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuStreamAddCallback", res));
			if (res != CUResult.Success) throw new CudaException(res);			
		}
public static void AddCallbackToNullStream ( CUstreamCallback callback , IntPtr userData , CUStreamAddCallbackFlags flags ) { CUResult res = DriverAPINativeMethods . Streams . cuStreamAddCallback ( new CUstream ( ) , callback , userData , flags ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , res ) ) ; if ( res != CUResult . Success ) throw new CudaException ( res ) ; }
Here the Stream is the NULL stream
Adds a callback to be called on the host after all currently enqueued
items in the stream have completed.
Here the Stream is the NULL stream Adds a callback to be called on the host after all currently enqueued items in the stream have completed .
callback
CUstreamCallback
The function to call once preceding stream operations are complete
The function to call once preceding stream operations are complete
userData
IntPtr
User specified data to be passed to the callback function. Use GCAlloc to pin a managed object
User specified data to be passed to the callback function . Use GCAlloc to pin a managed object
flags
CUStreamAddCallbackFlags
Callback flags (must be CUStreamAddCallbackFlags.None)
Callback flags ( must be CUStreamAddCallbackFlags . None )