Due to its special hardware architecture, a GPU has great advantages over a CPU in processing computing-intensive and easy-to-parallel code.
Acceleration principles
In a database, GPU parallel acceleration is performed at the object level. Ganos converts
a field object to a model suitable for parallel computing, and uses the multiple cores
of the GPU for parallel computing. The following figure shows the parallel computing
process.

Notes
A single GPU has limited resources. Therefore, we recommend that you disable GPU-accelerated computing in a session for high-concurrency scenarios.
Procedure
When detecting a GPU, Ganos automatically enables GPU-accelerated computing. You do
not need to set any parameters. GPU-accelerated computing is transparent and imperceptible
to you. In addition, Ganos allows you to enable or disable GPU-accelerated computing
at the session level.
- Check whether a GPU is available in the current environment.
- Run the create extension ganos_raster cascade statement to create a Ganos Raster extension.
- Run the select st_checkgpu() statement.
- If Ganos detects a GPU in the current environment, it returns the GPU information.
rasterdb=# select st_checkgpu(); st_checkgpu ------------------------------------------------------------------------------------------------------------------------------ [GPU(0) prop]multiProcessorCount=20; sharedMemPerBlock=49152; totalGlobalMem=-608239616; maxThreadsPerBlock=1024; maxThreadsPerMultiProcessor=2048; cudaThreadGetLimit=1024. (1 row)
- If Ganos does not detect a GPU in the current environment, it 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)
Note GPU-accelerated computing can be enabled only in an environment where a GPU is available. - If Ganos detects a GPU in the current environment, it returns the GPU information.
- Enable or disable GPU-accelerated computing at the session level.
-
In an environment with a GPU, Ganos enables GPU-accelerated computing by default. To disable GPU-accelerated computing to use the original CPU computing mode, perform the following operation in a session:
Run the set ganos.raster.use_cuda=off statement.rasterdb=# set ganos.raster.use_cuda=off; SET rasterdb=# show ganos.raster.use_cuda; ganos.raster.use_cuda ----------------------- off (1 row)
-
To enable GPU-accelerated computing again, run the set ganos.raster.use_cuda=on statement.
rasterdb=# set ganos.raster.use_cuda=on; SET rasterdb=# show ganos.raster.use_cuda; ganos.raster.use_cuda ----------------------- on (1 row)
-
- Implement GPU-accelerated computing in a Ganos module.
Note Currently, you can implement GPU-accelerated computing only in the Ganos Raster module. GPU-accelerated computing will be supported by the Ganos Trajectory and Ganos Geometry modules in the future.