Skip to content

Commit

Permalink
GH build releasables (#805)
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepd-nv authored Oct 21, 2023
1 parent 3805ab4 commit 356284d
Show file tree
Hide file tree
Showing 15 changed files with 232 additions and 69 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/ci-gh-build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build conda release packages

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

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

jobs:
build:
uses:
./.github/workflows/gh-build.yml
with:
build-target: all
repos-name: ${{ github.event.repository.name }}
runs-on: ${{ github.repository_owner == 'nv-legate' && 'linux-amd64-32cpu' || 'ubuntu-latest' }}
sha: ${{ github.sha }}
build-type: release
4 changes: 2 additions & 2 deletions .github/workflows/ci-gh-cpu-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
./.github/workflows/gh-build.yml
with:
build-target: cpu
# Ref: https://docs.rapids.ai/resources/github-actions/#cpu-labels for `linux-amd64-cpu4`
repos-name: ${{ github.event.repository.name }}
runs-on: ${{ contains(github.repository, 'nv-legate/legate.core') && 'linux-amd64-cpu4' || 'ubuntu-latest' }}
sha: ${{ github.sha }}
build-type: ci

test-cpu:
needs:
Expand All @@ -38,7 +38,7 @@ jobs:
with:
build-target: cpu
repos-name: ${{ github.event.repository.name }}
runs-on: ${{ contains(github.repository, 'nv-legate/legate.core') && 'linux-amd64-cpu4' || 'ubuntu-latest' }}
runs-on: ${{ contains(github.repository, 'nv-legate/legate.core') && 'linux-amd64-32cpu' || 'ubuntu-latest' }}
sha: ${{ github.sha }}
test-scope: ${{ matrix.test-scope }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-gh-gpu-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
./.github/workflows/gh-build.yml
with:
build-target: gpu
# Ref: https://docs.rapids.ai/resources/github-actions/#cpu-labels for `linux-amd64-cpu4`
repos-name: ${{ github.event.repository.name }}
runs-on: ${{ contains(github.repository, 'nv-legate/legate.core') && 'linux-amd64-cpu4' || 'ubuntu-latest' }}
runs-on: ${{ contains(github.repository, 'nv-legate/legate.core') && 'linux-amd64-32cpu' || 'ubuntu-latest' }}
sha: ${{ github.sha }}
build-type: ci

test-gpu:
needs:
Expand Down
27 changes: 15 additions & 12 deletions .github/workflows/gh-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
build-target:
required: true
type: string
description: One of CPU / GPU
repos-name:
required: true
type: string
Expand All @@ -15,12 +16,18 @@ on:
sha:
required: true
type: string
description: A unique identifier for labeling the images / artifacts
build-type:
required: true
type: string
description: One of ci / release

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE_IMAGE: rapidsai/devcontainers:23.06-cpp-mambaforge-ubuntu22.04
IMAGE_NAME: ${{ inputs.repos-name }}-${{ inputs.build-target }}
USE_CUDA: ${{ (inputs.build-target == 'cpu' && 'OFF') || 'ON' }}
PUSH_IMAGE: ${{ inputs.build-type == 'ci' && 'true' || 'false'}}

jobs:
build:
Expand Down Expand Up @@ -54,29 +61,26 @@ jobs:
- name: Build docker image
run: |
echo BUILD_TARGET: ${{ inputs.build-target }}
echo USE_CUDA: ${{ env.USE_CUDA }}
IMAGE_TAG=${{ env.IMAGE_NAME }}:${{ inputs.sha }}
continuous_integration/build-docker-image \
--base-image "$BASE_IMAGE" \
--image-tag "$IMAGE_TAG" \
--source-dir .
--use-cuda "$USE_CUDA" \
--source-dir . \
--build-type "${{ inputs.build-type }}"
- name: Dump docker history of image before upload
run: |
IMAGE_TAG=${{ env.IMAGE_NAME }}:${{ inputs.sha }}
docker history $IMAGE_TAG
- name: Dump docker history of image before upload
run: |
IMAGE_TAG=${{ env.IMAGE_NAME_CUNUMERIC }}:${{ inputs.sha }}
- name: Log in to container image registry
- if: env.PUSH_IMAGE == 'true'
name: Log in to container image registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Push image
- if: env.PUSH_IMAGE == 'true'
name: Push image
run: |
IMAGE_TAG=${{ env.IMAGE_NAME }}:${{ inputs.sha }}
Expand All @@ -94,8 +98,7 @@ jobs:
run: |
IMAGE_TAG=${{ env.IMAGE_NAME }}:${{ inputs.sha }}
mkdir -p artifacts
docker run -v "$(pwd)/artifacts:/home/coder/.artifacts" --rm -t $IMAGE_TAG copy-artifacts
docker run -v "$(pwd)/artifacts:/home/coder/.artifacts" --rm -t $IMAGE_TAG copy-artifacts ${{ inputs.build-type }}
- name: Display structure of workdir
run: ls -R
Expand Down
14 changes: 14 additions & 0 deletions conda/conda-build/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash

echo -e "\n\n--------------------- CONDA/CONDA-BUILD/BUILD.SH -----------------------\n"

set -xeo pipefail

# Rewrite conda's -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY to
# -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH
CMAKE_ARGS="$(echo "$CMAKE_ARGS" | sed -r "s@_INCLUDE=ONLY@_INCLUDE=BOTH@g")"
Expand All @@ -20,11 +24,21 @@ if [ -z "$CPU_ONLY" ]; then
"
fi

# We rely on an environment variable to determine if we need to make a debug build.
if [ -n "$DEBUG_BUILD" ]; then
CMAKE_ARGS+="
-DCMAKE_BUILD_TYPE=Debug
"
fi

# Do not compile with NDEBUG until Legion handles it without warnings
# Note: -UNDEBUG undefines any NDEBUG that may be present on the C compiler commandline.
# See: https://stackoverflow.com/questions/1978155/how-to-undefine-a-define-at-commandline-using-gcc
export CFLAGS="-UNDEBUG"
export CXXFLAGS="-UNDEBUG"
export CPPFLAGS="-UNDEBUG"
export CUDAFLAGS="-UNDEBUG"

export CMAKE_GENERATOR=Ninja
export CUDAHOSTCXX=${CXX}
export OPENSSL_DIR="$CONDA_PREFIX"
Expand Down
4 changes: 4 additions & 0 deletions conda/conda-build/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
debug_build:
- true
- false

gpu_enabled:
- true
- false
Expand Down
57 changes: 42 additions & 15 deletions conda/conda-build/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
{# We need to have a default value for the initial pass over the recipe #}
{% set gpu_enabled_bool = false %}
{% endif %}
{% if debug_build == "true" %}
{% set debug_build_bool = true %}
{% elif debug_build == "false" %}
{% set debug_build_bool = false %}
{% else %}
{# We need to have a default value for the initial pass over the recipe #}
{% set debug_build_bool = false %}
{% endif %}
{% set default_env_var = '' %}
{% if build_number is defined %}
{# do nothing if defined #}
Expand All @@ -27,6 +35,24 @@
{% set cuda_major=cuda_version.split('.')[0]|int %}
{% set py_version=environ.get('CONDA_PY', 36) %}

{% if use_local_path is not defined %}
{% set git_describe_hash='_' + environ.get('GIT_DESCRIBE_HASH', '0')%}
{% else %}
{% set git_describe_hash=''%}
{% endif %}

{% if not gpu_enabled_bool %}
{% set cpu_tag='_cpu' %}
{% else %}
{% set cpu_tag='' %}
{% endif %}

{% if debug_build_bool %}
{% set debug_tag='_debug' %}
{% else %}
{% set debug_tag='' %}
{% endif %}

package:
name: {{ name|lower }}
version: {{ version }}
Expand All @@ -45,21 +71,9 @@ build:
number: {{ build_number }}
missing_dso_whitelist:
- '*libcuda.so*'
{% if use_local_path is not defined %}
# use git hash
{% if not gpu_enabled_bool %}
string: "cuda{{ cuda_major }}_py{{ py_version }}_{{ GIT_DESCRIBE_HASH }}_{{ PKG_BUILDNUM }}_cpu"
{% else %}
string: "cuda{{ cuda_major }}_py{{ py_version }}_{{ GIT_DESCRIBE_HASH }}_{{ PKG_BUILDNUM }}"
{% endif %}
{% else %}
# do not use git hash
{% if not gpu_enabled_bool %}
string: "cuda{{ cuda_major }}_py{{ py_version }}_{{ PKG_BUILDNUM }}_cpu"
{% else %}
string: "cuda{{ cuda_major }}_py{{ py_version }}_{{ PKG_BUILDNUM }}"
{% endif %}
{% endif %}

string: "cuda{{ cuda_major }}_py{{ py_version }}{{ git_describe_hash }}_{{ PKG_BUILDNUM }}{{ cpu_tag }}{{ debug_tag }}"

script_env:
- SCCACHE_BUCKET
- SCCACHE_REGION
Expand All @@ -75,6 +89,9 @@ build:
- CPU_ONLY=1
track_features:
- cpu_only
{% endif %}
{% if debug_build_bool %}
- DEBUG_BUILD=1
{% endif %}
run_exports:
{% if not gpu_enabled_bool %}
Expand All @@ -91,13 +108,16 @@ build:
{% endif %}

requirements:
# Compilers and build system
build:
- make
- rust
- ninja
- cmake {{ cmake_version }}
- {{ compiler('c') }} =11.2
- {{ compiler('cxx') }} =11.2

# Libraries and header files (C/C++).
host:
- zlib
- python
Expand All @@ -112,10 +132,17 @@ requirements:
- cuda-nvtx ={{ cuda_version }}
- cuda-cccl ={{ cuda_version }}
- cuda-cudart ={{ cuda_version }}
- cuda-cudart-static ={{ cuda_version }}
- cuda-nvml-dev ={{ cuda_version }}
- cuda-driver-dev ={{ cuda_version }}
- cuda-cudart-dev ={{ cuda_version }}
- libcublas-dev
- libcufft-dev
- libcurand-dev
- libcusolver-dev
{% endif %}

# Runtime python dependencies
run:
- cffi
- llvm-openmp
Expand Down
14 changes: 11 additions & 3 deletions continuous_integration/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ FROM ${BASE_IMAGE} as stage0

SHELL ["/bin/bash", "-c"]

RUN wget https://github.com/mozilla/sccache/releases/download/v0.5.4/sccache-v0.5.4-x86_64-unknown-linux-musl.tar.gz && \
tar -xf sccache-v0.5.4-x86_64-unknown-linux-musl.tar.gz && \
sudo mv sccache-v0.5.4-x86_64-unknown-linux-musl/sccache /usr/bin/sccache

ENV PYTHONDONTWRITEBYTECODE=1
ENV SCCACHE_REGION="us-east-2"
ENV SCCACHE_BUCKET="rapids-sccache-east"
Expand All @@ -19,7 +23,9 @@ ENV USE_CUDA=${USE_CUDA}

ENV USE_OPENMP=ON

ENV BUILD_MARCH=nocona
ENV BUILD_MARCH=haswell

ARG BUILD_TYPE

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

Expand All @@ -43,7 +49,7 @@ FROM stage0 as setup
USER coder
WORKDIR /home/coder

RUN set -x && . conda-utils && get_yaml_and_make_conda_env
RUN make-conda-env ${BUILD_TYPE}

#---------------------------------------------------
FROM setup as build
Expand All @@ -52,6 +58,8 @@ WORKDIR /home/coder

ARG GITHUB_TOKEN
ENV GITHUB_TOKEN=${GITHUB_TOKEN}
ARG AWS_REGION
ENV AWS_REGION=${AWS_REGION}
ARG AWS_SESSION_TOKEN
ENV AWS_SESSION_TOKEN=${AWS_SESSION_TOKEN}
ARG AWS_ACCESS_KEY_ID
Expand All @@ -61,7 +69,7 @@ ENV AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}

COPY --chown=coder:coder .creds /run/secrets

RUN entrypoint build-legate-all
RUN entrypoint build-legate ${BUILD_TYPE}

#---------------------------------------------------
FROM stage0 as final
Expand Down
Loading

0 comments on commit 356284d

Please sign in to comment.