Due to the special hardware architecture, a GPU has great advantages over a CPU in processing computing-intensive and embarrassingly parallel workloads.
How the acceleration works
In a database, GPU-based parallel acceleration is performed at the object level. GanosBase converts a field object to a model suitable for parallel computing, and uses the multiple cores of the GPU for parallel computing.
Usage notes
A single GPU has limited resources. To process highly concurrent workloads, we recommend that you disable GPU-accelerated computing at the session level.
Procedure
When GanosBase detects a GPU, GanosBase automatically enables GPU-accelerated computing. You do not need to configure any parameters. GPU-accelerated computing is transparent and imperceptible to you. In addition, GanosBase allows you to enable or disable GPU-accelerated computing at the session level.
Check whether a GPU is available in the current environment.
Execute the
create extension ganos_raster cascadestatement to create a ganos_raster extension.Execute the
select st_checkgpu()statement.If GanosBase detects a GPU in the current environment, GanosBase 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 GanosBase does not detect a GPU in the current environment, 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)
NoteGPU-accelerated computing can be enabled only in an environment where a GPU is available.
Enable or disable GPU-accelerated computing at the session level.
In an environment where a GPU is available, GanosBase enables GPU-accelerated computing by default. If you want to use the original CPU computing mode, run the
set ganos.raster.use_cuda=offcommand in a session.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=oncommand.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 GanosBase module.
NoteYou can implement GPU-accelerated computing only in the GanosBase Raster module. GPU-accelerated computing will be supported by the GanosBase Trajectory and GanosBase Geometry modules in the future.