Doxygen
1.9.1
|
Wrapper class around GPU device ID, acceleration type and GpuEngine. More...
#include <tsgAcceleratedDataStructures.hpp>
Public Types | |
enum | AlgorithmPreference { algorithm_dense , algorithm_sparse , algorithm_autoselect } |
Defines the sparse-dense algorithm flavors, whenever applicable. More... | |
enum | ChangeType { change_none , change_gpu_device , change_gpu_enabled , change_cpu_blas , change_sparse_dense } |
Defines the types of acceleration context updates so they can be linked to acceleration cache updates. More... | |
Public Member Functions | |
AccelerationContext () | |
Creates a default context, the device id is set to 0 and acceleration is BLAS (if available) or none. | |
ChangeType | favorSparse (bool favor) |
Sets algorithm affinity in the direction of sparse. | |
bool | blasCompatible () const |
Returns true if BLAS is enabled and the current mode is not none. | |
bool | useKernels () const |
Returns true if the current mode implies the use of custom GPU kernels. | |
ChangeType | testEnable (TypeAcceleration acc, int new_gpu_id) const |
Returns the ChangeType if enable() is called, but does not change the acceleration. | |
void | enable (TypeAcceleration acc, int new_gpu_id) |
Accepts parameters directly from TasmanianSparseGrid::enableAcceleration() | |
void | setDevice () const |
Set default device. | |
operator GpuEngine * () const | |
Custom convert to GpuEngine. | |
bool | on_gpu () const |
Returns true if any of the GPU-based acceleration modes have been enabled. | |
Static Public Member Functions | |
static constexpr TypeAcceleration | getDefaultAccMode () |
Returns the default acceleration mode, cpu_blas if BLAS is enabled and none otherwise. | |
static constexpr int | getDefaultAccDevice () |
Returns the default acceleration device, CUDA/HIP use GPU 0, SYCL uses -1 which uses sycl::default_selector_v. | |
Public Attributes | |
TypeAcceleration | mode |
The current active acceleration mode. | |
AlgorithmPreference | algorithm_select |
The preference to use dense or sparse algorithms. | |
int | device |
If using a GPU acceleration mode, holds the active device. | |
std::unique_ptr< GpuEngine > | engine |
Holds the context to the GPU TPL handles, e.g., MAGMA queue. | |
Wrapper class around GPU device ID, acceleration type and GpuEngine.
Single acceleration context held by the TasmanianSparseGrid class and aliased into each of the sub-classes. The context is modified through the main class and is persistent on move, copy and read. The sub-classes hold only a const pointer and can read and use the associated variables and the engine.
Defines the types of acceleration context updates so they can be linked to acceleration cache updates.
The update methods will generate a change event that may require an update of the acceleration cache. For example, switching to a different GPU device means that the cache from the old device must be cleared.