Because of its specialized hardware architecture, a GPU has significant advantages over a CPU when processing compute-intensive and highly parallelizable programs.
How it works
GPU parallel acceleration in a database operates at the object level. It converts the objects of a single field into a model that is suitable for parallel computing, and leverages the massive number of GPU cores to perform parallel computation.
Precautions
In scenarios with high concurrency, a single GPU device has limited resources. We recommend that you disable GPU-accelerated computing in the session.
Usage method
GanosBase automatically enables GPU-accelerated computing when it detects a GPU device. No additional parameter settings are required on the implemented functions, and the accelerated computing is transparent to users. At the same time, GanosBase provides session-level control permissions, allowing users to decide whether to enable GPU-accelerated computing.
Verify whether the current environment has a GPU device.
Create the ganos_raster extension
create extension ganos_raster cascade.Execute the SQL statement
select st_checkgpu().If a GPU device is detected in the current environment, the GPU device information is returned.
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 device is detected in the current environment, an error message is returned.
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)
NoteGPU-accelerated computing can be enabled only in an environment with a GPU device.
Enable and disable the session-level GPU usage status.
In an environment with a GPU device, GanosBase enables GPU-accelerated computing by default. If you want to disable GPU-accelerated computing and use the original CPU computing mode, execute
set ganos.raster.use_cuda=offin the session:rasterdb=# set ganos.raster.use_cuda=off; SET rasterdb=# show ganos.raster.use_cuda; ganos.raster.use_cuda ----------------------- off (1 row)If you need to re-enable GPU-accelerated computing, execute
set ganos.raster.use_cuda=on:rasterdb=# set ganos.raster.use_cuda=on; SET rasterdb=# show ganos.raster.use_cuda; ganos.raster.use_cuda ----------------------- on (1 row)
The modules that implement GPU-accelerated computing in GanosBase.
NoteCurrently, GPU-accelerated computing is implemented only in the Raster module of GanosBase. Support for the Trajectory and Geometry modules will be added in the future.