Gromacs
2024.4
|
#include "config.h"
#include "gromacs/utility/classhelpers.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/gmxassert.h"
#include "device_event.h"
Implements a GpuEventSynchronizer class.
Variables | |
constexpr bool | g_useEventConsumptionCounting = true |
A class which allows for CPU thread to mark and wait for certain GPU stream execution point. More... | |
constexpr bool g_useEventConsumptionCounting = true |
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 GpuEventSynchronizer::markEvent and then later waited on with GpuEventSynchronizer::waitForEvent or GpuEventSynchronizer::enqueueWaitEvent.
Additionally, this class offers facilities for runtime checking of correctness by counting how many times each marked event is used as a synchronization point.
minConsumptionCount
) and maximal (maxConsumptionCount
) number of consumptions can be specified. By default, both are set to 1.c
equals maxConsumptionCount
.minConsumptionCount <= c <= maxConsumptionCount
.c < maxConsumptionCount
). Consuming the event increments c
by 1. Trying to consume fully consumed event throws gmx::InternalError.to
0. Marking is only possible if the event is sufficiently consumed, otherwise gmx::InternalError is thrown.Default minConsumptionCount=maxConsumptionCount=1
limits mean that each call to GpuEventSynchronizer::markEvent must be followed by exactly one GpuEventSynchronizer::enqueueWaitEvent or GpuEventSynchronizer::enqueueWaitEvent. This is the recommended pattern for most use cases. By providing other constructor arguments, this requirement can be relaxed as needed.