Skip to content

Commit

Permalink
build: Add Docker images for CUDA development (#12413)
Browse files Browse the repository at this point in the history
Summary:
This PR is the first step towards adding a RAPIDS cuDF backend (#12412). It adds CUDA to the `adapters` CI images. This container will allow us to share a development environment that has CUDA compilers and libraries along with the existing Velox container infrastructure.

Pull Request resolved: #12413

Reviewed By: xiaoxmeng

Differential Revision: D70975471

Pulled By: Yuhta

fbshipit-source-id: 813cbbef2e3a05c6c301f2bbb4d7009e10adb35c
  • Loading branch information
bdice authored and facebook-github-bot committed Mar 11, 2025
1 parent 7f1e4ef commit c81bb1b
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux-build-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
simdjson_SOURCE: BUNDLED
xsimd_SOURCE: BUNDLED
geos_SOURCE: BUNDLED
CUDA_VERSION: "12.4"
CUDA_VERSION: "12.8"
USE_CLANG: "${{ inputs.use-clang && 'true' || 'false' }}"
steps:
- uses: actions/checkout@v4
Expand Down
37 changes: 36 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,48 @@ services:
environment:
NUM_THREADS: 8 # default value for NUM_THREADS
CCACHE_DIR: "/velox/.ccache"
EXTRA_CMAKE_FLAGS: -DVELOX_ENABLE_PARQUET=ON
EXTRA_CMAKE_FLAGS: -DVELOX_ENABLE_PARQUET=ON
-DVELOX_ENABLE_S3=ON
volumes:
- .:/velox:delegated
working_dir: /velox
command: /velox/scripts/docker-command.sh

adapters-cuda:
# Usage:
# docker-compose pull adapters-cuda or docker-compose build adapters-cuda
# or
# docker-compose run --rm adapters-cuda
# or
# docker-compose run -e NUM_THREADS=<NUMBER_OF_THREADS_TO_USE> --rm adapters-cuda
# to set the number of threads used during compilation
# scripts/adapters.dockerfile uses SHELL which is not supported for OCI image format.
# podman users must specify "--podman-build-args='--format docker'" argument.
image: ghcr.io/facebookincubator/velox-dev:adapters
build:
context: .
dockerfile: scripts/adapters.dockerfile
args:
image: ghcr.io/facebookincubator/velox-dev:centos9
environment:
NUM_THREADS: 8 # default value for NUM_THREADS
CCACHE_DIR: "/velox/.ccache"
EXTRA_CMAKE_FLAGS: -DVELOX_ENABLE_PARQUET=ON
-DVELOX_ENABLE_S3=ON
privileged: true
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
volumes:
- .:/velox:delegated
working_dir: /velox
command: /velox/scripts/docker-command.sh


centos-cpp:
# Usage:
# docker-compose pull centos-cpp or docker-compose build centos-cpp
Expand Down
19 changes: 17 additions & 2 deletions scripts/adapters.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,23 @@ FROM $image

COPY scripts/setup-helper-functions.sh /
COPY scripts/setup-adapters.sh /
RUN mkdir build && ( cd build && source /opt/rh/gcc-toolset-12/enable && \
bash /setup-adapters.sh ) && rm -rf build && dnf remove -y conda && dnf clean all
COPY scripts/setup-centos9.sh /
RUN mkdir build && \
( \
cd build && \
source /opt/rh/gcc-toolset-12/enable && \
bash /setup-adapters.sh && \
source /setup-centos9.sh && \
install_cuda 12.8 \
) && \
rm -rf build && dnf remove -y conda && dnf clean all

# put CUDA binaries on the PATH
ENV PATH /usr/local/cuda/bin:${PATH}

Check warning on line 32 in scripts/adapters.dockerfile

View workflow job for this annotation

GitHub Actions / Build and Push Adapters

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/

# configuration for nvidia-container-toolkit
ENV NVIDIA_VISIBLE_DEVICES all

Check warning on line 35 in scripts/adapters.dockerfile

View workflow job for this annotation

GitHub Actions / Build and Push Adapters

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility

Check warning on line 36 in scripts/adapters.dockerfile

View workflow job for this annotation

GitHub Actions / Build and Push Adapters

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/

# install miniforge
RUN curl -L -o /tmp/miniforge.sh https://github.com/conda-forge/miniforge/releases/download/23.11.0-0/Mambaforge-23.11.0-0-Linux-x86_64.sh && \
Expand Down
6 changes: 5 additions & 1 deletion scripts/setup-centos9.sh
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,11 @@ function install_cuda {
# See https://developer.nvidia.com/cuda-downloads
dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel9/x86_64/cuda-rhel9.repo
local dashed="$(echo $1 | tr '.' '-')"
dnf install -y cuda-nvcc-$dashed cuda-cudart-devel-$dashed cuda-nvrtc-devel-$dashed cuda-driver-devel-$dashed
dnf install -y \
cuda-compat-$dashed \
cuda-driver-devel-$dashed \
cuda-minimal-build-$dashed \
cuda-nvrtc-devel-$dashed
}

function install_geos {
Expand Down
6 changes: 5 additions & 1 deletion scripts/setup-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,11 @@ function install_cuda {
$SUDO apt update
fi
local dashed="$(echo $1 | tr '.' '-')"
$SUDO apt install -y cuda-nvcc-$dashed cuda-cudart-dev-$dashed cuda-nvrtc-dev-$dashed cuda-driver-dev-$dashed
$SUDO apt install -y \
cuda-compat-$dashed \
cuda-driver-dev-$dashed \
cuda-minimal-build-$dashed \
cuda-nvrtc-dev-$dashed
}

function install_geos {
Expand Down

0 comments on commit c81bb1b

Please sign in to comment.