Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c8d97a5
Add RAPIDS-based devcontainer for velox/cuDF development
bdice Feb 6, 2026
090585d
Add librdkafka-dev dependency
bdice Feb 6, 2026
7e1a801
Add duckdb_SOURCE=BUNDLED
bdice Feb 6, 2026
dd903d2
Fix _SOURCE vars: pass as CMake -D flags, not env vars
bdice Feb 6, 2026
3893ad9
Fix Velox CMake configuration for all dependencies
bdice Feb 6, 2026
13d63d9
Update default BASE image to cuda12.9 devcontainer
bdice Feb 6, 2026
4561c8b
Remove redundant comment about DuckDB variable naming
bdice Feb 6, 2026
612029d
Add additional CMake flags
bdice Feb 10, 2026
b117cec
Simplify devcontainer build scripts and fix presto test support
bdice Feb 17, 2026
7799ebc
Add build-all support for velox/presto
bdice Feb 19, 2026
f584da9
Add clean-all and configure-all wrappers for velox/presto
bdice Feb 23, 2026
def1979
Rename _common.sh to _devcontainer_common_utils.sh
bdice Feb 24, 2026
533c7af
Add libfl-dev
bdice Feb 24, 2026
c45219f
Translate -j 0 to nproc --all --ignore=1 in build-velox and build-presto
bdice Feb 24, 2026
af4768d
Update devcontainer script output to RAPIDS style
bdice Feb 24, 2026
62796e4
Fix permissions on /opt/ paths
bdice Feb 25, 2026
26d0b8a
Improve build time display
bdice Feb 25, 2026
2a3df0b
Add copyright header
bdice Feb 25, 2026
760a9f9
Fix presto build: add proxygen dep check and unset FOLLY_CFG_NO_COROU…
bdice Feb 26, 2026
a0112d4
Fix -j0 behavior to use more of the build cluster
bdice Feb 26, 2026
bc68428
Fix -j0 for presto
bdice Feb 26, 2026
7ea62fb
Fix -j0 to use $(ulimit -Hn)
bdice Feb 26, 2026
b29bb4c
Add datasketches dependency
bdice Feb 26, 2026
9a901ca
Update scripts
bdice Feb 27, 2026
949a68c
Update permissions
bdice Feb 27, 2026
ce441d9
Revert "Update permissions"
bdice Feb 27, 2026
0c93e1e
Fix permissions
bdice Feb 27, 2026
fb45a0a
Remove requirement for rapidsai/devcontainers sibling directory
bdice Mar 24, 2026
767ee7a
Fix CXX_FLAGS on ARM
bdice Mar 24, 2026
680f17d
Add CMake flag support
bdice Mar 24, 2026
9c82c25
Replace hardcoded versions with Velox pins
bdice Mar 25, 2026
808034b
Unify CUDA arch flag between build-velox and configure-velox
bdice Apr 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Velox development container based on RAPIDS devcontainers
#
# Uses RAPIDS devcontainer base image (Ubuntu) for compatibility with
# RAPIDS build utilities and cuDF development.

ARG CUDA_VERSION=12.9
ARG BASE=rapidsai/devcontainers:latest-cpp-cuda12.9-ucx1.19.0-openmpi5.0.7

FROM ${BASE}

ARG TARGETARCH
ARG CUDA_VERSION

