Skip to content

Commit c81bb1b

Browse files
bdicefacebook-github-bot
authored andcommitted
build: Add Docker images for CUDA development (facebookincubator#12413)
Summary: This PR is the first step towards adding a RAPIDS cuDF backend (facebookincubator#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: facebookincubator#12413 Reviewed By: xiaoxmeng Differential Revision: D70975471 Pulled By: Yuhta fbshipit-source-id: 813cbbef2e3a05c6c301f2bbb4d7009e10adb35c
1 parent 7f1e4ef commit c81bb1b

File tree

5 files changed

+64
-6
lines changed

5 files changed

+64
-6
lines changed

.github/workflows/linux-build-base.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
simdjson_SOURCE: BUNDLED
4141
xsimd_SOURCE: BUNDLED
4242
geos_SOURCE: BUNDLED
43-
CUDA_VERSION: "12.4"
43+
CUDA_VERSION: "12.8"
4444
USE_CLANG: "${{ inputs.use-clang && 'true' || 'false' }}"
4545
steps:
4646
- uses: actions/checkout@v4

docker-compose.yml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,48 @@ services:
5252
environment:
5353
NUM_THREADS: 8 # default value for NUM_THREADS
5454
CCACHE_DIR: "/velox/.ccache"
55-
EXTRA_CMAKE_FLAGS: -DVELOX_ENABLE_PARQUET=ON
55+
EXTRA_CMAKE_FLAGS: -DVELOX_ENABLE_PARQUET=ON
5656
-DVELOX_ENABLE_S3=ON
5757
volumes:
5858
- .:/velox:delegated
5959
working_dir: /velox
6060
command: /velox/scripts/docker-command.sh
6161

62+
adapters-cuda:
63+
# Usage:
64+
# docker-compose pull adapters-cuda or docker-compose build adapters-cuda
65+
# or
66+
# docker-compose run --rm adapters-cuda
67+
# or
68+
# docker-compose run -e NUM_THREADS=<NUMBER_OF_THREADS_TO_USE> --rm adapters-cuda
69+
# to set the number of threads used during compilation
70+
# scripts/adapters.dockerfile uses SHELL which is not supported for OCI image format.
71+
# podman users must specify "--podman-build-args='--format docker'" argument.
72+
image: ghcr.io/facebookincubator/velox-dev:adapters
73+
build:
74+
context: .
75+
dockerfile: scripts/adapters.dockerfile
76+
args:
77+
image: ghcr.io/facebookincubator/velox-dev:centos9
78+
environment:
79+
NUM_THREADS: 8 # default value for NUM_THREADS
80+
CCACHE_DIR: "/velox/.ccache"
81+
EXTRA_CMAKE_FLAGS: -DVELOX_ENABLE_PARQUET=ON
82+
-DVELOX_ENABLE_S3=ON
83+
privileged: true
84+
deploy:
85+
resources:
86+
reservations:
87+
devices:
88+
- driver: nvidia
89+
count: 1
90+
capabilities: [gpu]
91+
volumes:
92+
- .:/velox:delegated
93+
working_dir: /velox
94+
command: /velox/scripts/docker-command.sh
95+
96+
6297
centos-cpp:
6398
# Usage:
6499
# docker-compose pull centos-cpp or docker-compose build centos-cpp

scripts/adapters.dockerfile

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,23 @@ FROM $image
1717

1818
COPY scripts/setup-helper-functions.sh /
1919
COPY scripts/setup-adapters.sh /
20-
RUN mkdir build && ( cd build && source /opt/rh/gcc-toolset-12/enable && \
21-
bash /setup-adapters.sh ) && rm -rf build && dnf remove -y conda && dnf clean all
20+
COPY scripts/setup-centos9.sh /
21+
RUN mkdir build && \
22+
( \
23+
cd build && \
24+
source /opt/rh/gcc-toolset-12/enable && \
25+
bash /setup-adapters.sh && \
26+
source /setup-centos9.sh && \
27+
install_cuda 12.8 \
28+
) && \
29+
rm -rf build && dnf remove -y conda && dnf clean all
30+
31+
# put CUDA binaries on the PATH
32+
ENV PATH /usr/local/cuda/bin:${PATH}
33+
34+
# configuration for nvidia-container-toolkit
35+
ENV NVIDIA_VISIBLE_DEVICES all
36+
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
2237

2338
# install miniforge
2439
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 && \

scripts/setup-centos9.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,11 @@ function install_cuda {
234234
# See https://developer.nvidia.com/cuda-downloads
235235
dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel9/x86_64/cuda-rhel9.repo
236236
local dashed="$(echo $1 | tr '.' '-')"
237-
dnf install -y cuda-nvcc-$dashed cuda-cudart-devel-$dashed cuda-nvrtc-devel-$dashed cuda-driver-devel-$dashed
237+
dnf install -y \
238+
cuda-compat-$dashed \
239+
cuda-driver-devel-$dashed \
240+
cuda-minimal-build-$dashed \
241+
cuda-nvrtc-devel-$dashed
238242
}
239243

240244
function install_geos {

scripts/setup-ubuntu.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,11 @@ function install_cuda {
293293
$SUDO apt update
294294
fi
295295
local dashed="$(echo $1 | tr '.' '-')"
296-
$SUDO apt install -y cuda-nvcc-$dashed cuda-cudart-dev-$dashed cuda-nvrtc-dev-$dashed cuda-driver-dev-$dashed
296+
$SUDO apt install -y \
297+
cuda-compat-$dashed \
298+
cuda-driver-dev-$dashed \
299+
cuda-minimal-build-$dashed \
300+
cuda-nvrtc-dev-$dashed
297301
}
298302

299303
function install_geos {

0 commit comments

Comments
 (0)