From 51bcb0229885b9b3399edc21e7403784880d68a2 Mon Sep 17 00:00:00 2001 From: Qi Wu Date: Wed, 15 Apr 2026 08:43:16 -0700 Subject: [PATCH 1/4] refactor(env): remove legacy installation scripts and consolidate environment setup Delete outdated PowerShell and Bash scripts for environment installation, along with the requirements file. Introduce new benchmark scripts and formatting tools to streamline the setup process and improve code maintainability. --- install_env.ps1 | 185 ------------------ install_env.sh | 181 ----------------- requirements.txt | 41 ---- .../benchmark}/mipnerf360.sh | 0 .../benchmark}/mipnerf360_ncore.sh | 0 .../benchmark}/mipnerf360_render.sh | 0 .../benchmark}/nerf_synthetic.sh | 0 .../benchmark}/nerf_synthetic_render.sh | 0 .../benchmark}/print_stats.sh | 0 .../benchmark}/profile_dataloader.py | 0 {benchmark => scripts/benchmark}/scannetpp.sh | 0 .../benchmark}/scannetpp_render.sh | 0 {benchmark => scripts/benchmark}/zipnerf.sh | 0 .../benchmark}/zipnerf_render.sh | 0 formatter.sh => scripts/formatter.sh | 0 rebase_helper.sh => scripts/rebase_helper.sh | 0 16 files changed, 407 deletions(-) delete mode 100644 install_env.ps1 delete mode 100755 install_env.sh delete mode 100644 requirements.txt rename {benchmark => scripts/benchmark}/mipnerf360.sh (100%) rename {benchmark => scripts/benchmark}/mipnerf360_ncore.sh (100%) rename {benchmark => scripts/benchmark}/mipnerf360_render.sh (100%) rename {benchmark => scripts/benchmark}/nerf_synthetic.sh (100%) rename {benchmark => scripts/benchmark}/nerf_synthetic_render.sh (100%) rename {benchmark => scripts/benchmark}/print_stats.sh (100%) rename {benchmark => scripts/benchmark}/profile_dataloader.py (100%) rename {benchmark => scripts/benchmark}/scannetpp.sh (100%) rename {benchmark => scripts/benchmark}/scannetpp_render.sh (100%) rename {benchmark => scripts/benchmark}/zipnerf.sh (100%) rename {benchmark => scripts/benchmark}/zipnerf_render.sh (100%) rename formatter.sh => scripts/formatter.sh (100%) rename rebase_helper.sh => scripts/rebase_helper.sh (100%) diff --git a/install_env.ps1 b/install_env.ps1 deleted file mode 100644 index 9a35ad16..00000000 --- a/install_env.ps1 +++ /dev/null @@ -1,185 +0,0 @@ -# To run this script from PowerShell, navigate to the project folder, and run: -# .\install_env.ps1 - -param ( - [string]$CondaEnv = "3dgrut" -) - -# Function to check if last command succeeded -function Check-LastCommand { - param($StepName) - if ($LASTEXITCODE -ne 0) { - Write-Host "Error: $StepName failed with exit code $LASTEXITCODE" -ForegroundColor Red - exit $LASTEXITCODE - } - Write-Host "$StepName completed successfully" -ForegroundColor Green -} - -# Function to find Visual Studio cl.exe path -function Find-VisualStudioCompiler { - Write-Host "Searching for Visual Studio C++ compiler..." -ForegroundColor Yellow - - # Search paths for different VS editions and versions - $searchPaths = @( - "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\*\bin\Hostx64\x64", - "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\*\bin\Hostx64\x64", - "C:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\*\bin\Hostx64\x64", - "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\*\bin\Hostx64\x64", - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\*\bin\Hostx64\x64", - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\*\bin\Hostx64\x64", - "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\*\bin\Hostx64\x64", - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\*\bin\Hostx64\x64", - # Fallback to x86 host if x64 host not available - "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\*\bin\Hostx64\x86", - "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\*\bin\Hostx64\x86", - "C:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\*\bin\Hostx64\x86", - "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\*\bin\Hostx64\x86", - "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\*\bin\Hostx64\x86", - "C:\Program Files (x86)\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\*\bin\Hostx64\x86", - "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\*\bin\Hostx64\x86", - "C:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\*\bin\Hostx64\x86" - ) - - foreach ($path in $searchPaths) { - $resolvedPaths = Get-ChildItem -Path $path -ErrorAction SilentlyContinue | Sort-Object Name -Descending - foreach ($resolvedPath in $resolvedPaths) { - $clExe = Join-Path $resolvedPath.FullName "cl.exe" - if (Test-Path $clExe) { - Write-Host "Found Visual Studio compiler at: $($resolvedPath.FullName)" -ForegroundColor Green - return $resolvedPath.FullName - } - } - } - - Write-Host "Warning: Could not find Visual Studio C++ compiler automatically." -ForegroundColor Yellow - Write-Host "You may need to install Visual Studio Build Tools or add cl.exe to PATH manually." -ForegroundColor Yellow - return $null -} - -Write-Host "`nStarting Conda environment setup: $CondaEnv" - -# Initialize conda for PowerShell (this enables conda commands) -Write-Host "Initializing conda for PowerShell..." -& conda init powershell -Check-LastCommand "Conda initialization" - -# Refresh the current session to pick up conda changes -Write-Host "Refreshing PowerShell session..." -& powershell -Command "& {conda --version}" -Check-LastCommand "Conda verification" - -Write-Host "Creating conda environment..." -conda create -n $CondaEnv python=3.11 -y -Check-LastCommand "Conda environment creation" - -Write-Host "Activating conda environment..." -conda activate $CondaEnv -Check-LastCommand "Conda environment activation" - -# Verify environment is active -Write-Host "Verifying environment activation..." -$CurrentEnv = $env:CONDA_DEFAULT_ENV -if ($CurrentEnv -ne $CondaEnv) { - Write-Host "Warning: Expected environment '$CondaEnv' but found '$CurrentEnv'" -ForegroundColor Yellow -} -Write-Host "Current environment: $CurrentEnv" -ForegroundColor Green - -# Configure Visual Studio C++ compiler for PyTorch JIT compilation -Write-Host "`nConfiguring Visual Studio C++ compiler for conda environment..." -ForegroundColor Yellow -$vsCompilerPath = Find-VisualStudioCompiler -if ($vsCompilerPath) { - # Get current PATH from conda environment - $currentPath = conda env config vars list -n $CondaEnv | Select-String "PATH" | ForEach-Object { $_.ToString().Split('=', 2)[1] } - - if ($currentPath) { - # Append to existing PATH - $newPath = "$vsCompilerPath;$currentPath" - } else { - # Create new PATH with VS compiler and current system PATH - $newPath = "$vsCompilerPath;$env:PATH" - } - - # Set the PATH environment variable for this conda environment - conda env config vars set -n $CondaEnv "PATH=$newPath" - Check-LastCommand "Visual Studio compiler PATH configuration" - - Write-Host "Visual Studio compiler added to conda environment PATH" -ForegroundColor Green - Write-Host "The compiler will be automatically available when you activate the environment" -ForegroundColor Green - - # Reactivate environment to pick up the new PATH - Write-Host "Reactivating environment to apply PATH changes..." -ForegroundColor Yellow - conda deactivate - conda activate $CondaEnv - Check-LastCommand "Environment reactivation" - - # Verify the compiler is now accessible - Write-Host "Verifying compiler accessibility..." -ForegroundColor Yellow - $clTest = Get-Command cl.exe -ErrorAction SilentlyContinue - if ($clTest) { - Write-Host "Visual Studio compiler (cl.exe) is now accessible: $($clTest.Source)" -ForegroundColor Green - } else { - Write-Host "Warning: cl.exe still not found in PATH. Manual setup may be required." -ForegroundColor Yellow - } -} else { - Write-Host "Skipping compiler PATH setup - Visual Studio not found" -ForegroundColor Yellow - Write-Host "You may need to install Visual Studio Build Tools and re-run this script" -ForegroundColor Yellow -} - -# Install CUDA toolkit 12.4 (nvcc, headers, libs) -Write-Host "`nInstalling CUDA toolkit 12.4 (nvcc, etc.)..." -ForegroundColor Yellow -conda install -y -c nvidia/label/cuda-12.4.0 cuda-toolkit -Check-LastCommand "CUDA toolkit installation" - -# Install PyTorch with CUDA support (CRITICAL: This must complete first) -Write-Host "`nInstalling PyTorch + CUDA 12.4 (this may take several minutes)..." -ForegroundColor Yellow -pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124 -Check-LastCommand "PyTorch installation" - -# Verify PyTorch installation -Write-Host "Verifying PyTorch installation..." -ForegroundColor Yellow -python -c "import torch; print(f'PyTorch version: {torch.__version__}'); print(f'CUDA available: {torch.cuda.is_available()}')" -Check-LastCommand "PyTorch verification" - -# Install build tools -Write-Host "Installing build tools (cmake, ninja)..." -ForegroundColor Yellow -conda install -y cmake ninja -c nvidia/label/cuda-12.4.0 -Check-LastCommand "Build tools installation" - -# Initialize Git submodules -Write-Host "Initializing Git submodules..." -ForegroundColor Yellow -git submodule update --init --recursive -Check-LastCommand "Git submodules initialization" - -# Install Python dependencies -Write-Host "Installing Python requirements from requirements.txt..." -ForegroundColor Yellow -pip install --no-build-isolation -r requirements.txt -Check-LastCommand "Requirements installation" - -# Install additional dependencies -Write-Host "Installing Cython..." -ForegroundColor Yellow -pip install cython -Check-LastCommand "Cython installation" - -Write-Host "Installing Hydra-core..." -ForegroundColor Yellow -pip install hydra-core -Check-LastCommand "Hydra-core installation" - -# Install Kaolin -Write-Host "Installing Kaolin (this may take a while)..." -ForegroundColor Yellow -pip install https://nvidia-kaolin.s3.us-east-2.amazonaws.com/torch-2.5.1_cu124/kaolin-0.17.0-cp311-cp311-win_amd64.whl -Check-LastCommand "Kaolin installation" - -# Install project in development mode -Write-Host "Installing project in development mode..." -ForegroundColor Yellow -pip install -e . -Check-LastCommand "Project installation" - -# Final success message -Write-Host "`n" -NoNewline -Write-Host "=================================================" -ForegroundColor Green -Write-Host " INSTALLATION COMPLETED SUCCESSFULLY!" -ForegroundColor Green -Write-Host "=================================================" -ForegroundColor Green -Write-Host "Environment '$CondaEnv' is ready with all dependencies!" -ForegroundColor Green -Write-Host "" -Write-Host "To use the environment:" -ForegroundColor Cyan -Write-Host " conda activate $CondaEnv" -ForegroundColor White diff --git a/install_env.sh b/install_env.sh deleted file mode 100755 index 07f8e0ad..00000000 --- a/install_env.sh +++ /dev/null @@ -1,181 +0,0 @@ -#!/bin/bash - -# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -# Exit on error -set -e - -CONDA_ENV=${1:-"3dgrut"} - -# parse an optional second arg WITH_GCC11 to also manually use gcc-11 within the environment -WITH_GCC11=false -if [ $# -ge 2 ]; then - if [ "$2" = "WITH_GCC11" ]; then - WITH_GCC11=true - fi -fi - -CUDA_VERSION=${CUDA_VERSION:-"11.8.0"} - -# Verify user arguments -echo "Arguments:" -echo " CONDA_ENV: $CONDA_ENV" -echo " WITH_GCC11: $WITH_GCC11" -echo " CUDA_VERSION: $CUDA_VERSION" -echo "" - -# Make sure TORCH_CUDA_ARCH_LIST matches the pytorch wheel setting. -# Reference: https://github.com/pytorch/pytorch/blob/main/.ci/manywheel/build_cuda.sh#L54 -# -# (cuda11) $ python -c "import torch; print(torch.version.cuda, torch.cuda.get_arch_list())" -# 11.8 ['sm_50', 'sm_60', 'sm_61', 'sm_70', 'sm_75', 'sm_80', 'sm_86', 'sm_37', 'sm_90', 'compute_37'] -# -# (cuda12) $ python -c "import torch; print(torch.version.cuda, torch.cuda.get_arch_list())" -# 12.8 ['sm_75', 'sm_80', 'sm_86', 'sm_90', 'sm_100', 'sm_120', 'compute_120'] -# -# Check if CUDA_VERSION is supported -if [ "$CUDA_VERSION" = "11.8.0" ]; then - export TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6;9.0+PTX"; -elif [ "$CUDA_VERSION" = "12.8.1" ]; then - export TORCH_CUDA_ARCH_LIST="7.5;8.0;8.6;9.0;10.0;12.0+PTX"; -else - echo "Unsupported CUDA version: $CUDA_VERSION, available options are 11.8.0 and 12.8.1" - exit 1 -fi -echo "TORCH_CUDA_ARCH_LIST=$TORCH_CUDA_ARCH_LIST" - -# Test if we have GCC<=11, and early-out if not -if [ ! "$WITH_GCC11" = true ]; then - # Make sure gcc is at most 11 for nvcc compatibility - gcc_version=$(gcc -dumpversion) - if [ "$gcc_version" -gt 11 ]; then - echo "Default gcc version $gcc_version is higher than 11. See note about installing gcc-11 (you may need 'sudo apt-get install gcc-11 g++-11') and rerun with ./install_env.sh 3dgrut WITH_GCC11" - exit 1 - fi -fi - -# If we're going to set gcc11, make sure it is available -if [ "$WITH_GCC11" = true ]; then - # Ensure gcc-11 is on path - if ! command -v gcc-11 2>&1 >/dev/null - then - echo "gcc-11 could not be found. Perhaps you need to run 'sudo apt-get install gcc-11 g++-11'?" - exit 1 - fi - if ! command -v g++-11 2>&1 >/dev/null - then - echo "g++-11 could not be found. Perhaps you need to run 'sudo apt-get install gcc-11 g++-11'?" - exit 1 - fi - - GCC_11_PATH=$(which gcc-11) - GXX_11_PATH=$(which g++-11) -fi - -# Create and activate conda environment -eval "$(conda shell.bash hook)" - -# Finds the path of the environment if the environment already exists -CONDA_ENV_PATH=$(conda env list | sed -E -n "s/^${CONDA_ENV}[[:space:]]+\*?[[:space:]]*(.*)$/\1/p") -if [ -z "${CONDA_ENV_PATH}" ]; then - echo "Conda environment '${CONDA_ENV}' not found, creating it" - conda create --name ${CONDA_ENV} -y python=3.11 setuptools==78.1.1 -else - echo "NOTE: Conda environment '${CONDA_ENV}' already exists at ${CONDA_ENV_PATH}, skipping environment creation" -fi -conda activate $CONDA_ENV - -# Set CC and CXX variables to gcc11 in the conda env -if [ "$WITH_GCC11" = true ]; then - echo "Setting CC=$GCC_11_PATH and CXX=$GXX_11_PATH in conda environment" - - conda env config vars set CC=$GCC_11_PATH CXX=$GXX_11_PATH - - conda deactivate - conda activate $CONDA_ENV - - # Make sure it worked - gcc_version=$($CC -dumpversion | cut -d '.' -f 1) - echo "gcc_version=$gcc_version" - if [ "$gcc_version" -gt 11 ]; then - echo "gcc version $gcc_version is still higher than 11, setting gcc-11 failed" - exit 1 - fi -fi - -conda env config vars set TORCH_CUDA_ARCH_LIST=$TORCH_CUDA_ARCH_LIST -conda deactivate -conda activate $CONDA_ENV - -# Install CUDA and PyTorch dependencies -# CUDA 11.8 supports until compute capability 9.0 -if [ "$CUDA_VERSION" = "11.8.0" ]; then - echo "Installing CUDA 11.8.0 ..." - conda install -y cuda-toolkit cmake ninja -c nvidia/label/cuda-11.8.0 - conda install -y pytorch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 pytorch-cuda=11.8 "numpy<2.0" "mkl<=2022.1.0" -c pytorch -c nvidia/label/cuda-11.8.0 - pip3 install --find-links https://nvidia-kaolin.s3.us-east-2.amazonaws.com/torch-2.1.2_cu118.html kaolin==0.17.0 - -# CUDA 12.8 supports compute capability 10.0 and 12.0 -elif [ "$CUDA_VERSION" = "12.8.1" ]; then - - # get the GCC version so we can use it in the install command below - # the _PATHs might already be set - if [ ! "$WITH_GCC11" = true ]; then - GCC_11_PATH=$(which gcc) - GXX_11_PATH=$(which g++) - fi - - gcc_version=$($GCC_11_PATH -dumpversion | cut -d '.' -f 1) - - echo "Installing CUDA 12.8.1 ..." - conda install -y cuda-toolkit cmake ninja gcc_linux-64=$gcc_version -c nvidia/label/cuda-12.8.1 - pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128 - pip3 install --force-reinstall "numpy<2" - - # TODO move to using wheel once kaolin is available - rm -fr thirdparty/kaolin - git clone --recursive https://github.com/NVIDIAGameWorks/kaolin.git thirdparty/kaolin - pushd thirdparty/kaolin - git checkout c2da967b9e0d8e3ebdbd65d3e8464d7e39005203 # ping to a fixed commit for reproducibility - sed -i 's!AT_DISPATCH_FLOATING_TYPES_AND_HALF(feats_in.type()!AT_DISPATCH_FLOATING_TYPES_AND_HALF(feats_in.scalar_type()!g' kaolin/csrc/render/spc/raytrace_cuda.cu - pip install --upgrade pip - pip install --no-cache-dir ninja imageio imageio-ffmpeg - pip install --no-cache-dir \ - -r tools/viz_requirements.txt \ - -r tools/requirements.txt \ - -r tools/build_requirements.txt - IGNORE_TORCH_VER=1 python setup.py install - popd - rm -fr thirdparty/kaolin - -# Unsupported CUDA version -else - echo "Unsupported CUDA version: $CUDA_VERSION, available options are 11.8.0 and 12.8.1" - exit 1 -fi - -# Install OpenGL headers for the playground -# Use --override-channels to avoid conflicts with nvidia channel's cuda-toolkit spec -conda install -c conda-forge --override-channels mesa-libgl-devel-cos7-x86_64 -y - -# Initialize git submodules and install Python requirements -git submodule update --init --recursive -# Use --no-build-isolation so packages can access torch during build -pip install --no-build-isolation -r requirements.txt -pip install --no-build-isolation -e . - -echo "Setup completed successfully!" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 568baa47..00000000 --- a/requirements.txt +++ /dev/null @@ -1,41 +0,0 @@ -pillow -plyfile -torchmetrics -tensorboard -fire -omegaconf -hydra-core -scikit-learn -wandb -addict -rich -slangtorch==1.3.18 -# NeRF Dataset requirements -piexif -kornia -opencv-python<4.12.0 # because of our numpy<2.0 requirement -einops -imageio -msgpack -dataclasses_json -# JIT compilation -setuptools==78.1.1 -# Fused-ssim -fused-ssim @ git+https://github.com/rahul-goel/fused-ssim@1272e21a282342e89537159e4bad508b19b34157 -# Playground -tqdm -libigl -pygltflib -# --find-links https://nvidia-kaolin.s3.us-east-2.amazonaws.com/torch-2.1.2_cu118.html -# kaolin==0.17.0 -usd-core>=26.3 -ppisp @ git+https://github.com/nv-tlabs/ppisp@v1.0.1 -# NCore dataset support (https://github.com/NVIDIA/ncore) -nvidia-ncore==18.6.0 -simplejpeg -# formatter -black==26.3.1 -isort==5.13.0 -# graphics user interfaces -polyscope>=2.3.0 -viser diff --git a/benchmark/mipnerf360.sh b/scripts/benchmark/mipnerf360.sh similarity index 100% rename from benchmark/mipnerf360.sh rename to scripts/benchmark/mipnerf360.sh diff --git a/benchmark/mipnerf360_ncore.sh b/scripts/benchmark/mipnerf360_ncore.sh similarity index 100% rename from benchmark/mipnerf360_ncore.sh rename to scripts/benchmark/mipnerf360_ncore.sh diff --git a/benchmark/mipnerf360_render.sh b/scripts/benchmark/mipnerf360_render.sh similarity index 100% rename from benchmark/mipnerf360_render.sh rename to scripts/benchmark/mipnerf360_render.sh diff --git a/benchmark/nerf_synthetic.sh b/scripts/benchmark/nerf_synthetic.sh similarity index 100% rename from benchmark/nerf_synthetic.sh rename to scripts/benchmark/nerf_synthetic.sh diff --git a/benchmark/nerf_synthetic_render.sh b/scripts/benchmark/nerf_synthetic_render.sh similarity index 100% rename from benchmark/nerf_synthetic_render.sh rename to scripts/benchmark/nerf_synthetic_render.sh diff --git a/benchmark/print_stats.sh b/scripts/benchmark/print_stats.sh similarity index 100% rename from benchmark/print_stats.sh rename to scripts/benchmark/print_stats.sh diff --git a/benchmark/profile_dataloader.py b/scripts/benchmark/profile_dataloader.py similarity index 100% rename from benchmark/profile_dataloader.py rename to scripts/benchmark/profile_dataloader.py diff --git a/benchmark/scannetpp.sh b/scripts/benchmark/scannetpp.sh similarity index 100% rename from benchmark/scannetpp.sh rename to scripts/benchmark/scannetpp.sh diff --git a/benchmark/scannetpp_render.sh b/scripts/benchmark/scannetpp_render.sh similarity index 100% rename from benchmark/scannetpp_render.sh rename to scripts/benchmark/scannetpp_render.sh diff --git a/benchmark/zipnerf.sh b/scripts/benchmark/zipnerf.sh similarity index 100% rename from benchmark/zipnerf.sh rename to scripts/benchmark/zipnerf.sh diff --git a/benchmark/zipnerf_render.sh b/scripts/benchmark/zipnerf_render.sh similarity index 100% rename from benchmark/zipnerf_render.sh rename to scripts/benchmark/zipnerf_render.sh diff --git a/formatter.sh b/scripts/formatter.sh similarity index 100% rename from formatter.sh rename to scripts/formatter.sh diff --git a/rebase_helper.sh b/scripts/rebase_helper.sh similarity index 100% rename from rebase_helper.sh rename to scripts/rebase_helper.sh From 780f8a104d53e405efc9ec3c875711e7f4d32ea0 Mon Sep 17 00:00:00 2001 From: Qi Wu Date: Wed, 15 Apr 2026 13:49:04 -0700 Subject: [PATCH 2/4] chore(docker): update Dockerfile and .dockerignore for improved environment setup - Updated base image to nvidia/cuda:12.8.1 and adjusted environment variables for better compatibility. - Removed legacy installation commands and streamlined package installation in the Dockerfile. - Added new assets to .dockerignore and included additional directories to be ignored during the Docker build process. - Revised README for clarity on building the Docker image. --- .dockerignore | 11 +++++--- Dockerfile | 72 ++++++++++++++++++++++++--------------------------- README.md | 13 +++------- 3 files changed, 46 insertions(+), 50 deletions(-) diff --git a/.dockerignore b/.dockerignore index 3986f586..feedbb5e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,8 @@ **__pycache__ .vscode +CLAUDE.md .polyscope.ini +.venv/ external/ runs/ @@ -18,9 +20,7 @@ utils/ngc/grid_search_configs imgui.ini data -thirdparty/simple-knn/build -thirdparty/simple-knn/dist -thirdparty/simple-knn/simple_knn.egg-info +thirdparty/kaolin/ threedgrt_tracer/.ninja_log threedgrt_tracer/include/3dgrt/kernels/slang/*.cuh* @@ -34,3 +34,8 @@ results/ thirdparty/ncore/ playground/assets/ + +assets/nvidia-hq.gif +assets/playground_glass.gif + +uv.lock diff --git a/Dockerfile b/Dockerfile index 6ae77c79..9695077f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,48 +1,44 @@ -FROM ubuntu:24.04 +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. -ARG CUDA_VERSION=11.8.0 -ENV CUDA_VERSION=${CUDA_VERSION} -ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated ca-certificates \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \ - wget git \ - curl \ - build-essential \ - gcc-11 g++-11 \ - libgl1-mesa-dev \ - libglib2.0-0 \ - && rm -rf /var/lib/apt/lists/* +ARG CUDA_VERSION=12.8.1 +ARG UBUNTU_VERSION=24.04 -RUN curl -o ~/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py311_25.1.1-2-Linux-x86_64.sh && \ - bash ~/miniconda.sh -b -p /opt/conda && \ - rm ~/miniconda.sh && \ - /opt/conda/bin/conda install -y python=${PYTHON_VERSION} && \ - /opt/conda/bin/conda clean -ya -ENV PATH=/opt/conda/bin:$PATH -RUN conda init +FROM nvidia/cuda:${CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION} +ENV CUDA_VERSION=${CUDA_VERSION} +ENV DEBIAN_FRONTEND=noninteractive ENV NVIDIA_VISIBLE_DEVICES=all -ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility,graphics +ENV NVIDIA_DRIVER_CAPABILITIES=graphics,compute,utility +ENV EGL_PLATFORM=surfaceless +ENV XDG_DATA_HOME="/usr/local/share/uv" +ENV XDG_BIN_HOME="/usr/local/bin" +ENV UV_INSTALL_DIR="/usr/local/bin" +ENV UV_SYSTEM_PYTHON=1 ENV FORCE_CUDA=1 -# # Make sure TORCH_CUDA_ARCH_LIST matches the pytorch wheel setting. -# # Reference: https://github.com/pytorch/pytorch/blob/main/.ci/manywheel/build_cuda.sh#L54 -# # -# # (cuda11) $ python -c "import torch; print(torch.version.cuda, torch.cuda.get_arch_list())" -# # 11.8 ['sm_50', 'sm_60', 'sm_61', 'sm_70', 'sm_75', 'sm_80', 'sm_86', 'sm_37', 'sm_90', 'compute_37'] -# # -# # (cuda12) $ python -c "import torch; print(torch.version.cuda, torch.cuda.get_arch_list())" -# # 12.8 ['sm_75', 'sm_80', 'sm_86', 'sm_90', 'sm_100', 'sm_120', 'compute_120'] -# # -# RUN if [ "$CUDA_VERSION" = "11.8.0" ]; then \ -# echo 'export TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6;9.0"' >> /etc/profile.d/cuda_arch.sh; \ -# elif [ "$CUDA_VERSION" = "12.8.1" ]; then \ -# echo 'export TORCH_CUDA_ARCH_LIST="7.5;8.0;8.6;9.0;10.0;12.0"' >> /etc/profile.d/cuda_arch.sh; \ -# fi +RUN apt-get update && \ + apt-get install -y --allow-unauthenticated ca-certificates && \ + apt-get install -y -qq --no-install-recommends build-essential \ + wget git curl libgl1-mesa-dev libglib2.0-0 && \ + rm -rf /var/lib/apt/lists/* + +RUN curl -LsSf https://astral.sh/uv/install.sh | sh WORKDIR /workspace COPY . . +RUN bash ./install_env_uv.sh -RUN CUDA_VERSION=$CUDA_VERSION bash ./install_env.sh 3dgrut WITH_GCC11 -RUN echo "conda activate 3dgrut" >> ~/.bashrc +RUN echo "source $(pwd)/.venv/bin/activate" >> ~/.bashrc diff --git a/README.md b/README.md index f6cf5aa3..055cd29a 100644 --- a/README.md +++ b/README.md @@ -198,16 +198,11 @@ source .venv/bin/activate ### Building and Running with Docker -To build the Docker image: -```sh -docker build --build-arg CUDA_VERSION=12.8.1 -t 3dgrut:cuda128 . -``` - Build the Docker image: -```bash -git clone --recursive https://github.com/nv-tlabs/3dgrut.git -cd 3dgrut -docker build . -t 3dgrut +```sh +docker build --build-arg CUDA_VERSION=12.8.1 -t 3dgrut:cuda12 . +docker build --build-arg CUDA_VERSION=11.8.0 --build-arg UBUNTU_VERSION=22.04 -t 3dgrut:cuda11 . +docker buildx build --platform linux/amd64,linux/arm64 --build-arg CUDA_VERSION=13.0.2 -t 3dgrut:cuda13 . ``` Run it: From bc4be67e79d2b057e7a725034dff7235ce7a829a Mon Sep 17 00:00:00 2001 From: Qi Wu Date: Fri, 17 Apr 2026 18:22:17 -0500 Subject: [PATCH 3/4] chore(ci): remove legacy CUDA job from CI workflow - Deleted the ci-legacy job from the CI workflow to streamline the configuration and focus on current CUDA versions. - This change simplifies the CI process by eliminating outdated installation steps and dependencies. --- .github/workflows/ci.yaml | 63 --------------------------------------- 1 file changed, 63 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4eb7669a..acbeed86 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,69 +28,6 @@ jobs: - name: Check code style run: bash formatter.sh --check - ci-legacy: - name: ci-legacy (CUDA ${{ matrix.cuda_version }}) - runs-on: ubuntu-24.04 - strategy: - fail-fast: false - matrix: - cuda_version: - - "11.8.0" - - "12.8.1" - - steps: - - name: Free Disk Space (Ubuntu) - uses: jlumbroso/free-disk-space@main - with: - # this might remove tools that are actually needed, - # when set to "true" but frees about 6 GB - tool-cache: true - # all of these default to true, but feel free to set to - # "false" if necessary for your workflow - android: true - dotnet: true - haskell: true - large-packages: true - swap-storage: true - - - name: Install prerequisites - run: | - sudo apt-get update - sudo apt-get install -y --no-install-recommends \ - build-essential \ - ca-certificates \ - curl \ - gcc-11 g++-11 \ - git \ - libglib2.0-0 - - - name: Install conda - run: | - curl -o ~/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh - bash ~/miniconda.sh -b -p /opt/conda - rm ~/miniconda.sh - /opt/conda/bin/conda install -y python=${PYTHON_VERSION} - /opt/conda/bin/conda clean -ya - echo "/opt/conda/bin" >> $GITHUB_PATH - env: - PYTHON_VERSION: "3.11" - - - name: Checkout repo - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Install 3dgrut including all dependencies - run: | - git config --global --add safe.directory "$(pwd)" - ./install_env.sh 3dgrut WITH_GCC11 - env: - CUDA_VERSION: ${{ matrix.cuda_version }} - - - name: Smoketest - python train.py --help # better (smoke) testing requires a GPU - run: | - conda run -n 3dgrut python train.py --help - ci-uv: name: ci-uv (CUDA ${{ matrix.cuda_version }} Ubuntu ${{ matrix.ubuntu_version }}) runs-on: ubuntu-${{ matrix.ubuntu_version }} From ed879825ceadfe3418038ac8ba05383ef5977906 Mon Sep 17 00:00:00 2001 From: Qi Wu Date: Fri, 17 Apr 2026 18:47:14 -0500 Subject: [PATCH 4/4] chore(ci): update formatter script path in CI workflow - Changed the path for the formatter script in the CI configuration from `formatter.sh` to `scripts/formatter.sh` to reflect the new directory structure. - This adjustment ensures that the code style checks are executed correctly during the CI process. --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index acbeed86..d8c316c7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,7 +26,7 @@ jobs: run: pip install black==26.3.1 isort==5.13.0 - name: Check code style - run: bash formatter.sh --check + run: bash scripts/formatter.sh --check ci-uv: name: ci-uv (CUDA ${{ matrix.cuda_version }} Ubuntu ${{ matrix.ubuntu_version }})