/// <summary> /// Creates a new Event /// </summary> /// <param name="flags">Parameters for event creation</param> public CudaEvent(CUEventFlags flags) { _event = new CUevent(); res = DriverAPINativeMethods.Events.cuEventCreate(ref _event, flags); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuEventCreate", res)); if (res != CUResult.Success) throw new CudaException(res); }
/// <summary> /// Returns the event associated with an event wait node /// </summary> public CudaEvent GetWaitEvent() { CUevent event_out = new CUevent(); CUResult res = DriverAPINativeMethods.GraphManagment.cuGraphEventWaitNodeGetEvent(this, ref event_out); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuGraphEventWaitNodeGetEvent", res)); if (res != CUResult.Success) { throw new CudaException(res); } return(new CudaEvent(event_out)); }
public static extern CUResult cuStreamWaitEvent(CUstream hStream, CUevent hEvent, uint Flags);
public static extern CUResult cuEventElapsedTime( ref float pMilliseconds, CUevent hStart, CUevent hEnd );
public static extern CUResult cuEventDestroy_v2( CUevent hEvent );
public static extern CUResult cuEventSynchronize( CUevent hEvent );
public static extern CUResult cuEventQuery( CUevent hEvent );
public static extern CUResult cuEventRecord( CUevent hEvent, CUstream hStream );
public static extern CUResult cuEventCreate(ref CUevent phEvent, CUEventFlags Flags);
public static extern CUResult cuIpcOpenEventHandle(ref CUevent phEvent, CUipcEventHandle handle);
public static extern CUResult cuIpcGetEventHandle(ref CUipcEventHandle pHandle, CUevent cuevent);
/// <summary> /// Make a compute stream wait on an event<para/> /// Makes all future work submitted to the Stream wait until <c>hEvent</c> /// reports completion before beginning execution. This synchronization /// will be performed efficiently on the device. /// <para/> /// The stream will wait only for the completion of the most recent /// host call to <see cref="CudaEvent.Record()"/> on <c>hEvent</c>. Once this call has returned, /// any functions (including <see cref="CudaEvent.Record()"/> and <see cref="Dispose()"/> may be /// called on <c>hEvent</c> again, and the subsequent calls will not have any /// effect on this stream. /// <para/> /// If <c>hStream</c> is 0 (the NULL stream) any future work submitted in any stream /// will wait for <c>hEvent</c> to complete before beginning execution. This /// effectively creates a barrier for all future work submitted to the context. /// <para/> /// If <see cref="CudaEvent.Record()"/> has not been called on <c>hEvent</c>, this call acts as if /// the record has already completed, and so is a functional no-op. /// </summary> /// <returns></returns> public void WaitEvent(CUevent cuevent) { if (disposed) throw new ObjectDisposedException(this.ToString()); res = DriverAPINativeMethods.Streams.cuStreamWaitEvent(_stream, cuevent, 0); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuStreamWaitEvent", res)); if (res != CUResult.Success) throw new CudaException(res); }