Helper class to run CUDA/HIP operations on parallel streams.
This class introduces "side streams" that overlap with one "main stream". In a parallel section, multiple kernels (or other CUDA/HIP operations) are scheduled to the streams. The first "run" is scheduled on the main stream all subsequent operations on the side streams. The passed priority affects only the side streams. When the parallel section goes out of scope the side streams are synchronized to the main stream via CUDA/HIP events.
Example:
#include <ParallelStreams.h>
Public Member Functions | |
ParallelStreams (int priority=0) | |
ParallelSection | parallelSection (gpuStream_t stream) |
void | setStreamPriority (int priority) |
Private Member Functions | |
void | ensureSize (uint_t size) |
Private Attributes | |
std::vector< StreamRAII > | sideStreams_ |
std::vector< EventRAII > | events_ |
EventRAII | mainEvent_ |
int | streamPriority_ |
Friends | |
class | ParallelSection |
walberla::gpu::ParallelStreams::ParallelStreams | ( | int | priority = 0 | ) |
|
private |
ParallelSection walberla::gpu::ParallelStreams::parallelSection | ( | gpuStream_t | stream | ) |
void walberla::gpu::ParallelStreams::setStreamPriority | ( | int | priority | ) |
|
friend |
|
private |
|
private |
|
private |
|
private |