Gromacs  2019-beta2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
GpuEventSynchronizer Class Reference

#include <gromacs/gpu_utils/gpueventsynchronizer_ocl.h>


A class which allows for CPU thread to mark and wait for certain GPU stream execution point. The event can be put into the stream with markEvent() and then later waited on with waitForEvent(). This can be repeated as necessary, but the current implementation does not allow waiting on completed event more than once, expecting only exact pairs of markEvent(stream); waitForEvent(). The class generally attempts to track the correctness of its state transitions, but please note that calling waitForEvent() right after the construction will fail with OpenCL but succeed with CUDA.

Another possible mode of operation can be implemented if needed: multiple calls to waitForEvent() after a single markEvent(). For this, clReleaseEvent() call from waitForEvent() should instead happen conditionally at the beginning of markEvent(), replacing the GMX_ASSERT(). This was tested to work both with CUDA and NVidia OpenCL, but not with AMD/Intel OpenCl.

Public Member Functions

 GpuEventSynchronizer ()
 A constructor.
 ~GpuEventSynchronizer ()
 A destructor.
 GpuEventSynchronizer (const GpuEventSynchronizer &)=delete
 No copying.
GpuEventSynchronizeroperator= (GpuEventSynchronizer &&)=delete
 No assignment.
 GpuEventSynchronizer (GpuEventSynchronizer &&)=delete
 Moving is disabled but can be considered in the future if needed.
void markEvent (CommandStream stream)
 Marks the synchronization point in the stream. Should be called first and then followed by waitForEvent().
void waitForEvent ()
 Synchronizes the host thread on the marked event.

The documentation for this class was generated from the following file: