Skip to content

Commit 1c627a3

Browse files
[bugfix]: build fastvideo-kernel on GPU-less Docker runners (#1437)
1 parent a931efe commit 1c627a3

5 files changed

Lines changed: 35 additions & 17 deletions

File tree

docker/Dockerfile.python3.10

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,14 @@ RUN source $HOME/.local/bin/env && \
5555
echo 'source /opt/venv/bin/activate' >> /root/.bashrc && \
5656
echo 'if [ -n "$ZSH_VERSION" ] && [ -f ~/.zshrc ]; then . ~/.zshrc; elif [ -f ~/.bashrc ]; then . ~/.bashrc; fi' > /root/.profile
5757

58-
# Install FastVideo Unified Kernel
58+
# Install FastVideo Unified Kernel.
59+
# This build machine has no GPU, so target Hopper (sm_90a) explicitly instead
60+
# of probing a live device for the arch (matches the released kernel wheel).
5961
RUN source $HOME/.local/bin/env && \
6062
source /opt/venv/bin/activate && \
6163
cd fastvideo-kernel && \
6264
git submodule update --init --recursive && \
63-
./build.sh
65+
TORCH_CUDA_ARCH_LIST=9.0a ./build.sh
6466

6567

6668
EXPOSE 22

docker/Dockerfile.python3.11

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,14 @@ RUN source $HOME/.local/bin/env && \
5555
echo 'source /opt/venv/bin/activate' >> /root/.bashrc && \
5656
echo 'if [ -n "$ZSH_VERSION" ] && [ -f ~/.zshrc ]; then . ~/.zshrc; elif [ -f ~/.bashrc ]; then . ~/.bashrc; fi' > /root/.profile
5757

58-
# Install FastVideo Unified Kernel
58+
# Install FastVideo Unified Kernel.
59+
# This build machine has no GPU, so target Hopper (sm_90a) explicitly instead
60+
# of probing a live device for the arch (matches the released kernel wheel).
5961
RUN source $HOME/.local/bin/env && \
6062
source /opt/venv/bin/activate && \
6163
cd fastvideo-kernel && \
6264
git submodule update --init --recursive && \
63-
./build.sh
65+
TORCH_CUDA_ARCH_LIST=9.0a ./build.sh
6466

6567

6668
EXPOSE 22

docker/Dockerfile.python3.12

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,13 @@ RUN source $HOME/.local/bin/env && \
5555
echo 'source /opt/venv/bin/activate' >> /root/.bashrc && \
5656
echo 'if [ -n "$ZSH_VERSION" ] && [ -f ~/.zshrc ]; then . ~/.zshrc; elif [ -f ~/.bashrc ]; then . ~/.bashrc; fi' > /root/.profile
5757

58-
# Install FastVideo Unified Kernel
58+
# Install FastVideo Unified Kernel.
59+
# This build machine has no GPU, so target Hopper (sm_90a) explicitly instead
60+
# of probing a live device for the arch (matches the released kernel wheel).
5961
RUN source $HOME/.local/bin/env && \
6062
source /opt/venv/bin/activate && \
6163
cd fastvideo-kernel && \
6264
git submodule update --init --recursive && \
63-
./build.sh
65+
TORCH_CUDA_ARCH_LIST=9.0a ./build.sh
6466

6567
EXPOSE 22

docker/Dockerfile.python3.12.cuda12.9.1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,14 @@ RUN source $HOME/.local/bin/env && \
5555
echo 'source /opt/venv/bin/activate' >> /root/.bashrc && \
5656
echo 'if [ -n "$ZSH_VERSION" ] && [ -f ~/.zshrc ]; then . ~/.zshrc; elif [ -f ~/.bashrc ]; then . ~/.bashrc; fi' > /root/.profile
5757

58-
# Install FastVideo Unified Kernel
58+
# Install FastVideo Unified Kernel.
59+
# This build machine has no GPU, so target Hopper (sm_90a) explicitly instead
60+
# of probing a live device for the arch (matches the released kernel wheel).
5961
RUN source $HOME/.local/bin/env && \
6062
source /opt/venv/bin/activate && \
6163
cd fastvideo-kernel && \
6264
git submodule update --init --recursive && \
63-
./build.sh
65+
TORCH_CUDA_ARCH_LIST=9.0a ./build.sh
6466

6567

6668
EXPOSE 22

fastvideo-kernel/build.sh

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,26 @@ print(f'{mj}.{mn}')"
7878
}
7979

8080
if [ "${GPU_BACKEND}" = "CUDA" ]; then
81-
detected_cc="$(detect_with_torch)" || {
82-
echo "ERROR: torch-based CUDA arch detection failed in uv environment." >&2
83-
echo " Ensure torch is installed and CUDA is available in the uv-selected Python." >&2
84-
exit 1
85-
}
86-
87-
cc_major="${detected_cc%%.*}"
88-
cc_minor="${detected_cc##*.}"
81+
# Compute capability drives the arch/TK defaults below. Prefer an explicit
82+
# TORCH_CUDA_ARCH_LIST (works on GPU-less build machines such as CI/Docker);
83+
# only probe a live GPU via torch when no arch was provided.
84+
if [ -n "${TORCH_CUDA_ARCH_LIST:-}" ]; then
85+
echo "Using TORCH_CUDA_ARCH_LIST=${TORCH_CUDA_ARCH_LIST} (skipping torch GPU probe)"
86+
first_arch="${TORCH_CUDA_ARCH_LIST%%[;, ]*}" # first entry, e.g. 9.0a
87+
first_arch="${first_arch%[af]}" # strip trailing a/f suffix
88+
cc_major="${first_arch%%.*}"
89+
cc_minor="${first_arch##*.}"
90+
else
91+
detected_cc="$(detect_with_torch)" || {
92+
echo "ERROR: torch-based CUDA arch detection failed and TORCH_CUDA_ARCH_LIST is unset." >&2
93+
echo " Set TORCH_CUDA_ARCH_LIST (e.g. 9.0a) for GPU-less builds, or build where CUDA is available." >&2
94+
exit 1
95+
}
96+
cc_major="${detected_cc%%.*}"
97+
cc_minor="${detected_cc##*.}"
98+
echo "Detected compute capability via torch: ${detected_cc}"
99+
fi
89100
cmake_arch="${cc_major}${cc_minor}"
90-
echo "Detected compute capability via torch: ${detected_cc} (sm_${cmake_arch})"
91101

92102
# Respect explicit overrides.
93103
if [ -z "${TORCH_CUDA_ARCH_LIST:-}" ]; then

0 commit comments

Comments
 (0)