Send Feedback
Skip to content

Install KDB-X and the GPU Module

This page explains how to install KDB-X with a GPU-enabled license, download the GPU module, and run the application on a host or in an NVIDIA container.

Install KDB-X

Install KDB-X using the KDB-X install guide.

Download the GPU module

  • Retrieve a KDB-X GPU-enabled license and download the GPU module from the KX downloads portal.
  • Save the GPU module in $HOME/.kx/mod/kx.

Note

These instructions use the default KDB-X installation location $HOME/.kx. If you installed KDB-X elsewhere, adjust the code examples to match your location.

The folder structure looks similar to:

~/.kx/mod/kx/
├── ai
├── gpu.li64.so  (gpu module)
├── kfk
├── kurl
├── objstor
├── pq
└── rest.q_

For more information on modules, refer to modules.

Run the application

With KDB-X and the GPU module installed, run the application directly on the host or in an NVIDIA container (requires Docker).

Non-containerized

If you run directly on the host, install the CUDA Toolkit on the host and ensure the CUDA runtime and shared libraries are available to the application.

Load the KDB-X GPU module and inspect the available APIs:

q).gpu:use[`kx.gpu][`init] ([copy:`async;alloc:`simple])
q)key .gpu
`cfg`to`from`sync`type`ndev`gdev`sdev`mdev`select`append`bin`iasc`asc`xasc`dbg`hex`zero`Qajf0`ajf0`aj`aj0`ajf

Containerized app with CUDA dependencies

We recommend using NVIDIA containers. To run the app, use the following Dockerfile examples (covering ubuntu24.04 and rockylinux10 for CUDA 13.1 built apps):

Ubuntu example

FROM nvidia/cuda:13.1.0-runtime-ubuntu24.04

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        curl \
        unzip \
        zip \
        ca-certificates \
        build-essential

RUN mkdir /opt/kx
WORKDIR /opt/kx/app
ENTRYPOINT ["/opt/kx/bin/q"]

Red Hat example

FROM nvidia/cuda:13.1.0-runtime-rockylinux10

RUN dnf install -y \
        curl \
        unzip \
        zip \
        ca-certificates \
        gcc \
        gcc-c++ \
        make \
        libubsan && \
    dnf clean all

RUN mkdir /opt/kx
WORKDIR /opt/kx/app
ENTRYPOINT ["/opt/kx/bin/q"]

To build the image:

docker build -f Dockerfile -t kdbx-gpu .
To run the image, mount the KDB-X directory to the container, along with any data sources, dependencies, and ports specific to your application:

docker run --gpus all -it -p 1234:1234 -v /home/mmcphillips/.kx:/opt/kx kdbx-gpu -p 1234
Load the KDB-X GPU module and inspect the available APIs as shown in the Non-containerized section.

Warning

Ensure the --gpus flag is passed to docker run, otherwise, you will see the following error:

'no kexport: libcuda.so.1: cannot open shared object file: No such file or directory