Enable GPU-accelerated computing

Updated at:

Due to its specialized hardware architecture, a GPU has a significant advantage over a CPU when processing compute-intensive and easily parallelizable programs.

Acceleration principles

GPU-based parallel acceleration in databases operates at the object level. It converts a field object into a model suited for parallel computing, and uses the massive number of GPU cores to perform parallel computation.

Considerations

In scenarios with a large number of concurrent sessions, a single GPU device may run into resource constraints. We recommend that you disable GPU-accelerated computing at the session level in such cases.

Procedure

Ganos automatically enables GPU-accelerated computing when it detects a GPU device. No additional parameters are required for the implemented functions, and the acceleration is transparent to users. At the same time, Ganos provides session-level control, allowing users to decide whether to enable GPU-accelerated computing.

  1. Check whether a GPU device is available in the current environment.

    1. Create the ganos_raster extension: create extension ganos_raster cascade.

    2. 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)
      Note

      GPU-accelerated computing can be enabled only in environments with GPU devices.

  2. Enable or disable the session-level GPU status.

    • In an environment with a GPU device, Ganos enables GPU-accelerated computing by default. If you want to disable GPU-accelerated computing and use the CPU computing mode instead, execute set ganos.raster.use_cuda=off in the session:

      rasterdb=# set ganos.raster.use_cuda=off;
      SET
      rasterdb=# show ganos.raster.use_cuda;
       ganos.raster.use_cuda
      -----------------------
       off
      (1 row)
    • 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)
  3. Modules in Ganos that implement GPU-accelerated computing.

    Note

    Currently, GPU-accelerated computing is implemented only in the Raster module of Ganos. Support for the Trajectory and Geometry modules will be added in later versions.