# Install velox build dependencies
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
# GCC 14 (avoids GCC 13 false-positive -Wstringop-overflow in fmt)
gcc-14 \
g++-14 \
# Velox dependencies not in RAPIDS base
libc-ares-dev \
libboost-all-dev \
libdouble-conversion-dev \
libevent-dev \
libfmt-dev \
libgflags-dev \
libgoogle-glog-dev \
liblz4-dev \
liblzo2-dev \
libprotobuf-dev \
libprotoc-dev \
protobuf-compiler \
librdkafka-dev \
libre2-dev \
libsnappy-dev \
libsodium-dev \
libstemmer-dev \
libthrift-dev \
libxxhash-dev \
libzstd-dev \
# Build tools
bison \
flex \
libfl-dev \
gperf \
ninja-build \
ccache \
&& rm -rf /tmp/* /var/tmp/* /var/cache/apt/* /var/lib/apt/lists/*

# Set GCC 14 as default (GCC 13 has false-positive -Wstringop-overflow in fmt)
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 140 \
--slave /usr/bin/g++ g++ /usr/bin/g++-14 \
--slave /usr/bin/gcov gcov /usr/bin/gcov-14 && \
update-alternatives --set gcc /usr/bin/gcc-14

# Install velox helper scripts
COPY velox-testing/scripts/devcontainer/* /usr/local/bin/
RUN chmod 755 /usr/local/bin/build-* /usr/local/bin/configure-* \
/usr/local/bin/test-* /usr/local/bin/clean-* /usr/local/bin/post-create \
/usr/local/bin/_devcontainer_common_utils.sh

# Environment for velox builds
# VELOX_DEPENDENCY_SOURCE is read from env by CMake
# Individual _SOURCE overrides must be passed as -D flags in configure-velox
ENV VELOX_DEPENDENCY_SOURCE=SYSTEM \
CUDA_VERSION=${CUDA_VERSION} \
CUDAARCHS="RAPIDS" \
DEFAULT_VIRTUAL_ENV=rapids \
PYTHON_PACKAGE_MANAGER=pip

# Python environment
ENV PYTHONSAFEPATH="1" \
PYTHONUNBUFFERED="1" \
PYTHONDONTWRITEBYTECODE="1"

# Persist bash history to cache
ENV HISTFILE="/home/coder/.cache/._bash_history"

###
# sccache configuration
###
ENV AWS_ROLE_ARN="arn:aws:iam::279114543810:role/nv-gha-token-sccache-devs" \
SCCACHE_REGION="us-east-2" \
SCCACHE_BUCKET="rapids-sccache-devs" \
SCCACHE_S3_USE_PREPROCESSOR_CACHE_MODE=true \
SCCACHE_IDLE_TIMEOUT=0

###
# sccache-dist configuration
###
# Enable sccache-dist by default
ENV DEVCONTAINER_UTILS_ENABLE_SCCACHE_DIST=1
# Compile locally if max retries exceeded
ENV SCCACHE_DIST_FALLBACK_TO_LOCAL_COMPILE=true
# Retry transient errors 4 times (for a total of 5 attempts)
ENV SCCACHE_DIST_MAX_RETRIES=4
# 1hr 59min (to accommodate debug builds)
ENV SCCACHE_DIST_REQUEST_TIMEOUT=7140
ENV SCCACHE_DIST_URL="https://${TARGETARCH}.linux.sccache.rapids.nvidia.com"

# Build as much in parallel as possible
ENV INFER_NUM_DEVICE_ARCHITECTURES=1 \
MAX_DEVICE_OBJ_TO_COMPILE_IN_PARALLEL=20

# Add velox environment to bashrc
RUN echo "export CUDA_VERSION=${CUDA_VERSION}" >> /home/coder/.bashrc && \
echo 'export CMAKE_C_COMPILER_LAUNCHER=sccache' >> /home/coder/.bashrc && \
echo 'export CMAKE_CXX_COMPILER_LAUNCHER=sccache' >> /home/coder/.bashrc && \
echo 'export CMAKE_CUDA_COMPILER_LAUNCHER=sccache' >> /home/coder/.bashrc

# Create build directories before USER switch; chmod 0777 so any uid works after
# the devcontainer feature remaps the coder uid to match the host user.
RUN mkdir -m 0777 -p /opt/velox-build /opt/presto-build /opt/fb-deps

USER coder
WORKDIR /home/coder
161 changes: 161 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# Velox + Presto Devcontainer

A GPU-ready development environment for building [Velox](https://github.com/facebookincubator/velox) with cuDF acceleration and [Presto Native Execution](https://github.com/prestodb/presto/tree/master/presto-native-execution). Based on the RAPIDS devcontainer image with pre-built cuDF, RMM, and KvikIO.

## Quick Start

```bash
# 1. Clone sibling repos under the same parent directory
mkdir ~/code && cd ~/code
git clone https://github.com/<org>/velox-testing.git
git clone https://github.com/facebookincubator/velox.git
git clone https://github.com/prestodb/presto.git
git clone https://github.com/rapidsai/rmm.git
git clone https://github.com/rapidsai/cudf.git
git clone https://github.com/rapidsai/kvikio.git

# 2. Open in VS Code (or any devcontainer-compatible editor)
code velox-testing

# 3. Reopen in container (pick CUDA 13.1 or 12.9 variant)

# 4. Build
build-velox # ~25 min — standalone velox with cuDF
build-presto # ~40 min first run (builds FB deps), ~25 min after

# 5. Test
test-velox # run velox test suite
test-presto # run presto test suite
```

## Directory Layout

The devcontainer expects this layout on the host:

```
~/code/
├── velox-testing/ # this repo (devcontainer workspace root)
├── velox/ # facebookincubator/velox
├── presto/ # prestodb/presto
├── rmm/ # rapidsai/rmm
├── cudf/ # rapidsai/cudf
└── kvikio/ # rapidsai/kvikio
```

All repos are bind-mounted into the container under `/home/coder/`.

## Build Architecture

```
┌───────────────┐ ┌───────────────────────────────┐
│ build-velox │ │ build-presto │
│ │ │ │
│ ~/velox src │ │ 1. FB deps (auto, once) │
│ all BUNDLED │ │ folly, fbthrift, proxygen │
│ MONO_LIB=ON │ │ → /opt/fb-deps │
│ SHARED=ON │ │ │
│ │ │ 2. rsync ~/velox → submodule │
│ │ │ add_subdirectory(velox) │
│ │ │ MONO_LIB=OFF │
└───────┬───────┘ └──────────────┬────────────────┘
│ │
▼ ▼
/opt/velox-build/ /opt/presto-build/
release/ presto_server
3879 targets 1978 targets
```

Both builds consume pre-built **cudf**, **rmm**, and **kvikio** from the RAPIDS devcontainer.

**Standalone velox** bundles all its dependencies (folly, xsimd, Arrow, etc.) — no prerequisite steps.

**Presto** requires Facebook's OSS stack (folly, fbthrift, proxygen, etc.) for its thrift RPC layer. `build-presto` builds these automatically on first run and caches them at `/opt/fb-deps`. Subsequent runs skip this step unless `--rebuild-deps` is passed.

### Why velox builds twice

Presto integrates velox via `add_subdirectory()` with different options (`VELOX_MONO_LIBRARY=OFF`, no testing, etc.). The rsync in `build-presto` copies `~/velox` into presto's git submodule directory so both repos share the same source while keeping presto's git state clean.

## Commands

| Command | Description |
|---------|-------------|
| `build-velox` | Build standalone velox with cuDF (fully self-contained) |
| `build-presto` | Build presto-native-execution (auto-builds FB deps on first run) |
| `configure-velox` | CMake configure only (for IDE integration) |
| `test-velox` | Run velox tests via ctest |
| `test-presto` | Run presto tests via ctest |
| `clean-velox` | Delete velox build artifacts |
| `clean-presto` | Delete presto build artifacts |

All commands accept `--help`. Common options:

```bash
build-velox --debug # debug build
build-velox -j 16 # limit parallelism
build-presto --release # release build (default)
build-presto --rebuild-deps # force rebuild of FB deps
```

## CUDA Variants

Two devcontainer configurations are provided:

| Path | CUDA | Base Image |
|------|------|------------|
| `.devcontainer/cuda13.1/` | 13.1 | `rapidsai/devcontainers:latest-cpp-cuda13.1-*` |
| `.devcontainer/cuda12.9/` | 12.9 | `rapidsai/devcontainers:latest-cpp-cuda12.9-*` |

VS Code will prompt you to choose when opening the workspace. The `CUDAARCHS` environment variable defaults to `RAPIDS`, which expands to all RAPIDS-supported architectures.

## Build Outputs

| Build | Location | Contents |
|-------|----------|----------|
| FB deps | `/opt/fb-deps/` | folly, fbthrift, proxygen (auto-built by `build-presto`) |
| Velox | `/opt/velox-build/release/` | Mono shared library, tests |
| Presto | `/opt/presto-build/` | `presto_server` binary, tests |

Build directories are under `/opt/` so they don't pollute mounted source trees and persist across container sessions (unless the container is recreated).

## Dependency Resolution

Velox has many dependencies. Each can be `SYSTEM` (pre-installed) or `BUNDLED` (built from source via FetchContent). The build scripts set these automatically:

| Dependency | Velox Build | Presto Build | Source |
|------------|------------|--------------|--------|
| folly | BUNDLED | SYSTEM | Built from source / `/opt/fb-deps` |
| xsimd | BUNDLED | SYSTEM | Built from source / `/opt/fb-deps` |
| cudf | SYSTEM | SYSTEM | RAPIDS pre-built |
| rmm | SYSTEM | SYSTEM | RAPIDS pre-built |
| kvikio | SYSTEM | SYSTEM | RAPIDS pre-built |
| Arrow | BUNDLED | BUNDLED | Built from source |
| DuckDB | BUNDLED | BUNDLED | Built from source |
| GTest | BUNDLED | BUNDLED | Built from source |
| simdjson | BUNDLED | BUNDLED | Built from source |
| geos | BUNDLED | BUNDLED | Built from source |

## Workarounds

The build scripts include several workarounds for toolchain issues:

- **GCC 14** instead of GCC 13: avoids false-positive `-Wstringop-overflow` in system `fmt` v9.
- **`-DCMAKE_CXX_SCAN_FOR_MODULES=OFF`**: CMake 4.x + GCC 14 + Ninja triggers `-fmodules-ts` which causes GCC 14 ICE (segfault).
- **`-no-pie` linker flag** (presto only): fbthrift static archives have construction vtables with hidden visibility from virtual inheritance in `apache::thrift` exception classes. The linker cannot resolve `R_X86_64_PC32` relocations against hidden symbols in PIE executables.
- **`-Wno-error=nonnull`** (presto only): presto's `SystemConnector.cpp` triggers a false-positive `this` null check warning.

## Scripts

All scripts live in `scripts/devcontainer/` and are installed to `/usr/local/bin/` in the container image. They share common functions via `_common.sh`.

```
scripts/devcontainer/
├── _common.sh # Shared constants (CUDA archs, RAPIDS detection)
├── build-velox # Standalone velox build (all deps bundled)
├── build-presto # Presto + velox build (includes FB deps)
├── configure-velox # CMake configure only
├── test-velox # Run velox tests
├── test-presto # Run presto tests
├── clean-velox # Clean velox build dir
├── clean-presto # Clean presto build dir
└── post-create # Devcontainer post-create hook
```
61 changes: 61 additions & 0 deletions .devcontainer/cuda12.9/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"name": "velox-dev-cuda12.9",
"build": {
"context": "${localWorkspaceFolder}/..",
"dockerfile": "${localWorkspaceFolder}/.devcontainer/Dockerfile",
"args": {
"CUDA_VERSION": "12.9",
"BASE": "rapidsai/devcontainers:latest-cpp-cuda12.9-ucx1.19.0-openmpi5.0.7"
}
},
"features": {
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils:latest": {}
},
"overrideFeatureInstallOrder": [
"ghcr.io/rapidsai/devcontainers/features/rapids-build-utils"
],
"initializeCommand": ["/bin/bash", "-c", "mkdir -p ${localWorkspaceFolder}/../.{aws,cache,config/pip,local/share/velox-testing-cuda12.9-venvs}"],
"workspaceFolder": "/home/coder",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/velox-testing,type=bind,consistency=consistent",
"mounts": [
"source=${localWorkspaceFolder}/../velox,target=/home/coder/velox,type=bind,consistency=consistent",
"source=${localWorkspaceFolder}/../presto,target=/home/coder/presto,type=bind,consistency=consistent",
"source=${localWorkspaceFolder}/../rmm,target=/home/coder/rmm,type=bind,consistency=consistent",
"source=${localWorkspaceFolder}/../cudf,target=/home/coder/cudf,type=bind,consistency=consistent",
"source=${localWorkspaceFolder}/../kvikio,target=/home/coder/kvikio,type=bind,consistency=consistent",
"source=${localWorkspaceFolder}/../.aws,target=/home/coder/.aws,type=bind,consistency=consistent",
"source=${localWorkspaceFolder}/../.cache,target=/home/coder/.cache,type=bind,consistency=consistent",
"source=${localWorkspaceFolder}/../.config,target=/home/coder/.config,type=bind,consistency=consistent",
"source=${localWorkspaceFolder}/../.local/share/velox-testing-cuda12.9-venvs,target=/home/coder/.local/share/venvs,type=bind,consistency=consistent"
],
"hostRequirements": {
"gpu": "optional"
},
"runArgs": [
"--rm",
"--name", "${localEnv:USER:anon}-velox-dev-cuda12.9",
"--ulimit", "nofile=500000"
],
"postCreateCommand": "/home/coder/velox-testing/scripts/devcontainer/post-create",
"postAttachCommand": [
"/bin/bash",
"-c",
"if [ ${CODESPACES:-false} = 'true' ]; then . devcontainer-utils-post-attach-command; . rapids-post-attach-command; fi"
],
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools",
"ms-vscode.cmake-tools",
"llvm-vs-code-extensions.vscode-clangd"
],
"settings": {
"cmake.buildDirectory": "/opt/velox-build/${buildType}",
"cmake.configureOnOpen": false
}
}
},
"containerEnv": {
"VELOX_DEPENDENCY_SOURCE": "SYSTEM"
}
}
Loading
Loading