GanosBase automatically enables GPU-accelerated computing when it detects a GPU in the environment. No configuration is required. You can also control GPU acceleration at the session level to optimize performance for specific workloads.
How it works
GPU-based parallel acceleration in GanosBase operates at the object level. GanosBase converts a field object into a model suitable for parallel computing, then distributes the computation across multiple GPU cores. This gives GPUs a significant advantage over CPUs for compute-intensive and embarrassingly parallel workloads.
Prerequisites
Before you begin, ensure that you have:
A GPU installed and accessible in your PolarDB cluster environment
Check GPU availability
Create the
ganos_rasterextension:create extension ganos_raster cascade;Run
st_checkgpu()to check whether a GPU is available:GPU-accelerated computing requires a GPU in the environment.
select st_checkgpu();If a GPU is detected, GanosBase returns the GPU properties:
rasterdb=# select st_checkgpu(); st_checkgpu ------------------------------------------------------------------------------------------------------------------------------ [GPU(0) prop]multiProcessorCount=20; sharedMemPerBlock=49152; totalGlobalMem=-608239616; maxThreadsPerBlock=1024; maxThreadsPerMultiProcessor=2048; cudaThreadGetLimit=1024 . (1 row)If no GPU is detected, GanosBase returns an error message:
rasterdb=# select st_checkgpu(); st_checkgpu ------------------------------------------------------------------------------------------------------------------------------------------ There is not gpu device on current environment, cuda_errorcode=35, errormsg=CUDA driver version is insufficient for CUDA runtime version. (1 row)
Control GPU acceleration at the session level
By default, GanosBase enables GPU acceleration in any environment where a GPU is available.
Disable GPU acceleration (switch to CPU mode)
For highly concurrent workloads, a single GPU may become a bottleneck. Disable GPU acceleration at the session level to route those queries to CPU:
set ganos.raster.use_cuda=off;Verify the setting:
show ganos.raster.use_cuda;Expected output:
ganos.raster.use_cuda
-----------------------
off
(1 row)Re-enable GPU acceleration
set ganos.raster.use_cuda=on;Verify the setting:
show ganos.raster.use_cuda;Expected output:
ganos.raster.use_cuda
-----------------------
on
(1 row)Limitations
GPU-accelerated computing is currently supported only in the GanosBase Raster module. Support for the GanosBase Trajectory and GanosBase Geometry modules is planned for a future release.