name: facebookresearch/pytorch3d/build_and_test on: pull_request: branches: - main push: branches: - main jobs: binary_linux_conda_cuda: runs-on: 4-core-ubuntu-gpu-t4 env: PYTHON_VERSION: "3.12" BUILD_VERSION: "${{ github.run_number }}" PYTORCH_VERSION: "2.4.1" CU_VERSION: "cu121" JUST_TESTRUN: 1 steps: - uses: actions/checkout@v4 - name: Build and run tests run: |- conda create --name env --yes --quiet conda-build conda run --no-capture-output --name env python3 ./packaging/build_conda.py --use-conda-cuda # Build-only verification for the ROCm/HIP code paths. Runs in an AMD ROCm # dev container on a CPU-only GitHub runner; we don't need an AMD GPU just # to compile, and not running tests keeps the CI cost low. Catches build # regressions in the ROCm code paths (USE_ROCM guards, hipify-touched sources, # the pulsar HIP intrinsic replacements, etc.). linux_rocm_build: runs-on: ubuntu-latest container: # `-complete` tag bundles the full ROCm math stack (rocThrust, hipCUB, # rocPRIM, ...). The plain `7.2.3` tag is HIP-runtime-only and fails to # find when including PyTorch headers. image: rocm/dev-ubuntu-22.04:7.2.3-complete env: PYTORCH_VERSION: "2.11.0" ROCM_INDEX: "rocm7.2" steps: - uses: actions/checkout@v4 - name: Install Python and torch+rocm run: |- apt-get update apt-get install -y --no-install-recommends python3 python3-dev python3-pip git python3 -m pip install --upgrade pip python3 -m pip install --index-url https://download.pytorch.org/whl/${ROCM_INDEX} torch==${PYTORCH_VERSION} - name: Verify torch is ROCm-built run: |- python3 -c "import torch; assert torch.version.hip is not None, 'torch is not HIP-built'; print('torch.version.hip:', torch.version.hip)" - name: Build pytorch3d _C extension (build only, no tests) env: # CPU-only runner: torch.cuda.is_available() is False, so force the # CUDAExtension path. ROCM_HOME is auto-detected from /opt/rocm in # the rocm/dev-ubuntu container. FORCE_CUDA: "1" run: |- python3 -m pip install --no-build-isolation -v . - name: Smoke import # cd out of the checkout root so the source-tree pytorch3d/ directory # (which has no _C.so since the build doesn't install in-place) doesn't # shadow the site-packages install via sys.path[0] for `python -c`. run: |- cd /tmp python3 -c "import torch; from pytorch3d import _C; print('PulsarRenderer:', hasattr(_C, 'PulsarRenderer')); print('n_symbols:', len([s for s in dir(_C) if not s.startswith('_')]))"