Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
63242bd
Adding Dockerfile and going back to the previous version of entrypoint.
sandeepd-nv Jun 21, 2023
9b1384a
Fixed build errors.
sandeepd-nv Jun 21, 2023
e0aca9d
+Adding the docker based workflow.
sandeepd-nv Jun 21, 2023
69fc96e
Changed workflow name.
sandeepd-nv Jun 21, 2023
131671b
Changed the concurrency group name.
sandeepd-nv Jun 21, 2023
ced5bb6
Disabled the Get AWS credentials for sccache bucket step.
sandeepd-nv Jun 21, 2023
8ccdc18
Removing the -i flag from bash.
sandeepd-nv Jun 21, 2023
105342a
Removed the -i flag from docker run.
sandeepd-nv Jun 21, 2023
b4881c2
Don't need to NVIDIA docker runtime to build legate.core.
sandeepd-nv Jun 21, 2023
051f697
Change the ownership of /tmp/out to coder:coder.
sandeepd-nv Jun 21, 2023
cff7ed2
SUDO Change the ownership of /tmp/out to coder:coder.
sandeepd-nv Jun 21, 2023
48a51de
Fixed output dir paths.
sandeepd-nv Jun 21, 2023
2bc829b
Adding id-tokens:write permission and re-enabling the configure-aws-c…
sandeepd-nv Jun 22, 2023
b3af800
Overwriting devcontainer-utils-vault-s3-test from the base image with…
sandeepd-nv Jun 22, 2023
02fbfc7
Echo AWS variables.
sandeepd-nv Jun 22, 2023
4afda88
Setting the GITHUB_TOKEN environment variable.
sandeepd-nv Jun 22, 2023
cc67205
Removing the call to devcontainer-utils-post-attach-command from entr…
sandeepd-nv Jun 22, 2023
306755b
Enable tracing.
sandeepd-nv Jun 22, 2023
db6e63a
Enable tracing. #2
sandeepd-nv Jun 22, 2023
af2b167
devcontainer-utils-vault-s3-test output is now not thrown into the void.
sandeepd-nv Jun 22, 2023
728e60c
Passing env var through docker.
sandeepd-nv Jun 22, 2023
6eef6e8
Rearranged the docker command line.
sandeepd-nv Jun 22, 2023
9367641
Fixed bug in devcontainer-utils-vault-s3-test. Simplified environment…
sandeepd-nv Jun 22, 2023
f7ea006
Inspect PATH.
sandeepd-nv Jun 22, 2023
a8972df
Fixed typo.
sandeepd-nv Jun 22, 2023
0a81bf2
Dump some variables.
sandeepd-nv Jun 22, 2023
4b2c8a3
+awscurl
sandeepd-nv Jun 22, 2023
2d52870
+awscurl #2
sandeepd-nv Jun 22, 2023
a631472
+awscurl #3
sandeepd-nv Jun 22, 2023
c36263a
The PATH env var will now not be passed through to docker.
sandeepd-nv Jun 22, 2023
b4143c6
Including ~/.local/bin in PATH.
sandeepd-nv Jun 22, 2023
bb6a4a5
Adding aws-curl to ~/.loca/bin.
sandeepd-nv Jun 22, 2023
97a2450
Pring aws-curl PUT and GET response.
sandeepd-nv Jun 22, 2023
12f40a8
Switching to the rapids-sccache-east S3 bucket (from rapids-sccache-d…
sandeepd-nv Jun 22, 2023
7ec09e7
devcontainer-utils-post-attach-command etc will only be called when b…
sandeepd-nv Jun 22, 2023
96eccf8
Pass only those env variables which start with either AWS or GITHUB.
sandeepd-nv Jun 22, 2023
39ec7d8
Using the -P flag with grep.
sandeepd-nv Jun 22, 2023
bb4f449
Push docker image to ghcr.io.
sandeepd-nv Jun 22, 2023
a0b33e3
Adding label git-commit.
sandeepd-nv Jun 22, 2023
ad4c20f
Using image saved in the build job to create a container in the test …
sandeepd-nv Jun 22, 2023
4eda600
Using image saved in the build job to create a container in the test …
sandeepd-nv Jun 22, 2023
ab88f71
Hardcoding docker image tag to 'latest'.
sandeepd-nv Jun 22, 2023
f5acc9e
Using rapidsai/devcontainers:23.06-cpp-cuda11.8-mambaforge-ubuntu22.0…
sandeepd-nv Jun 22, 2023
439e7b0
You can now build legate.core on your local machine using the supplie…
sandeepd-nv Jun 23, 2023
5d0611c
Adding support for running tests using the docker image built in the …
sandeepd-nv Jun 23, 2023
38f41b3
Adding support for running tests using the docker image built in the …
sandeepd-nv Jun 23, 2023
8f9d72d
Intermediate checkin.
sandeepd-nv Jun 27, 2023
23865d6
Going back to ghcr.io.
sandeepd-nv Jun 28, 2023
10855ed
Going back to ghcr.io. #2
sandeepd-nv Jun 28, 2023
6268a0c
Retaining /tmp/out /tmp/conda-build and /tmp/env_yaml in the containe…
sandeepd-nv Jun 28, 2023
78ff4a3
Fixed the problem where the local build folder was being copied into …
sandeepd-nv Jul 6, 2023
a2cd6eb
The docker image no longer comes with a preinstalled conda environmen…
sandeepd-nv Jul 6, 2023
083302c
Cleanup.
sandeepd-nv Jul 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
94 changes: 94 additions & 0 deletions .github/workflows/ci-gh-docker-gpu-build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: GH Docker build and test GPU legate.core

concurrency:
group: ci-docker-gpu-on-${{ github.event_name }}-from-${{ github.ref_name }}
cancel-in-progress: true

on:
push:
branches:
- "pull-request/[0-9]+"
- "branch-*"

env:
DOCKER_BUILDKIT: 1
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IMAGE_NAME: legate.core

jobs:
build-gpu:
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: ${{ github.repository == 'nv-legate/legate.core' && 'linux-amd64-cpu4' || 'ubuntu-latest' }}
steps:
- name: Checkout legate.core (= this repo)
uses: actions/checkout@v3
with:
fetch-depth: 0

- 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 docker image
run: |
mkdir -p out conda-build
docker build \
--build-arg AWS_SESSION_TOKEN=${{env.AWS_SESSION_TOKEN}} \
--build-arg AWS_ACCESS_KEY_ID=${{env.AWS_ACCESS_KEY_ID}} \
--build-arg AWS_SECRET_ACCESS_KEY=${{env.AWS_SECRET_ACCESS_KEY}} \
--build-arg GITHUB_TOKEN=${{env.GITHUB_TOKEN}} \
--progress=plain \
--tag=$IMAGE_NAME \
--label "git-commit=${{github.sha}}" \
-f continuous_integration/Dockerfile .

- name: Log in to container image registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME

# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')

VERSION=${{github.sha}}

docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION

- name: Display structure of workdir after docker build
run: ls -R

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: "legate.core-gpu-${{ github.sha }}"
path: |
conda-build
out

test-gpu:
needs:
- build-gpu
runs-on: linux-amd64-gpu-v100-latest-1
container:
options: -u root
image: ghcr.io/nv-legate/legate.core:${{github.sha}}
# image: rapidsai/devcontainers:23.06-cpp-cuda11.8-mambaforge-ubuntu22.04
env:
NVIDIA_VISIBLE_DEVICES: ${{ env.NVIDIA_VISIBLE_DEVICES }}
steps:
- name: Run nvidia-smi to make sure GPU is working
run: nvidia-smi

- name: Run legate.core unit tests
shell: su coder {0}
run: entrypoint run-all-tests
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ _cmake_test_compile
legate.core.code-workspace
*.prof
.legate-test-last-failed
out/
61 changes: 61 additions & 0 deletions continuous_integration/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
ARG BASE_IMAGE=rapidsai/devcontainers:23.06-cpp-cuda11.8-mambaforge-ubuntu22.04
FROM ${BASE_IMAGE} as stage0

RUN export DEBIAN_FRONTEND=noninteractive \
&& apt update \
&& apt install -y --no-install-recommends \
rustc cargo

ENV PYTHONDONTWRITEBYTECODE=1
ENV SCCACHE_REGION="us-east-2"
ENV SCCACHE_BUCKET="rapids-sccache-east"
ENV SCCACHE_S3_KEY_PREFIX=legate-cunumeric-dev
ENV VAULT_HOST=https://vault.ops.k8s.rapids.ai
ENV HISTFILE=/home/coder/.cache/._bash_history

ARG USE_CUDA=ON
ENV USE_CUDA=${USE_CUDA}

ENV BUILD_MARCH=nocona

ENV PATH="${PATH}:/home/coder/.local/bin"

USER coder

WORKDIR /home/coder/.cache
WORKDIR /home/coder

COPY --chown=coder:coder continuous_integration/home/coder/.gitconfig /home/coder/
COPY --chown=coder:coder continuous_integration/home/coder/.local/bin/* /home/coder/.local/bin/
COPY --chown=coder:coder . /home/coder/legate

RUN chmod a+x /home/coder/.local/bin/* && \
mkdir -p /tmp/out && \
chown -R coder:coder /tmp/out

FROM stage0 as setup

RUN make-conda-env

#---------------------------------------------------
FROM setup as build

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}
ARG GITHUB_TOKEN
ENV GITHUB_TOKEN=${GITHUB_TOKEN}

# If .creds exists copy it to /run/secrets
COPY --chown=coder:coder .cred[s] /run/secrets

RUN entrypoint build-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
10 changes: 10 additions & 0 deletions continuous_integration/home/coder/.local/bin/activate-conda-env
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

activate_conda_env() {
conda activate legate;
}

. /opt/conda/etc/profile.d/conda.sh;
. /opt/conda/etc/profile.d/mamba.sh;

activate_conda_env "$@";
10 changes: 5 additions & 5 deletions continuous_integration/home/coder/.local/bin/build-all
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env bash

build_all() {
set -xeuo pipefail;

cd ~/;

if type conda >/dev/null 2>&1; then
. make-conda-env;
fi
. activate-conda-env;

conda info

set -xeuo pipefail;

build-legate-cpp;
build-legate-wheel;
build-legate-conda;
Expand Down
29 changes: 26 additions & 3 deletions continuous_integration/home/coder/.local/bin/entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,35 @@

entrypoint() {

. devcontainer-utils-post-attach-command;
set -x

sccache --stop-server >/dev/null 2>&1 || true;
sccache --show-stats;
echo AWS_REGION=${AWS_REGION:-}
echo AWS_SESSION_TOKEN=${AWS_SESSION_TOKEN:-}
echo AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-}
echo AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-}

mkdir -p /home/coder/.cache;

if [ -d /run/secrets ]; then
# disable xtrace and history
local xtrace_enabled=$(echo "${SHELLOPTS:-}" | grep -q 'xtrace'; echo $?);
local history_enabled=$(echo "${SHELLOPTS:-}" | grep -q 'history'; echo $?);
{ set +xo history; } 2>/dev/null;
eval "export $(find /run/secrets/ -type f -exec bash -c 'echo ${0/\/run\/secrets\//}=$(<${0})' {} \;)";
if [ "${history_enabled}" -eq "0" ]; then { set -o history; } 2>/dev/null; fi;
if [ "${xtrace_enabled}" -eq "0" ]; then { set -o xtrace; } 2>/dev/null; fi;

. devcontainer-utils-post-attach-command;

sleep 10;
. devcontainer-utils-vault-s3-test;
. devcontainer-utils-vault-s3-export 0;
else
sccache --stop-server || true && sccache --show-stats;
fi

exec "$@";
}

entrypoint "$@";

37 changes: 31 additions & 6 deletions continuous_integration/home/coder/.local/bin/make-conda-env
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#!/usr/bin/env bash

yaml_file="";

make_conda_env() {
set -xeuo pipefail;
mamba env create -v -n "${DEFAULT_CONDA_ENV:-legate}" -f "${yaml_file}";
}

generate_yaml_file() {
local cuda_version="${CUDA_VERSION:-${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}}";
cuda_version="$(echo "${cuda_version}" | cut -d'.' -f3 --complement)";

Expand All @@ -12,7 +16,7 @@ make_conda_env() {
python_version="$(python3 --version 2>&1 | cut -d' ' -f2 | cut -d'.' -f3 --complement)";
fi

local yaml_file=~/"$( \
yaml_file=~/"$( \
~/legate/scripts/generate-conda-envs.py \
--os linux \
--compilers \
Expand All @@ -25,13 +29,34 @@ make_conda_env() {

sed -i -re "s/legate-test/${DEFAULT_CONDA_ENV:-legate}/g" "${yaml_file}";
echo " - boa" >> "${yaml_file}";
cat "${yaml_file}";

cp "${yaml_file}" /tmp/out/
mkdir -p /tmp/env_yaml
cp "${yaml_file}" /tmp/env_yaml
}

find_yaml_file() {
pattern="/tmp/env_yaml/*.yaml"
files=( $pattern )
yaml_file="${files[0]}"

if [ -z "${yaml_file:-}" ] || [ ! -f "$yaml_file" ]; then
return 1
fi

return 0
}

mamba env create -n "${DEFAULT_CONDA_ENV:-legate}" -f "${yaml_file}";
main() {
set -e;
if ! find_yaml_file; then
generate_yaml_file;
fi

echo YAML file: ${yaml_file}
cat "${yaml_file}";

{ set +x; } 2>/dev/null;
make_conda_env;
}

(make_conda_env "$@");
main "$@";
20 changes: 20 additions & 0 deletions continuous_integration/home/coder/.local/bin/run-all-tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

run_all_tests() {
set -x;
cd ~/;
mamba create -n "${DEFAULT_CONDA_ENV:-legate}"
mamba install -y -n "${DEFAULT_CONDA_ENV:-legate}" -c nvidia -c conda-forge -c /tmp/conda-build/legate_core legate-core
mamba install -y --name "${DEFAULT_CONDA_ENV:-legate}" -c conda-forge pytest pytest-mock ipython jupyter_client

. activate-conda-env;

conda info

set -xeuo pipefail;

cd ~/legate/tests/unit
pytest
}

(run_all_tests "$@");