diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml deleted file mode 100644 index 14df548019..0000000000 --- a/.github/workflows/examples.yml +++ /dev/null @@ -1,81 +0,0 @@ -name: Examples (CPU) - -on: - pull_request: - branches: - - main - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} - cancel-in-progress: true - -jobs: - run-examples: - runs-on: ubuntu-24.04 - name: ubuntu-24.04-3.12-examples - - env: - HF_HUB_DOWNLOAD_TIMEOUT: 60 - FORCE_COLOR: 1 - PY_COLORS: 1 - GS_CACHE_FILE_PATH: ".cache/genesis" - TI_OFFLINE_CACHE: "1" - TI_OFFLINE_CACHE_CLEANING_POLICY: "never" - TI_OFFLINE_CACHE_FILE_PATH: ".cache/taichi" - TI_ENABLE_CUDA: "0" - TI_ENABLE_METAL: "0" - TI_ENABLE_OPENGL: "0" - TI_ENABLE_VULKAN: "0" - TI_DEBUG: "0" - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - - name: Install Mesa OpenGL driver for headless rendering - run: | - sudo apt-get update - sudo apt install -y \ - libglu1-mesa \ - libegl-mesa0 \ - libgl1-mesa-dev - - - name: Install Python deps - run: | - pip install --upgrade pip setuptools wheel - pip install torch --index-url https://download.pytorch.org/whl/cpu - pip install -e '.[dev]' pynput - - - name: Get gstaichi version - id: gstaichi_version - shell: bash - run: | - GSTAICHI_VERSION=$(python -c "import importlib.metadata ; print(importlib.metadata.version('gstaichi'))") - echo "GSTAICHI_VERSION=${GSTAICHI_VERSION}" - echo "GSTAICHI_VERSION=${GSTAICHI_VERSION}" >> $GITHUB_OUTPUT - - - name: Restore cache - uses: actions/cache/restore@v4 - with: - path: .cache - key: ubuntu-24.04-3.12-examples-${{ steps.gstaichi_version.outputs.GSTAICHI_VERSION }} - restore-keys: | - ubuntu-24.04-3.12-examples-${{ steps.gstaichi_version.outputs.GSTAICHI_VERSION }}- - - - name: Run examples suite - run: | - pytest -v -m examples tests/test_examples.py - - - name: Save cache - if: always() - uses: actions/cache/save@v4 - with: - path: .cache - key: ubuntu-24.04-3.12-examples-${{ steps.gstaichi_version.outputs.GSTAICHI_VERSION }}-${{ github.run_id }}-${{ github.run_attempt }} diff --git a/.github/workflows/generic.yml b/.github/workflows/generic.yml deleted file mode 100644 index 22d42d3172..0000000000 --- a/.github/workflows/generic.yml +++ /dev/null @@ -1,175 +0,0 @@ -name: Generic - -on: - pull_request: - branches: - - main - release: - branches: - - main - types: [published] - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} - -jobs: - generic-cpu: - name: ${{ matrix.OS }}-${{ matrix.PYTHON_VERSION }}-${{ matrix.GS_BACKEND }}-${{ matrix.GS_USE_NDARRAY == '1' && 'ndarray' || 'field' }} - - strategy: - fail-fast: false - matrix: - # See official Github documentation for details: https://shorturl.at/NJgsj - OS: ["ubuntu-22.04", "ubuntu-24.04", "macos-15"] - PYTHON_VERSION: ["3.10", "3.11", "3.12", "3.13"] - GS_BACKEND: ["cpu"] - GS_USE_NDARRAY: ["0"] - include: - - OS: "windows-2025" - PYTHON_VERSION: "3.12" - GS_BACKEND: "cpu" - GS_USE_NDARRAY: "0" - - OS: "macos-15" - PYTHON_VERSION: "3.12" - GS_BACKEND: "gpu" - GS_USE_NDARRAY: "0" - - OS: "ubuntu-24.04" - PYTHON_VERSION: "3.12" - GS_BACKEND: "cpu" - GS_USE_NDARRAY: "1" - - env: - HF_HUB_DOWNLOAD_TIMEOUT: 60 - FORCE_COLOR: 1 - PY_COLORS: 1 - GS_CACHE_FILE_PATH: ".cache/genesis" - GS_USE_NDARRAY: ${{ matrix.GS_USE_NDARRAY }} - GS_BETA_PURE: ${{ matrix.GS_USE_NDARRAY }} # we turn on beta pure for ndarray - GS_TORCH_FORCE_CPU_DEVICE: "1" - TI_OFFLINE_CACHE: "1" - TI_OFFLINE_CACHE_CLEANING_POLICY: "never" - TI_OFFLINE_CACHE_FILE_PATH: ".cache/taichi" - TI_ENABLE_CUDA: "0" - TI_ENABLE_METAL: "1" - TI_ENABLE_OPENGL: "0" - TI_ENABLE_VULKAN: "0" - TI_DEBUG: "0" - - runs-on: ${{ matrix.OS }} - if: github.event_name != 'release' - - steps: - - name: Print system information (Windows) - if: startsWith(matrix.OS, 'windows-') - shell: pwsh - run: | - $cpu = Get-CimInstance -ClassName Win32_Processor - $ram = Get-CimInstance -ClassName Win32_ComputerSystem - [PSCustomObject]@{ - CPU_Name = $cpu.Name - Physical_Cores = ($cpu | Measure-Object -Property NumberOfCores -Sum).Sum - Logical_Processors = ($cpu | Measure-Object -Property NumberOfLogicalProcessors -Sum).Sum - Total_RAM_GB = [math]::Round($ram.TotalPhysicalMemory / 1GB, 2) - } - - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.PYTHON_VERSION }} - - - name: Install system dependencies (Windows) - if: startsWith(matrix.OS, 'windows-') - shell: bash - run: | - curl -L -o mesa.7z https://github.com/pal1000/mesa-dist-win/releases/download/25.1.5/mesa3d-25.1.5-release-msvc.7z - 7z x mesa.7z -omesa - mv -v mesa/x64/* /C/Windows/System32/ - - - name: Install Mesa 25 OpenGL driver (Linux) - if: startsWith(matrix.OS, 'ubuntu-') - run: | - sudo add-apt-repository -y ppa:kisak/kisak-mesa - sudo apt-get update - sudo apt install -y \ - libglu1-mesa \ - libegl-mesa0 \ - libgl1-mesa-dev - - name: Install python dependencies - run: | - pip install --upgrade pip setuptools pkg-info wheel - pip3 install torch --index-url https://download.pytorch.org/whl/cpu - - - name: Black Format Check - if: matrix.OS == 'ubuntu-22.04' && matrix.PYTHON_VERSION == '3.12' - run: | - pip install black - black --line-length 120 --check . - - - name: Install Genesis - run: | - pip install -e '.[dev]' - - - name: Get gstaichi version - id: gstaichi_version - shell: bash - run: | - GSTAICHI_VERSION=$(python -c "import importlib.metadata ; print(importlib.metadata.version('gstaichi'))") - echo "GSTAICHI_VERSION=${GSTAICHI_VERSION}" - echo "GSTAICHI_VERSION=${GSTAICHI_VERSION}" >> $GITHUB_OUTPUT - - - name: Restore Taichi Kernel Cache - if: always() - uses: actions/cache/restore@v4 - with: - path: .cache - key: ${{ matrix.OS }}-${{ matrix.PYTHON_VERSION }}-${{ steps.gstaichi_version.outputs.GSTAICHI_VERSION }} - restore-keys: | - ${{ matrix.OS }}-${{ matrix.PYTHON_VERSION }}-${{ steps.gstaichi_version.outputs.GSTAICHI_VERSION }}- - - - name: Run unit tests - run: | - pytest -v --logical --dev --backend ${{ matrix.GS_BACKEND }} --forked -m required ./tests - - - name: Save Updated Taichi Kernel Cache - if: always() - uses: actions/cache/save@v4 - with: - path: .cache - # Note that it is necessary to create a new archive systematically for now: - # See: https://github.com/actions/cache/issues/1594 - key: ${{ matrix.OS }}-${{ matrix.PYTHON_VERSION }}-${{ steps.gstaichi_version.outputs.GSTAICHI_VERSION }}-${{ github.run_id }}-${{ github.run_attempt }} - - publish-pypi: - name: Publish on PyPI - runs-on: ubuntu-24.04 - permissions: - id-token: write - environment: - name: advance - - if: github.event_name == 'release' - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - - name: Build wheels - run: | - pip wheel --no-deps . -w wheelhouse - - - name: Publish the wheels on PyPI - uses: pypa/gh-action-pypi-publish@v1.12.4 - with: - packages-dir: wheelhouse - verify-metadata: true - attestations: true - print-hash: true - skip-existing: true diff --git a/.github/workflows/gpu_on_github.yml b/.github/workflows/gpu_on_github.yml new file mode 100644 index 0000000000..fa3dbdb8cb --- /dev/null +++ b/.github/workflows/gpu_on_github.yml @@ -0,0 +1,77 @@ +name: gpu_on_github + +on: + # Trigger the workflow on push on the master branch, or for any pull request + push: + branches: + - main + pull_request: + branches: + - main + +concurrency: + # Cancel all workflows that are stil running if any when updating branches associated with PRs, + # BUT don't do anything for workflows that are not triggered by PRs. + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + linux-gpu: + # run on github gpu runner + runs-on: gpu-t4-4-core + + env: + # Note that secrets are not passed to workflows that are triggered by a pull request from a fork + HF_HUB_DOWNLOAD_TIMEOUT: 60 + FORCE_COLOR: 1 + PY_COLORS: 1 + MADRONA_DISABLE_CUDA_HEAP_SIZE: "1" + OMNI_KIT_ACCEPT_EULA: "yes" + OMNI_KIT_ALLOW_ROOT: "1" + GS_BACKEND: "gpu" + GS_USE_NDARRAY: "0" + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install python dependencies + run: | + pip install --upgrade pip setuptools pkg-info wheel + pip install torch + + - name: Install Genesis + run: | + pip install -e '.[dev]' + + - name: Get gstaichi version + id: gstaichi_version + shell: bash + run: | + GSTAICHI_VERSION=$(python -c "import importlib.metadata ; print(importlib.metadata.version('gstaichi'))") + echo "GSTAICHI_VERSION=${GSTAICHI_VERSION}" + echo "GSTAICHI_VERSION=${GSTAICHI_VERSION}" >> $GITHUB_OUTPUT + + - name: Restore Taichi Kernel Cache + if: always() + uses: actions/cache/restore@v4 + with: + path: .cache + key: ubuntu-24.04-3.10-${{ steps.gstaichi_version.outputs.GSTAICHI_VERSION }} + restore-keys: | + ubuntu-24.04-3.10-${{ steps.gstaichi_version.outputs.GSTAICHI_VERSION }}- + + - name: Run unit tests + if: github.event_name == 'pull_request' + run: | + pip install --no-input --extra-index-url https://pypi.nvidia.com/ omniverse-kit + pip install --no-input ".[dev,render,usd]" + + pytest -v --backend gpu --dev -n 1 -m required --forked --logical "tests/test_rigid_physics.py" diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml deleted file mode 100644 index 1a56d36386..0000000000 --- a/.github/workflows/production.yml +++ /dev/null @@ -1,128 +0,0 @@ -name: Production - -on: - # Trigger the workflow on push on the master branch, or for any pull request - push: - branches: - - main - pull_request: - branches: - - main - -concurrency: - # Cancel all workflows that are stil running if any when updating branches associated with PRs, - # BUT don't do anything for workflows that are not triggered by PRs. - group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} - -jobs: - linux-gpu: - runs-on: [self-hosted, coreweave, genesis-world] - - env: - # Note that secrets are not passed to workflows that are triggered by a pull request from a fork - WANDB_API_KEY: ${{ secrets.WANDB_API_KEY }} - HF_TOKEN: ${{ secrets.HF_TOKEN }} - HF_HUB_DOWNLOAD_TIMEOUT: 60 - GENESIS_IMAGE_VER: "1_5" - TIMEOUT_MINUTES: 180 - FORCE_COLOR: 1 - PY_COLORS: 1 - MADRONA_DISABLE_CUDA_HEAP_SIZE: "1" - OMNI_KIT_ACCEPT_EULA: "yes" - OMNI_KIT_ALLOW_ROOT: "1" - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - # Checkout full history is required to shallow cloning while mark HEAD as "grafted". This breaks remote - # tracking thereby making it impossible to detect whether a commit is contained in upstream main. - fetch-depth: 0 - - - name: Run unit tests - if: github.event_name == 'pull_request' - run: | - SLURM_JOB_NAME="$(uuidgen)_$(date +%Y%m%d_%H%M%S)" - echo "SLURM_JOB_NAME=${SLURM_JOB_NAME}" >> $GITHUB_ENV - - mkdir -p "${HOME}/.cache" "${HOME}/.venv" - - # TODO: USD baking does not currently support Python 3.11 since - # NVIDIA does not currently release `omniverse-kit==107.3` on PyPI. - # See: https://github.com/Genesis-Embodied-AI/Genesis/pull/1300 - srun \ - --container-image="/mnt/data/images/genesis-v${GENESIS_IMAGE_VER}.sqsh" \ - --container-mounts=\ - "${HOME}/.venv":/root/.venv,\ - "${HOME}/.cache":/root/.cache,\ - "${{ github.workspace }}":/root/workspace \ - --no-container-mount-home --container-workdir=/root/workspace \ - --export=NVIDIA_DRIVER_CAPABILITIES=all,HF_TOKEN,BASH_ENV=/root/.bashrc \ - --partition=hpc-mid --exclusive --nodes=1 --time="${TIMEOUT_MINUTES}" \ - --job-name=${SLURM_JOB_NAME} \ - bash -e -s << 'EOF' - if test -n "$(find /root/.venv -maxdepth 0 -empty)"; then - python3 -m venv --system-site-packages /root/.venv - source /root/.venv/bin/activate - pip install --no-input --upgrade pip pkg-info wheel - pip install --no-input --ignore-installed --upgrade blinker pyparsing setuptools - fi - source /root/.venv/bin/activate - - pip install --no-input --extra-index-url https://pypi.nvidia.com/ omniverse-kit - pip install --no-input ".[dev,render,usd]" - - pytest -v --backend gpu --dev --forked ./tests - EOF - - name: Run benchmarks - run: | - SLURM_JOB_NAME="$(uuidgen)_$(date +%Y%m%d_%H%M%S)" - echo "SLURM_JOB_NAME=${SLURM_JOB_NAME}" >> $GITHUB_ENV - - SLURM_ENV_VARS="NVIDIA_DRIVER_CAPABILITIES=all,HF_TOKEN,BASH_ENV=/root/.bashrc" - if [[ "${{ github.repository }}" == 'Genesis-Embodied-AI/Genesis' && "${{ github.ref }}" == 'refs/heads/main' ]] ; then - SLURM_ENV_VARS="${SLURM_ENV_VARS},WANDB_API_KEY" - fi - - srun \ - --container-image="/mnt/data/images/genesis-v${GENESIS_IMAGE_VER}.sqsh" \ - --container-mounts=\ - "${HOME}/.venv":/root/.venv,\ - /mnt/data/artifacts:/mnt/data/artifacts,\ - "${{ github.workspace }}":/root/workspace \ - --no-container-mount-home --container-workdir=/root/workspace \ - --export=${SLURM_ENV_VARS} \ - --partition=hpc-mid --exclusive --nodes=1 --time="${TIMEOUT_MINUTES}" \ - --job-name=${SLURM_JOB_NAME} \ - bash -e -s << 'EOF' - # sudo apt update - # sudo apt install -y tmate - # tmate -S /tmp/tmate.sock new-session -d - # tmate -S /tmp/tmate.sock wait tmate-ready - # tmate -S /tmp/tmate.sock display -p '#{tmate_ssh}' - - source /root/.venv/bin/activate - pip install --no-input ".[dev,render]" - - pytest --print -x -m "benchmarks" ./tests - cat speed_test*.txt > "/mnt/data/artifacts/speed_test_${SLURM_JOB_NAME}.txt" - - # tmate -S /tmp/tmate.sock wait tmate-exit - EOF - - name: Kill srun job systematically - if: always() - run: | - if [ -n "${SLURM_JOB_NAME}" ] ; then - scancel --user=${USER} --name="${SLURM_JOB_NAME}" - fi - - - name: Display benchmark stats - run: | - cat "/mnt/data/artifacts/speed_test_${SLURM_JOB_NAME}.txt" - - - name: Upload benchmark stats as artifact - uses: actions/upload-artifact@v4 - with: - name: speed-test-results - path: "/mnt/data/artifacts/speed_test_${{ env.SLURM_JOB_NAME }}.txt"