From 5b9d135ffe426cefd6d772a13a2b4b9d2aa201f5 Mon Sep 17 00:00:00 2001 From: Sandeep Datta Date: Thu, 20 Jul 2023 07:42:22 -0700 Subject: [PATCH 01/20] +gh-build.yml +gh-cleanup.yml +Dockerfile +build-cunumeric-all -ci-gh.yml. --- .../workflows/ci-gh-cpu-build-and-test.yml | 51 +++++++++ .github/workflows/gh-build.yml | 106 ++++++++++++++++++ .github/workflows/gh-cleanup.yml | 43 +++++++ continuous_integration/Dockerfile | 34 ++++++ .../home/coder/.local/bin/build-cunumeric-all | 17 +++ 5 files changed, 251 insertions(+) create mode 100644 .github/workflows/ci-gh-cpu-build-and-test.yml create mode 100644 .github/workflows/gh-build.yml create mode 100644 .github/workflows/gh-cleanup.yml create mode 100644 continuous_integration/Dockerfile create mode 100644 continuous_integration/home/coder/.local/bin/build-cunumeric-all diff --git a/.github/workflows/ci-gh-cpu-build-and-test.yml b/.github/workflows/ci-gh-cpu-build-and-test.yml new file mode 100644 index 0000000000..d2ceab8035 --- /dev/null +++ b/.github/workflows/ci-gh-cpu-build-and-test.yml @@ -0,0 +1,51 @@ +name: Build and test CPU legate.core on GH + +concurrency: + group: ci-cpu-on-${{ github.event_name }}-from-${{ github.ref_name }} + cancel-in-progress: true + +on: + push: + branches: + - "pull-request/[0-9]+" + - "branch-*" + +jobs: + build-cpu: + uses: + ./.github/workflows/gh-build.yml + with: + build-target: cpu + # Ref: https://docs.rapids.ai/resources/github-actions/#cpu-labels for `linux-amd64-cpu4` + runs-on: ${{ github.repository == 'nv-legate/legate.core' && 'linux-amd64-cpu4' || 'ubuntu-latest' }} + sha: ${{ github.sha }} + + # test-cpu: + # needs: + # - build-cpu + # strategy: + # fail-fast: false + # matrix: + # include: + # - { name: Pytest Unit Tests, test-scope: unit } + # - { name: mypy, test-scope: mypy } + # name: ${{ matrix.name }} + # uses: + # ./.github/workflows/gh-test.yml + # with: + # build-target: cpu + # runs-on: ${{ github.repository == 'nv-legate/legate.core' && 'linux-amd64-cpu4' || 'ubuntu-latest' }} + # sha: ${{ github.sha }} + # test-scope: ${{ matrix.test-scope }} + + cleanup: + needs: + - build-cpu + # - test-cpu + # This ensures the cleanup job runs even if previous jobs fail or the workflow is cancelled. + if: always() + uses: + ./.github/workflows/gh-cleanup.yml + with: + build-target: cpu + sha: ${{ github.sha }} diff --git a/.github/workflows/gh-build.yml b/.github/workflows/gh-build.yml new file mode 100644 index 0000000000..dba7a8a286 --- /dev/null +++ b/.github/workflows/gh-build.yml @@ -0,0 +1,106 @@ +name: Build cunumeric on GH + +on: + workflow_call: + inputs: + build-target: + required: true + type: string + runs-on: + required: true + type: string + sha: + required: true + type: string + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BASE_IMAGE: rapidsai/devcontainers:23.06-cpp-cuda11.8-mambaforge-ubuntu22.04 + IMAGE_NAME_LEGATE: legate.core-${{ inputs.build-target }} + IMAGE_NAME_CUNUMERIC: cunumeric-${{ inputs.build-target }} + USE_CUDA: ${{ (inputs.build-target == 'cpu' && 'OFF') || 'ON' }} + +jobs: + build: + name: build-${{ inputs.build-target }}-sub-workflow + + permissions: + id-token: write # This is required for configure-aws-credentials + contents: read # This is required for actions/checkout + packages: write # This is required to push docker image to ghcr.io + + runs-on: ${{ inputs.runs-on }} + + steps: + - name: Checkout legate.core + uses: actions/checkout@v3 + with: + repository: nv-legate/legate.core + fetch-depth: 0 + path: legate + + - name: Checkout cunumeric (= this repo) + uses: actions/checkout@v3 + with: + fetch-depth: 0 + path: cunumeric + + - if: github.repository_owner == 'nv-legate' + name: Get AWS credentials for sccache bucket + uses: aws-actions/configure-aws-credentials@v2 + with: + aws-region: us-east-2 + role-duration-seconds: 28800 # 8 hours + role-to-assume: arn:aws:iam::279114543810:role/gha-oidc-nv-legate + + - name: Build legate.core using docker build + run: | + echo BUILD_TARGET: ${{ inputs.build-target }} + echo USE_CUDA: ${{ env.USE_CUDA }} + + chmod +x legate/continuous_integration/build-docker-image + legate/continuous_integration/build-docker-image \ + --base-image "$BASE_IMAGE" \ + --image-name "$IMAGE_NAME_LEGATE" \ + --sha ${{ inputs.sha }} \ + --source-dir legate + + - name: Build cunumeric using docker build + run: | + legate/continuous_integration/build-docker-image \ + --base-image "$IMAGE_NAME_LEGATE:${{ inputs.sha }}" \ + --image-name "$IMAGE_NAME_CUNUMERIC" \ + --sha ${{ inputs.sha }} \ + --source-dir cunumeric + + - name: Log in to container image registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin + + - name: Push cunumeric image + run: | + IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME_CUNUMERIC + + # Change all uppercase to lowercase + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') + + VERSION=${{ inputs.sha }} + + docker tag $IMAGE_NAME_CUNUMERIC:$VERSION $IMAGE_ID:$VERSION + docker push $IMAGE_ID:$VERSION + + - name: Copy artifacts back to the host + run: | + mkdir -p artifacts + docker run -v "$(pwd)/artifacts:/home/coder/.artifacts" --rm -t $IMAGE_NAME_CUNUMERIC:${{ inputs.sha }} copy-artifacts + echo --------- DOCKER HISTORY START ----------- + docker history $IMAGE_NAME_CUNUMERIC:${{ inputs.sha }} + echo --------- DOCKER HISTORY END ----------- + + - name: Display structure of workdir + run: ls -R + + - name: Upload build artifacts + uses: actions/upload-artifact@v3 + with: + name: "cunumeric-${{ inputs.build-target }}-${{ inputs.sha }}" + path: artifacts diff --git a/.github/workflows/gh-cleanup.yml b/.github/workflows/gh-cleanup.yml new file mode 100644 index 0000000000..6451c401c3 --- /dev/null +++ b/.github/workflows/gh-cleanup.yml @@ -0,0 +1,43 @@ +name: Clean up + +on: + workflow_call: + inputs: + build-target: + required: true + type: string + sha: + required: true + type: string + +env: + IMAGE_NAME: cunumeric-${{ inputs.build-target }} + +jobs: + cleanup: + permissions: + packages: write + + runs-on: ubuntu-latest + + steps: + - name: Delete docker image + run: | + set -xeuo pipefail + + PACKAGE_NAME=${{ env.IMAGE_NAME }} + PACKAGE_VERSION_ID=$( + curl -L \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ github.token }}"\ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/orgs/${{ github.repository_owner }}/packages/container/$PACKAGE_NAME/versions | + jq '.[] | select(.metadata.container.tags[] == "${{ inputs.sha }}") | .id' - + ) + + curl -L \ + -X DELETE \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ github.token }}"\ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/orgs/${{ github.repository_owner }}/packages/container/$PACKAGE_NAME/versions/$PACKAGE_VERSION_ID diff --git a/continuous_integration/Dockerfile b/continuous_integration/Dockerfile new file mode 100644 index 0000000000..40bd70d0fc --- /dev/null +++ b/continuous_integration/Dockerfile @@ -0,0 +1,34 @@ +ARG BASE_IMAGE +FROM ${BASE_IMAGE} as stage0 + +COPY --chown=coder:coder continuous_integration/home/coder/.local/bin/* /home/coder/.local/bin/ +COPY --chown=coder:coder . /home/coder/cnumeric + +RUN chmod a+x /home/coder/.local/bin/* + +#--------------------------------------------------- +FROM stage0 as setup + +RUN get-yaml-and-make-conda-env + +#--------------------------------------------------- +FROM setup as build +ARG GITHUB_TOKEN +ENV GITHUB_TOKEN=${GITHUB_TOKEN} +ARG AWS_SESSION_TOKEN +ENV AWS_SESSION_TOKEN=${AWS_SESSION_TOKEN} +ARG AWS_ACCESS_KEY_ID +ENV AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} +ARG AWS_SECRET_ACCESS_KEY +ENV AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} + +# If .creds exists copy it to /run/secrets +COPY --chown=coder:coder .cred[s] /run/secrets + +RUN entrypoint build-cunumeric-all + +#--------------------------------------------------- +FROM stage0 as final +COPY --from=build /tmp/out /tmp/out +COPY --from=build /tmp/conda-build /tmp/conda-build +COPY --from=build /tmp/env_yaml /tmp/env_yaml diff --git a/continuous_integration/home/coder/.local/bin/build-cunumeric-all b/continuous_integration/home/coder/.local/bin/build-cunumeric-all new file mode 100644 index 0000000000..62c6da0d7e --- /dev/null +++ b/continuous_integration/home/coder/.local/bin/build-cunumeric-all @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + + +build_cunumeric_all() { + set -x + cd ~/; + + conda info + + set -euo pipefail; + + build-cunumeric-cpp; + build-cunumeric-wheel; + build-cunumeric-conda; +} + +(build_cunumeric_all "$@"); From e6a8c6b8d5e487487888449a60709ea34bbfd821 Mon Sep 17 00:00:00 2001 From: Sandeep Datta Date: Thu, 20 Jul 2023 08:23:08 -0700 Subject: [PATCH 02/20] Use sandeepd-nv/legate.core instead of nv-legate/legate.core until the implementation is ready to be merged. --- .github/workflows/ci-gh-cpu-build-and-test.yml | 4 +++- .github/workflows/gh-build.yml | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-gh-cpu-build-and-test.yml b/.github/workflows/ci-gh-cpu-build-and-test.yml index d2ceab8035..1f1adcf418 100644 --- a/.github/workflows/ci-gh-cpu-build-and-test.yml +++ b/.github/workflows/ci-gh-cpu-build-and-test.yml @@ -17,7 +17,9 @@ jobs: with: build-target: cpu # Ref: https://docs.rapids.ai/resources/github-actions/#cpu-labels for `linux-amd64-cpu4` - runs-on: ${{ github.repository == 'nv-legate/legate.core' && 'linux-amd64-cpu4' || 'ubuntu-latest' }} + # TODO: undo + # runs-on: ${{ github.repository == 'nv-legate/legate.core' && 'linux-amd64-cpu4' || 'ubuntu-latest' }} + runs-on: ${{ 'linux-amd64-cpu4' || 'ubuntu-latest' }} sha: ${{ github.sha }} # test-cpu: diff --git a/.github/workflows/gh-build.yml b/.github/workflows/gh-build.yml index dba7a8a286..45487d02a5 100644 --- a/.github/workflows/gh-build.yml +++ b/.github/workflows/gh-build.yml @@ -35,7 +35,9 @@ jobs: - name: Checkout legate.core uses: actions/checkout@v3 with: - repository: nv-legate/legate.core + # TODO: undo + # repository: nv-legate/legate.core + repository: sandeepd-nv/legate.core fetch-depth: 0 path: legate @@ -45,7 +47,8 @@ jobs: fetch-depth: 0 path: cunumeric - - if: github.repository_owner == 'nv-legate' + - # TODO: undo + # if: github.repository_owner == 'nv-legate' name: Get AWS credentials for sccache bucket uses: aws-actions/configure-aws-credentials@v2 with: From 68f1644796cb0c684395b9d927708163c2d375c9 Mon Sep 17 00:00:00 2001 From: Sandeep Datta Date: Thu, 20 Jul 2023 08:24:37 -0700 Subject: [PATCH 03/20] Attempt 2. Use sandeepd-nv/legate.core instead of nv-legate/legate.core until the implementation is ready to be merged. --- .github/workflows/ci-gh-cpu-build-and-test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci-gh-cpu-build-and-test.yml b/.github/workflows/ci-gh-cpu-build-and-test.yml index 1f1adcf418..63d18ccb3f 100644 --- a/.github/workflows/ci-gh-cpu-build-and-test.yml +++ b/.github/workflows/ci-gh-cpu-build-and-test.yml @@ -9,6 +9,8 @@ on: branches: - "pull-request/[0-9]+" - "branch-*" + # TODO: undo + - "*" jobs: build-cpu: From fdb73a20d341680ec0cab15e465c8b46407bc51f Mon Sep 17 00:00:00 2001 From: Sandeep Datta Date: Thu, 20 Jul 2023 08:31:23 -0700 Subject: [PATCH 04/20] Removed all 'TODO: undo' except one. --- .github/workflows/ci-gh-cpu-build-and-test.yml | 6 +----- .github/workflows/gh-build.yml | 3 +-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-gh-cpu-build-and-test.yml b/.github/workflows/ci-gh-cpu-build-and-test.yml index 63d18ccb3f..d2ceab8035 100644 --- a/.github/workflows/ci-gh-cpu-build-and-test.yml +++ b/.github/workflows/ci-gh-cpu-build-and-test.yml @@ -9,8 +9,6 @@ on: branches: - "pull-request/[0-9]+" - "branch-*" - # TODO: undo - - "*" jobs: build-cpu: @@ -19,9 +17,7 @@ jobs: with: build-target: cpu # Ref: https://docs.rapids.ai/resources/github-actions/#cpu-labels for `linux-amd64-cpu4` - # TODO: undo - # runs-on: ${{ github.repository == 'nv-legate/legate.core' && 'linux-amd64-cpu4' || 'ubuntu-latest' }} - runs-on: ${{ 'linux-amd64-cpu4' || 'ubuntu-latest' }} + runs-on: ${{ github.repository == 'nv-legate/legate.core' && 'linux-amd64-cpu4' || 'ubuntu-latest' }} sha: ${{ github.sha }} # test-cpu: diff --git a/.github/workflows/gh-build.yml b/.github/workflows/gh-build.yml index 45487d02a5..72c13360ac 100644 --- a/.github/workflows/gh-build.yml +++ b/.github/workflows/gh-build.yml @@ -47,8 +47,7 @@ jobs: fetch-depth: 0 path: cunumeric - - # TODO: undo - # if: github.repository_owner == 'nv-legate' + - if: github.repository_owner == 'nv-legate' name: Get AWS credentials for sccache bucket uses: aws-actions/configure-aws-credentials@v2 with: From 4b340b8f96349fda1e504f38716a1972243c3536 Mon Sep 17 00:00:00 2001 From: Sandeep Datta Date: Thu, 20 Jul 2023 08:34:19 -0700 Subject: [PATCH 05/20] Use the make_ghci_parts_reusable_from_cunumeric branch of sandeepd-nv/legate.core. --- .github/workflows/gh-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/gh-build.yml b/.github/workflows/gh-build.yml index 72c13360ac..cbece8de56 100644 --- a/.github/workflows/gh-build.yml +++ b/.github/workflows/gh-build.yml @@ -38,6 +38,7 @@ jobs: # TODO: undo # repository: nv-legate/legate.core repository: sandeepd-nv/legate.core + ref: 'make_ghci_parts_reusable_from_cunumeric' fetch-depth: 0 path: legate From 3b75d4bfdf7804520d0cd7d6802e98a8651214f3 Mon Sep 17 00:00:00 2001 From: Sandeep Datta Date: Fri, 21 Jul 2023 02:02:31 -0700 Subject: [PATCH 06/20] Show docker version. --- .github/workflows/gh-build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/gh-build.yml b/.github/workflows/gh-build.yml index cbece8de56..af4e2a861e 100644 --- a/.github/workflows/gh-build.yml +++ b/.github/workflows/gh-build.yml @@ -56,6 +56,9 @@ jobs: role-duration-seconds: 28800 # 8 hours role-to-assume: arn:aws:iam::279114543810:role/gha-oidc-nv-legate + - name: Docker version + run: docker version + - name: Build legate.core using docker build run: | echo BUILD_TARGET: ${{ inputs.build-target }} From 070714f2b21f2c3a7b550a10a1f519fd38c93930 Mon Sep 17 00:00:00 2001 From: Sandeep Datta Date: Fri, 21 Jul 2023 03:36:10 -0700 Subject: [PATCH 07/20] +Docker system prune. --- .github/workflows/gh-build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gh-build.yml b/.github/workflows/gh-build.yml index af4e2a861e..36bc2c449c 100644 --- a/.github/workflows/gh-build.yml +++ b/.github/workflows/gh-build.yml @@ -56,8 +56,10 @@ jobs: role-duration-seconds: 28800 # 8 hours role-to-assume: arn:aws:iam::279114543810:role/gha-oidc-nv-legate - - name: Docker version - run: docker version + - name: Docker system prune + run: | + docker version + docker system prune --all --force - name: Build legate.core using docker build run: | From 63851e2a02ede54d409633f50c596b03b80a65e0 Mon Sep 17 00:00:00 2001 From: Sandeep Datta Date: Fri, 21 Jul 2023 04:01:40 -0700 Subject: [PATCH 08/20] See if linux-amd64-cpu4 can be used from sandeepd-nv/cunumeric. --- .github/workflows/ci-gh-cpu-build-and-test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-gh-cpu-build-and-test.yml b/.github/workflows/ci-gh-cpu-build-and-test.yml index d2ceab8035..087eaba9da 100644 --- a/.github/workflows/ci-gh-cpu-build-and-test.yml +++ b/.github/workflows/ci-gh-cpu-build-and-test.yml @@ -17,7 +17,9 @@ jobs: with: build-target: cpu # Ref: https://docs.rapids.ai/resources/github-actions/#cpu-labels for `linux-amd64-cpu4` - runs-on: ${{ github.repository == 'nv-legate/legate.core' && 'linux-amd64-cpu4' || 'ubuntu-latest' }} + # TODO: undo + runs-on: ${{ 'linux-amd64-cpu4' || 'ubuntu-latest' }} + # runs-on: ${{ github.repository == 'nv-legate/legate.core' && 'linux-amd64-cpu4' || 'ubuntu-latest' }} sha: ${{ github.sha }} # test-cpu: From 80c781920ad3d03783345521513b58a35c06e3a8 Mon Sep 17 00:00:00 2001 From: Sandeep Datta Date: Fri, 21 Jul 2023 04:27:06 -0700 Subject: [PATCH 09/20] USER coder. Fixed spelling mistak. --- continuous_integration/Dockerfile | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/continuous_integration/Dockerfile b/continuous_integration/Dockerfile index 40bd70d0fc..7631a91432 100644 --- a/continuous_integration/Dockerfile +++ b/continuous_integration/Dockerfile @@ -2,17 +2,23 @@ ARG BASE_IMAGE FROM ${BASE_IMAGE} as stage0 COPY --chown=coder:coder continuous_integration/home/coder/.local/bin/* /home/coder/.local/bin/ -COPY --chown=coder:coder . /home/coder/cnumeric +COPY --chown=coder:coder . /home/coder/cunumeric RUN chmod a+x /home/coder/.local/bin/* #--------------------------------------------------- FROM stage0 as setup +USER coder +WORKDIR /home/coder + RUN get-yaml-and-make-conda-env #--------------------------------------------------- FROM setup as build +USER coder +WORKDIR /home/coder + ARG GITHUB_TOKEN ENV GITHUB_TOKEN=${GITHUB_TOKEN} ARG AWS_SESSION_TOKEN @@ -29,6 +35,9 @@ RUN entrypoint build-cunumeric-all #--------------------------------------------------- FROM stage0 as final -COPY --from=build /tmp/out /tmp/out -COPY --from=build /tmp/conda-build /tmp/conda-build -COPY --from=build /tmp/env_yaml /tmp/env_yaml +USER coder +WORKDIR /home/coder + +COPY --from=build --chown=coder:coder /tmp/out /tmp/out +COPY --from=build --chown=coder:coder /tmp/conda-build /tmp/conda-build +COPY --from=build --chown=coder:coder /tmp/env_yaml /tmp/env_yaml From 47f666a3173ee8582c6f3578d9021d9ecc0ad9be Mon Sep 17 00:00:00 2001 From: Sandeep Datta Date: Wed, 26 Jul 2023 04:55:30 -0700 Subject: [PATCH 10/20] Removed wildcard: .cred[s] -> .creds. This will let us use older versions of docker which do not support this idiom. --- continuous_integration/Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/continuous_integration/Dockerfile b/continuous_integration/Dockerfile index 7631a91432..d60afee19f 100644 --- a/continuous_integration/Dockerfile +++ b/continuous_integration/Dockerfile @@ -28,8 +28,7 @@ ENV AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} ARG AWS_SECRET_ACCESS_KEY ENV AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} -# If .creds exists copy it to /run/secrets -COPY --chown=coder:coder .cred[s] /run/secrets +COPY --chown=coder:coder .creds /run/secrets RUN entrypoint build-cunumeric-all From d9eb1fd314800828cf392b13224108e9c7f4b892 Mon Sep 17 00:00:00 2001 From: Sandeep Datta Date: Wed, 26 Jul 2023 05:25:44 -0700 Subject: [PATCH 11/20] Install legate with WAR. --- continuous_integration/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/continuous_integration/Dockerfile b/continuous_integration/Dockerfile index d60afee19f..4e6478d143 100644 --- a/continuous_integration/Dockerfile +++ b/continuous_integration/Dockerfile @@ -12,7 +12,9 @@ FROM stage0 as setup USER coder WORKDIR /home/coder -RUN get-yaml-and-make-conda-env +RUN set -x && . conda-utils && \ + get_yaml_and_make_conda_env && \ + install_legate_core_with_war #--------------------------------------------------- FROM setup as build From f07cae05dca3abdf97b5026adb537b0ef96f1657 Mon Sep 17 00:00:00 2001 From: Sandeep Datta Date: Wed, 26 Jul 2023 12:31:05 -0700 Subject: [PATCH 12/20] 1. Updated cunumeric version to 23.09.00. 2. build-cunumeric-conda now parameterised on USE_CUDA. 3. +.dockerignore aliased to .gitignore. --- .dockerignore | 1 + .../home/coder/.local/bin/build-cunumeric-conda | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 120000 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 120000 index 0000000000..3e4e48b0b5 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +.gitignore \ No newline at end of file diff --git a/continuous_integration/home/coder/.local/bin/build-cunumeric-conda b/continuous_integration/home/coder/.local/bin/build-cunumeric-conda index b957e13afc..0be424252d 100755 --- a/continuous_integration/home/coder/.local/bin/build-cunumeric-conda +++ b/continuous_integration/home/coder/.local/bin/build-cunumeric-conda @@ -23,7 +23,11 @@ build_cunumeric_conda_package() { conda_build_args+=("--build-id-pat=''"); conda_build_args+=(--no-include-recipe); conda_build_args+=(--no-anaconda-upload); - conda_build_args+=(--variants "{gpu_enabled:true,python:${python_version}}"); + + GPU_ENABLED=true + [ "${USE_CUDA:-}" = "OFF" ] && GPU_ENABLED=false + + conda_build_args+=(--variants "{gpu_enabled:${GPU_ENABLED},python:${python_version}}"); rm -rf /tmp/conda-build/cunumeric; mkdir -p /tmp/conda-build/cunumeric; From ea91f6b00de24ca9300e11e170393b0e96f66548 Mon Sep 17 00:00:00 2001 From: Sandeep Datta Date: Wed, 26 Jul 2023 13:45:29 -0700 Subject: [PATCH 13/20] 1. Build legate at SHA specified in cmake/versions.json 2. Removed --sha arg from build-docker-image. --- .github/workflows/gh-build.yml | 38 ++++++++++++++++++++++------------ cmake/versions.json | 2 +- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/.github/workflows/gh-build.yml b/.github/workflows/gh-build.yml index 36bc2c449c..52e6a650fa 100644 --- a/.github/workflows/gh-build.yml +++ b/.github/workflows/gh-build.yml @@ -66,43 +66,55 @@ jobs: echo BUILD_TARGET: ${{ inputs.build-target }} echo USE_CUDA: ${{ env.USE_CUDA }} + IMAGE_TAG_LEGATE=${{ env.IMAGE_NAME_LEGATE }}:${{ inputs.sha }} + + export LEGATE_SHA=$(cat cunumeric/cmake/versions.json | jq -r '.packages.legate_core.git_tag') + echo "Checking out LEGATE_SHA: ${LEGATE_SHA}" + git -C legate checkout $LEGATE_SHA + chmod +x legate/continuous_integration/build-docker-image legate/continuous_integration/build-docker-image \ --base-image "$BASE_IMAGE" \ - --image-name "$IMAGE_NAME_LEGATE" \ - --sha ${{ inputs.sha }} \ + --image-tag "$IMAGE_TAG_LEGATE" \ --source-dir legate - name: Build cunumeric using docker build run: | + IMAGE_TAG_CUNUMERIC=${{ env.IMAGE_NAME_CUNUMERIC }}:${{ inputs.sha }} + IMAGE_TAG_LEGATE=${{ env.IMAGE_NAME_LEGATE }}:${{ inputs.sha }} + legate/continuous_integration/build-docker-image \ - --base-image "$IMAGE_NAME_LEGATE:${{ inputs.sha }}" \ - --image-name "$IMAGE_NAME_CUNUMERIC" \ - --sha ${{ inputs.sha }} \ + --base-image "$IMAGE_TAG_LEGATE" \ + --image-tag "$IMAGE_TAG_CUNUMERIC" \ --source-dir cunumeric + - name: Dump docker history of image before upload + run: | + IMAGE_TAG=${{ env.IMAGE_NAME_CUNUMERIC }}:${{ inputs.sha }} + docker history $IMAGE_TAG + - name: Log in to container image registry run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin - name: Push cunumeric image run: | - IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME_CUNUMERIC + IMAGE_TAG=${{ env.IMAGE_NAME_CUNUMERIC }}:${{ inputs.sha }} + + IMAGE_ID=ghcr.io/${{ github.repository_owner }} # Change all uppercase to lowercase IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - VERSION=${{ inputs.sha }} + IMAGE_ID=$IMAGE_ID/$IMAGE_TAG - docker tag $IMAGE_NAME_CUNUMERIC:$VERSION $IMAGE_ID:$VERSION - docker push $IMAGE_ID:$VERSION + docker tag $IMAGE_TAG $IMAGE_ID + docker push $IMAGE_ID - name: Copy artifacts back to the host run: | + IMAGE_TAG=${{ env.IMAGE_NAME_CUNUMERIC }}:${{ inputs.sha }} mkdir -p artifacts - docker run -v "$(pwd)/artifacts:/home/coder/.artifacts" --rm -t $IMAGE_NAME_CUNUMERIC:${{ inputs.sha }} copy-artifacts - echo --------- DOCKER HISTORY START ----------- - docker history $IMAGE_NAME_CUNUMERIC:${{ inputs.sha }} - echo --------- DOCKER HISTORY END ----------- + docker run -v "$(pwd)/artifacts:/home/coder/.artifacts" --rm -t $IMAGE_TAG copy-artifacts - name: Display structure of workdir run: ls -R diff --git a/cmake/versions.json b/cmake/versions.json index 98dbd8c3a1..d7e1d81336 100644 --- a/cmake/versions.json +++ b/cmake/versions.json @@ -5,7 +5,7 @@ "git_url" : "https://github.com/nv-legate/legate.core.git", "git_shallow": false, "always_download": false, - "git_tag" : "a405f595603238c8557cb5fefd3981d190a2fb1d" + "git_tag" : "4b79075eb5d7035d501c334c87a87939af79abc2" } } } From aca77bb0c43a1da34e09dc9a07eaa16883055a14 Mon Sep 17 00:00:00 2001 From: Sandeep Datta Date: Wed, 9 Aug 2023 07:26:56 -0700 Subject: [PATCH 14/20] Switch to nv-legate/legate.core from sandeepd-nv/legate.core. --- .github/workflows/ci-gh-cpu-build-and-test.yml | 6 ++---- .github/workflows/gh-build.yml | 4 +--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-gh-cpu-build-and-test.yml b/.github/workflows/ci-gh-cpu-build-and-test.yml index 087eaba9da..28c10b4827 100644 --- a/.github/workflows/ci-gh-cpu-build-and-test.yml +++ b/.github/workflows/ci-gh-cpu-build-and-test.yml @@ -1,4 +1,4 @@ -name: Build and test CPU legate.core on GH +name: Build and test cunumeric (with CPU legate) on GH concurrency: group: ci-cpu-on-${{ github.event_name }}-from-${{ github.ref_name }} @@ -17,9 +17,7 @@ jobs: with: build-target: cpu # Ref: https://docs.rapids.ai/resources/github-actions/#cpu-labels for `linux-amd64-cpu4` - # TODO: undo - runs-on: ${{ 'linux-amd64-cpu4' || 'ubuntu-latest' }} - # runs-on: ${{ github.repository == 'nv-legate/legate.core' && 'linux-amd64-cpu4' || 'ubuntu-latest' }} + runs-on: ${{ github.repository_owner == 'nv-legate' && 'linux-amd64-cpu4' || 'ubuntu-latest' }} sha: ${{ github.sha }} # test-cpu: diff --git a/.github/workflows/gh-build.yml b/.github/workflows/gh-build.yml index 52e6a650fa..84ebea5b32 100644 --- a/.github/workflows/gh-build.yml +++ b/.github/workflows/gh-build.yml @@ -35,9 +35,7 @@ jobs: - name: Checkout legate.core uses: actions/checkout@v3 with: - # TODO: undo - # repository: nv-legate/legate.core - repository: sandeepd-nv/legate.core + repository: nv-legate/legate.core ref: 'make_ghci_parts_reusable_from_cunumeric' fetch-depth: 0 path: legate From 2c17b38bc2ebbb7befbeaf5e4f2ce5bb3bb13150 Mon Sep 17 00:00:00 2001 From: Sandeep Datta Date: Wed, 9 Aug 2023 07:43:04 -0700 Subject: [PATCH 15/20] Removed reference to non-existent branch. --- .github/workflows/gh-build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/gh-build.yml b/.github/workflows/gh-build.yml index 84ebea5b32..edd1e41f8d 100644 --- a/.github/workflows/gh-build.yml +++ b/.github/workflows/gh-build.yml @@ -36,7 +36,6 @@ jobs: uses: actions/checkout@v3 with: repository: nv-legate/legate.core - ref: 'make_ghci_parts_reusable_from_cunumeric' fetch-depth: 0 path: legate From 7f7f3dcbb9932539a8cb7864779290426e9aad09 Mon Sep 17 00:00:00 2001 From: Sandeep Datta Date: Wed, 9 Aug 2023 11:06:15 -0700 Subject: [PATCH 16/20] +.github/workflows/ci-gh-gpu-build-and-test.yml --- .../workflows/ci-gh-cpu-build-and-test.yml | 20 +---------- .../workflows/ci-gh-gpu-build-and-test.yml | 33 +++++++++++++++++++ .github/workflows/gh-build.yml | 4 +-- 3 files changed, 36 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/ci-gh-gpu-build-and-test.yml diff --git a/.github/workflows/ci-gh-cpu-build-and-test.yml b/.github/workflows/ci-gh-cpu-build-and-test.yml index 28c10b4827..301ffecb38 100644 --- a/.github/workflows/ci-gh-cpu-build-and-test.yml +++ b/.github/workflows/ci-gh-cpu-build-and-test.yml @@ -20,28 +20,10 @@ jobs: runs-on: ${{ github.repository_owner == 'nv-legate' && 'linux-amd64-cpu4' || 'ubuntu-latest' }} sha: ${{ github.sha }} - # test-cpu: - # needs: - # - build-cpu - # strategy: - # fail-fast: false - # matrix: - # include: - # - { name: Pytest Unit Tests, test-scope: unit } - # - { name: mypy, test-scope: mypy } - # name: ${{ matrix.name }} - # uses: - # ./.github/workflows/gh-test.yml - # with: - # build-target: cpu - # runs-on: ${{ github.repository == 'nv-legate/legate.core' && 'linux-amd64-cpu4' || 'ubuntu-latest' }} - # sha: ${{ github.sha }} - # test-scope: ${{ matrix.test-scope }} - cleanup: needs: - build-cpu - # - test-cpu + # This ensures the cleanup job runs even if previous jobs fail or the workflow is cancelled. if: always() uses: diff --git a/.github/workflows/ci-gh-gpu-build-and-test.yml b/.github/workflows/ci-gh-gpu-build-and-test.yml new file mode 100644 index 0000000000..6d25ae6280 --- /dev/null +++ b/.github/workflows/ci-gh-gpu-build-and-test.yml @@ -0,0 +1,33 @@ +name: Build and test cunumeric (with GPU legate) on GH + +concurrency: + group: ci-gpu-on-${{ github.event_name }}-from-${{ github.ref_name }} + cancel-in-progress: true + +on: + push: + branches: + - "pull-request/[0-9]+" + - "branch-*" + +jobs: + build-gpu: + uses: + ./.github/workflows/gh-build.yml + with: + build-target: gpu + # Ref: https://docs.rapids.ai/resources/github-actions/#cpu-labels for `linux-amd64-cpu4` + runs-on: ${{ github.repository_owner == 'nv-legate' && 'linux-amd64-cpu4' || 'ubuntu-latest' }} + sha: ${{ github.sha }} + + cleanup: + needs: + - build-gpu + + # This ensures the cleanup job runs even if previous jobs fail or the workflow is cancelled. + if: always() + uses: + ./.github/workflows/gh-cleanup.yml + with: + build-target: gpu + sha: ${{ github.sha }} diff --git a/.github/workflows/gh-build.yml b/.github/workflows/gh-build.yml index edd1e41f8d..c84ac0b9a8 100644 --- a/.github/workflows/gh-build.yml +++ b/.github/workflows/gh-build.yml @@ -63,12 +63,12 @@ jobs: echo BUILD_TARGET: ${{ inputs.build-target }} echo USE_CUDA: ${{ env.USE_CUDA }} - IMAGE_TAG_LEGATE=${{ env.IMAGE_NAME_LEGATE }}:${{ inputs.sha }} - export LEGATE_SHA=$(cat cunumeric/cmake/versions.json | jq -r '.packages.legate_core.git_tag') echo "Checking out LEGATE_SHA: ${LEGATE_SHA}" git -C legate checkout $LEGATE_SHA + IMAGE_TAG_LEGATE=${{ env.IMAGE_NAME_LEGATE }}:${{ inputs.sha }} + chmod +x legate/continuous_integration/build-docker-image legate/continuous_integration/build-docker-image \ --base-image "$BASE_IMAGE" \ From 0923eb6b540e3feaccb4d5df0dbee491ece9795f Mon Sep 17 00:00:00 2001 From: Sandeep Datta Date: Wed, 9 Aug 2023 11:23:26 -0700 Subject: [PATCH 17/20] Simplified the workflow structure. --- .../workflows/ci-gh-gpu-build-and-test.yml | 33 ------ .github/workflows/ci-gh.yml | 112 +++--------------- ...ild-and-test.yml => gh-build-and-test.yml} | 30 ++--- 3 files changed, 29 insertions(+), 146 deletions(-) delete mode 100644 .github/workflows/ci-gh-gpu-build-and-test.yml rename .github/workflows/{ci-gh-cpu-build-and-test.yml => gh-build-and-test.yml} (53%) diff --git a/.github/workflows/ci-gh-gpu-build-and-test.yml b/.github/workflows/ci-gh-gpu-build-and-test.yml deleted file mode 100644 index 6d25ae6280..0000000000 --- a/.github/workflows/ci-gh-gpu-build-and-test.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Build and test cunumeric (with GPU legate) on GH - -concurrency: - group: ci-gpu-on-${{ github.event_name }}-from-${{ github.ref_name }} - cancel-in-progress: true - -on: - push: - branches: - - "pull-request/[0-9]+" - - "branch-*" - -jobs: - build-gpu: - uses: - ./.github/workflows/gh-build.yml - with: - build-target: gpu - # Ref: https://docs.rapids.ai/resources/github-actions/#cpu-labels for `linux-amd64-cpu4` - runs-on: ${{ github.repository_owner == 'nv-legate' && 'linux-amd64-cpu4' || 'ubuntu-latest' }} - sha: ${{ github.sha }} - - cleanup: - needs: - - build-gpu - - # This ensures the cleanup job runs even if previous jobs fail or the workflow is cancelled. - if: always() - uses: - ./.github/workflows/gh-cleanup.yml - with: - build-target: gpu - sha: ${{ github.sha }} diff --git a/.github/workflows/ci-gh.yml b/.github/workflows/ci-gh.yml index a81802f9d2..f1aafdd595 100644 --- a/.github/workflows/ci-gh.yml +++ b/.github/workflows/ci-gh.yml @@ -1,7 +1,7 @@ -name: Build cunumeric on GH +name: Build and test cunumeric on GH concurrency: - group: ci-gpu-on-${{ github.event_name }}-from-${{ github.ref_name }} + group: ci-build-and-test-on-${{ github.event_name }}-from-${{ github.ref_name }} cancel-in-progress: true on: @@ -11,99 +11,15 @@ on: - "branch-*" jobs: - build: - permissions: - id-token: write # This is required for configure-aws-credentials - contents: read # This is required for actions/checkout - - # Ref: https://docs.rapids.ai/resources/github-actions/#cpu-labels for `linux-amd64-cpu4` - runs-on: ${{ github.repository == 'nv-legate/cunumeric' && 'linux-amd64-cpu4' || 'ubuntu-latest' }} - container: - options: -u root - image: rapidsai/devcontainers:23.06-cpp-cuda11.8-mambaforge-ubuntu22.04 - volumes: - - ${{ github.workspace }}/out:/tmp/out - env: - DEFAULT_CONDA_ENV: legate - PYTHONDONTWRITEBYTECODE: 1 - SCCACHE_REGION: us-east-2 - SCCACHE_BUCKET: rapids-sccache-east - SCCACHE_S3_KEY_PREFIX: legate-cunumeric-dev - GH_TOKEN: "${{ secrets.PERSONAL_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}" - GITHUB_TOKEN: "${{ secrets.PERSONAL_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}" - VAULT_HOST: "${{ secrets.PERSONAL_ACCESS_TOKEN && 'https://vault.ops.k8s.rapids.ai' || '' }}" - VAULT_S3_TTL: "28800s" # 8 hours - - steps: - - name: Checkout legate.core - uses: actions/checkout@v3 - with: - repository: nv-legate/legate.core - fetch-depth: 0 - path: legate - - - name: Checkout cunumeric (= this repo) - uses: actions/checkout@v3 - with: - fetch-depth: 0 - path: cunumeric - - - name: Setup - shell: bash -eo pipefail {0} - run: | - export LEGATE_SHA=$(cat cunumeric/cmake/versions.json | jq -r '.packages.legate_core.git_tag') - echo "Checking out LEGATE_SHA: ${LEGATE_SHA}" - git -C legate checkout $LEGATE_SHA - - cp -ar legate/continuous_integration/home/coder/.gitconfig /home/coder/; - cp -ar legate/continuous_integration/home/coder/.local /home/coder/; - mv legate /home/coder/legate - - cp -ar cunumeric/continuous_integration/home/coder/.local/bin/* /home/coder/.local/bin/; - mv cunumeric /home/coder/cunumeric; - - chmod a+x /home/coder/.local/bin/*; - chown -R coder:coder /home/coder/; - chown -R coder:coder /tmp/out; - - - if: github.repository == 'nv-legate/cunumeric' - name: Get AWS credentials for sccache bucket - uses: aws-actions/configure-aws-credentials@v2 - with: - aws-region: us-east-2 - role-duration-seconds: 28800 # 8 hours - role-to-assume: arn:aws:iam::279114543810:role/gha-oidc-nv-legate - - - name: Create conda env - shell: su coder {0} - run: cd ~/; exec entrypoint get-yaml-and-make-conda-env; - - - name: Build legate.core C++ library - shell: su coder {0} - run: cd ~/; exec entrypoint build-legate-cpp; - - - name: Build legate.core Python Wheel - shell: su coder {0} - run: cd ~/; exec entrypoint build-legate-wheel; - - - name: Build legate.core Conda Package - shell: su coder {0} - run: cd ~/; exec entrypoint build-legate-conda; - - - name: Build cunumeric C++ library - shell: su coder {0} - run: cd ~/; exec entrypoint build-cunumeric-cpp; - - - name: Build cunumeric Python Wheel - shell: su coder {0} - run: cd ~/; exec entrypoint build-cunumeric-wheel; - - - name: Build cunumeric Conda Package - shell: su coder {0} - run: cd ~/; exec entrypoint build-cunumeric-conda; - - - name: Upload build output - uses: actions/upload-artifact@v3 - with: - name: "cunumeric-${{ github.sha }}" - path: ./out/* + build-and-test: + strategy: + fail-fast: false + matrix: + include: + - {build-target: cpu} + - {build-target: gpu} + uses: + ./.github/workflows/gh-build-and-test.yml + with: + build-target: ${{ matrix.build-target }} + sha: ${{ github.sha }} diff --git a/.github/workflows/ci-gh-cpu-build-and-test.yml b/.github/workflows/gh-build-and-test.yml similarity index 53% rename from .github/workflows/ci-gh-cpu-build-and-test.yml rename to .github/workflows/gh-build-and-test.yml index 301ffecb38..3a4f5d8760 100644 --- a/.github/workflows/ci-gh-cpu-build-and-test.yml +++ b/.github/workflows/gh-build-and-test.yml @@ -1,33 +1,33 @@ -name: Build and test cunumeric (with CPU legate) on GH - -concurrency: - group: ci-cpu-on-${{ github.event_name }}-from-${{ github.ref_name }} - cancel-in-progress: true +name: Build and test cunumeric (with ${{ inputs.build-target }} legate) on GH on: - push: - branches: - - "pull-request/[0-9]+" - - "branch-*" + workflow_call: + inputs: + build-target: + required: true + type: string + sha: + required: true + type: string jobs: - build-cpu: + build: uses: ./.github/workflows/gh-build.yml with: - build-target: cpu + build-target: ${{ inputs.build-target }} # Ref: https://docs.rapids.ai/resources/github-actions/#cpu-labels for `linux-amd64-cpu4` runs-on: ${{ github.repository_owner == 'nv-legate' && 'linux-amd64-cpu4' || 'ubuntu-latest' }} - sha: ${{ github.sha }} + sha: ${{ inputs.sha }} cleanup: needs: - - build-cpu + - build # This ensures the cleanup job runs even if previous jobs fail or the workflow is cancelled. if: always() uses: ./.github/workflows/gh-cleanup.yml with: - build-target: cpu - sha: ${{ github.sha }} + build-target: ${{ inputs.build-target }} + sha: ${{ inputs.sha }} From ae5c4a9b89f6dce0c1156e86fcf28509331880e8 Mon Sep 17 00:00:00 2001 From: Sandeep Datta Date: Wed, 9 Aug 2023 11:25:28 -0700 Subject: [PATCH 18/20] Attempt 2. Simplified the workflow structure. --- .github/workflows/gh-build-and-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gh-build-and-test.yml b/.github/workflows/gh-build-and-test.yml index 3a4f5d8760..bc31c184f5 100644 --- a/.github/workflows/gh-build-and-test.yml +++ b/.github/workflows/gh-build-and-test.yml @@ -1,5 +1,3 @@ -name: Build and test cunumeric (with ${{ inputs.build-target }} legate) on GH - on: workflow_call: inputs: @@ -10,6 +8,8 @@ on: required: true type: string +name: Build and test cunumeric (with ${{ inputs.build-target }} legate) on GH + jobs: build: uses: From a7a92e5649bebd2533d598c80c047fb6969fb6c4 Mon Sep 17 00:00:00 2001 From: Sandeep Datta Date: Wed, 9 Aug 2023 11:28:15 -0700 Subject: [PATCH 19/20] Attempt 3. Simplified the workflow structure. --- .github/workflows/gh-build-and-test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/gh-build-and-test.yml b/.github/workflows/gh-build-and-test.yml index bc31c184f5..6374636367 100644 --- a/.github/workflows/gh-build-and-test.yml +++ b/.github/workflows/gh-build-and-test.yml @@ -8,10 +8,9 @@ on: required: true type: string -name: Build and test cunumeric (with ${{ inputs.build-target }} legate) on GH - jobs: build: + name: "[Sub workflow] Build cunumeric (with ${{ inputs.build-target }} legate) on GH" uses: ./.github/workflows/gh-build.yml with: From bf0aae9d3b631b339f0cfa8feb77cc204b62570d Mon Sep 17 00:00:00 2001 From: Sandeep Datta Date: Wed, 9 Aug 2023 11:30:28 -0700 Subject: [PATCH 20/20] Minor change. --- .github/workflows/gh-build-and-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gh-build-and-test.yml b/.github/workflows/gh-build-and-test.yml index 6374636367..f297b97618 100644 --- a/.github/workflows/gh-build-and-test.yml +++ b/.github/workflows/gh-build-and-test.yml @@ -10,7 +10,7 @@ on: jobs: build: - name: "[Sub workflow] Build cunumeric (with ${{ inputs.build-target }} legate) on GH" + name: "Build cunumeric (with ${{ inputs.build-target }} legate) on GH" uses: ./.github/workflows/gh-build.yml with: