[ThirdParty] Enable ucx for openmpi (#97) #427
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: deepray-release | |
| on: | |
| release: | |
| types: [published] | |
| tags: | |
| - v* | |
| push: | |
| branches: | |
| - main | |
| - master | |
| - r* | |
| pull_request: | |
| branches: | |
| - main | |
| - master | |
| - r* | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| MIN_PY_VERSION: '3.9' | |
| MAX_PY_VERSION: '3.11' | |
| jobs: | |
| build-and-upload-container: | |
| name: Build and Upload Dev Container | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| matrix: | |
| py-version: ["3.10"] | |
| tf-version: ["2.15.1"] | |
| os-version: ["20.04"] | |
| fail-fast: false | |
| if: (github.event_name == 'push' && github.ref == 'refs/heads/main') | |
| env: | |
| IMAGE_NAME: hailinfufu/deepray-dev | |
| outputs: | |
| image_tag: ${{ steps.set_image_tag.outputs.image_tag }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Free Disk Space (Ubuntu) | |
| uses: jlumbroso/free-disk-space@main | |
| with: | |
| # this might remove tools that are actually needed, | |
| # if set to "true" but frees about 6 GB | |
| tool-cache: false | |
| # 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: false | |
| docker-images: false | |
| swap-storage: false | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
| - name: Build and push Docker image with cache | |
| id: build_image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: tools/docker/dev_container.Dockerfile | |
| push: true | |
| tags: ${{ env.IMAGE_NAME }}:latest-gpu-py${{ matrix.py-version }}-tf${{ matrix.tf-version }}-cu12.2.2-ubuntu${{ matrix.os-version }} | |
| build-args: | | |
| PY_VERSION=${{ matrix.py-version }} | |
| TF_VERSION=${{ matrix.tf-version }} | |
| TF_PACKAGE=tensorflow | |
| OS_VERSION=${{ matrix.os-version }} | |
| CUDA_VERSION=12.2.2 | |
| # Docker layer caching | |
| cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:latest-gpu-py${{ matrix.py-version }}-tf${{ matrix.tf-version }}-cu12.2.2-ubuntu${{ matrix.os-version }} | |
| cache-to: type=inline | |
| - name: Set Image Tag Output | |
| id: set_image_tag | |
| run: | | |
| TAG="${{ env.IMAGE_NAME }}:latest-gpu-py${{ matrix.py-version }}-tf${{ matrix.tf-version }}-cu12.2.2-ubuntu${{ matrix.os-version }}" | |
| echo "image_tag=$TAG" >> $GITHUB_OUTPUT | |
| release-wheel: | |
| name: Build Release Wheels in Container | |
| needs: [build-and-upload-container] | |
| if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request' && github.base_ref == 'main') | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| matrix: | |
| os-version: ['20.04'] | |
| py-version: ['3.10'] | |
| tf-version: ['2.15.1'] | |
| cpu: ['x86'] | |
| fail-fast: false | |
| steps: | |
| - name: Free Disk Space (Ubuntu) | |
| uses: jlumbroso/free-disk-space@main | |
| with: | |
| # this might remove tools that are actually needed, | |
| # if set to "true" but frees about 6 GB | |
| tool-cache: false | |
| # 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: false | |
| docker-images: false | |
| swap-storage: false | |
| - uses: actions/github-script@v7 | |
| id: author-date | |
| with: | |
| github-token: ${{secrets.GITHUB_TOKEN}} | |
| script: | | |
| const commit_details = await github.rest.git.getCommit({owner: context.repo.owner, repo: context.repo.repo, commit_sha: context.sha}); | |
| return commit_details.data.author.date | |
| - uses: actions/checkout@v4 | |
| - name: Build wheels | |
| shell: bash | |
| env: | |
| BAZEL_SECRET_FOR_BUILD: ${{ secrets.BAZEL_CACHE_TOKEN }} | |
| run: | | |
| set -e -x | |
| DOCKER_BUILDKIT=1 docker build \ | |
| -f tools/docker/build_wheel.Dockerfile \ | |
| --output type=local,dest=wheelhouse \ | |
| --secret id=BAZEL_CACHE_TOKEN,env=BAZEL_SECRET_FOR_BUILD \ | |
| --build-arg PY_VERSION=${{ matrix.py-version }} \ | |
| --build-arg TF_VERSION=${{ matrix.tf-version }} \ | |
| --build-arg OS_VERSION=${{ matrix.os-version }} \ | |
| --build-arg IMAGE_TAG=latest-gpu \ | |
| --build-arg NIGHTLY_TIME=${{ steps.author-date.outputs.result }} \ | |
| ./ | |
| - name: Upload wheels as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ubuntu${{ matrix.os-version }}-py${{ matrix.py-version }}-tf${{ matrix.tf-version }}-${{ matrix.cpu }}-wheel | |
| path: wheelhouse/ | |
| build-and-upload-base-container: | |
| name: Build and Upload Base Container | |
| needs: [release-wheel] | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| matrix: | |
| os-version: ['20.04'] | |
| cpu: ['x86'] | |
| py-version: ["3.10"] | |
| tf-version: ["2.15.1"] | |
| fail-fast: false | |
| if: (github.event_name == 'push' && github.ref == 'refs/heads/main') | |
| env: | |
| IMAGE_NAME: hailinfufu/deepray-release | |
| outputs: | |
| image_tag: ${{ steps.set_image_tag.outputs.image_tag }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Free Disk Space (Ubuntu) | |
| uses: jlumbroso/free-disk-space@main | |
| with: | |
| # this might remove tools that are actually needed, | |
| # if set to "true" but frees about 6 GB | |
| tool-cache: false | |
| # 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: false | |
| docker-images: false | |
| swap-storage: false | |
| - name: Download wheels artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ubuntu${{ matrix.os-version }}-py${{ matrix.py-version }}-tf${{ matrix.tf-version }}-${{ matrix.cpu }}-wheel | |
| path: ./wheelhouse | |
| - name: Verify downloaded files | |
| run: | | |
| echo "Files in wheelhouse/:" | |
| ls -lR wheelhouse/ | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
| - name: Build and push Docker image with cache | |
| id: build_image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: tools/docker/base_container.Dockerfile | |
| push: true | |
| tags: ${{ env.IMAGE_NAME }}:nightly-gpu-py${{ matrix.py-version }}-tf${{ matrix.tf-version }}-cu12.2.2-ubuntu${{ matrix.os-version }} | |
| build-args: | | |
| PY_VERSION=${{ matrix.py-version }} | |
| TF_VERSION=${{ matrix.tf-version }} | |
| TF_PACKAGE=tensorflow | |
| OS_VERSION=${{ matrix.os-version }} | |
| CUDA_VERSION=12.2.2 | |
| # Docker layer caching | |
| cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:nightly-gpu-py${{ matrix.py-version }}-tf${{ matrix.tf-version }}-cu12.2.2-ubuntu${{ matrix.os-version }} | |
| cache-to: type=inline | |
| - name: Set Image Tag Output | |
| id: set_image_tag | |
| run: | | |
| TAG="${{ env.IMAGE_NAME }}:nightly-gpu-py${{ matrix.py-version }}-tf${{ matrix.tf-version }}-cu12.2.2-ubuntu${{ matrix.os-version }}" | |
| echo "image_tag=$TAG" >> $GITHUB_OUTPUT | |
| check-version-change: | |
| name: Check for Version Change | |
| runs-on: ubuntu-latest | |
| if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'release' | |
| outputs: | |
| version_updated: ${{ steps.filter.outputs.version_updated }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| version_updated: | |
| - 'deepray/version.py' | |
| upload-wheels: | |
| name: Publish wheels to PyPi | |
| needs: [release-wheel, check-version-change] | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| matrix: | |
| os: ['20.04'] | |
| py-version: ['3.10'] | |
| tf-version: ['2.15.1'] | |
| cpu: ['x86'] | |
| fail-fast: false | |
| if: ${{ needs.check-version-change.outputs.version_updated == 'true' }} | |
| steps: | |
| - name: Download wheels artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ubuntu${{ matrix.os }}-py${{ matrix.py-version }}-tf${{ matrix.tf-version }}-${{ matrix.cpu }}-wheel | |
| path: ./dist | |
| - name: Verify downloaded files | |
| run: | | |
| set -e -x | |
| ls -la dist/ | |
| sha256sum dist/*.whl | |
| - name: Publish to PyPI | |
| uses: pypa/[email protected] | |
| with: | |
| user: __token__ | |
| password: ${{ secrets.pypi_token }} |