Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge in cibuildwheels-imgs repository #65

Merged
merged 11 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 0 additions & 11 deletions .github/workflows/build-and-publish-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,9 @@ jobs:
runs-on: ubuntu-latest
outputs:
MATRIX: ${{ steps.compute-matrix.outputs.MATRIX }}
LATEST_LINUX_VER: ${{ steps.latest-values.outputs.LATEST_LINUX_VER }}
LATEST_CUDA_VER: ${{ steps.latest-values.outputs.LATEST_CUDA_VER }}
LATEST_PYTHON_VER: ${{ steps.latest-values.outputs.LATEST_PYTHON_VER }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Compute latest values
id: latest-values
run: ci/compute-latest-versions.sh
- name: Compute matrix
id: compute-matrix
run: |
Expand All @@ -46,7 +40,6 @@ jobs:
PYTHON_VER: ${{ matrix.PYTHON_VER }}
IMAGE_REPO: ${{ matrix.IMAGE_REPO }}
IMAGE_NAME: ${{ matrix.IMAGE_NAME }}

build-multiarch-manifest:
name: manifest (${{ matrix.CUDA_VER }}, ${{ matrix.PYTHON_VER }}, ${{ matrix.LINUX_VER }}, ${{ matrix.IMAGE_REPO }})
needs: [docker, compute-matrix]
Expand All @@ -70,11 +63,7 @@ jobs:
IMAGE_REPO: ${{ matrix.IMAGE_REPO }}
BUILD_TYPE: ${{ inputs.build_type }}
IMAGE_NAME: ${{ matrix.IMAGE_NAME }}
LATEST_CUDA_VER: ${{ needs.compute-matrix.outputs.LATEST_CUDA_VER }}
LATEST_PYTHON_VER: ${{ needs.compute-matrix.outputs.LATEST_PYTHON_VER }}
LATEST_UBUNTU_VER: ${{ needs.compute-matrix.outputs.LATEST_LINUX_VER }}
run: ci/create-multiarch-manifest.sh

delete-temp-images:
needs: [compute-matrix, build-multiarch-manifest]
runs-on: ubuntu-latest
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,21 @@ jobs:
with:
driver: docker
endpoint: builders
- name: Generate Build Args
id: generate-build-args
run: ci/compute-build-args.sh
env:
CUDA_VER: ${{ inputs.CUDA_VER }}
LINUX_VER: ${{ inputs.LINUX_VER }}
PYTHON_VER: ${{ inputs.PYTHON_VER }}
ARCH: ${{ matrix.ARCH }}
- name: Build image
uses: docker/build-push-action@v4
with:
context: context
file: Dockerfile
file: ${{ inputs.IMAGE_REPO }}.Dockerfile
push: true
pull: true
build-args: |
CUDA_VER=${{ inputs.CUDA_VER }}
LINUX_VER=${{ inputs.LINUX_VER }}
PYTHON_VER=${{ inputs.PYTHON_VER }}
${{ steps.generate-build-args.outputs.ARGS }}
tags: ${{ inputs.IMAGE_NAME }}-${{ matrix.ARCH }}
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# ci-imgs

This repository contains the Dockerfile for the CI images used by RAPIDS. These images are built from the [rapidsai/mambaforge-cuda](https://github.com/rapidsai/mambaforge-cuda) images.
This repository includes the following CI images for RAPIDS:

- `ci` images are conda CI images used for building RAPIDS.
- `ci-wheel` images are for building manylinux-compliant wheels. They are also used to build pure-Python wheels, and for publishing wheels with twine.
- `citestwheel` images are for running wheel tests.

## `latest` tag

The `latest` tag is an alias for the Docker image that has the latest CUDA version, Python version, and Ubuntu version supported by this repository at any given time.
The `latest` image tags are controlled by the values in `latest.yaml`.
145 changes: 145 additions & 0 deletions ci-wheel.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
ARG CUDA_VER=11.8.0
ARG LINUX_VER=ubuntu20.04
ARG REAL_ARCH=x86_64

ARG BASE_IMAGE=nvidia/cuda:${CUDA_VER}-devel-${LINUX_VER}
FROM ${BASE_IMAGE}

ARG CUDA_VER
ARG LINUX_VER
ARG CPU_ARCH
ARG REAL_ARCH
ARG PYTHON_VER=3.9
ARG MANYLINUX_VER
ARG POLICY=${MANYLINUX_VER}

ARG DEBIAN_FRONTEND=noninteractive

# Set RAPIDS versions env variables
ENV RAPIDS_CUDA_VERSION="${CUDA_VER}"
ENV RAPIDS_PY_VERSION="${PYTHON_VER}"

# RAPIDS pip index
ENV PIP_EXTRA_INDEX_URL="https://pypi.k8s.rapids.ai/simple"

ENV PYENV_ROOT="/pyenv"
ENV PATH="/pyenv/bin:/pyenv/shims:$PATH"

RUN case "${LINUX_VER}" in \
"ubuntu"*) \
apt update -y && apt install -y jq build-essential software-properties-common wget gcc zlib1g-dev libbz2-dev libssl-dev libreadline-dev libsqlite3-dev libffi-dev curl git libncurses5-dev libnuma-dev openssh-client libcudnn8-dev zip libopenblas-dev liblapack-dev protobuf-compiler autoconf automake libtool cmake && rm -rf /var/lib/apt/lists/* \
&& add-apt-repository ppa:git-core/ppa && add-apt-repository ppa:ubuntu-toolchain-r/test && apt update -y && apt install -y git gcc-9 g++-9 && add-apt-repository -r ppa:git-core/ppa && add-apt-repository -r ppa:ubuntu-toolchain-r/test \
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9 \
;; \
"centos"*) \
yum update --exclude=libnccl* -y && yum install -y epel-release wget gcc zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel xz xz-devel libffi-devel curl git ncurses-devel numactl numactl-devel openssh-clients libcudnn8-devel zip blas-devel lapack-devel protobuf-compiler autoconf automake libtool centos-release-scl scl-utils cmake && yum clean all \
&& yum remove -y git && yum install -y https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm && yum install -y git jq devtoolset-11 && yum remove -y endpoint-repo \
&& echo -e ' \
#!/bin/bash\n \
source scl_source enable devtoolset-11\n \
' > /etc/profile.d/enable_devtools.sh \
&& pushd tmp \
&& wget https://ftp.openssl.org/source/openssl-1.1.1k.tar.gz \
&& tar -xzvf openssl-1.1.1k.tar.gz \
&& cd openssl-1.1.1k \
&& ./config --prefix=/usr --openssldir=/etc/ssl --libdir=lib no-shared zlib-dynamic \
&& make \
&& make install \
&& popd \
;; \
*) \
echo "Unsupported LINUX_VER: ${LINUX_VER}" && exit 1; \
;; \
esac

# Download and install GH CLI tool v2.32.0
ARG GH_VERSION=2.32.0
RUN <<EOF
set -e
wget https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_${CPU_ARCH}.tar.gz
tar -xf gh_*.tar.gz
mv gh_*/bin/gh /usr/local/bin
rm -rf gh_*
EOF

# Install sccache
ARG SCCACHE_VERSION=0.5.0

RUN curl -o /tmp/sccache.tar.gz \
-L "https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/sccache-v${SCCACHE_VERSION}-"${REAL_ARCH}"-unknown-linux-musl.tar.gz" && \
tar -C /tmp -xvf /tmp/sccache.tar.gz && \
mv "/tmp/sccache-v${SCCACHE_VERSION}-"${REAL_ARCH}"-unknown-linux-musl/sccache" /usr/bin/sccache && \
chmod +x /usr/bin/sccache

# Set AUDITWHEEL_* env vars for use with auditwheel
ENV AUDITWHEEL_POLICY=${POLICY} AUDITWHEEL_ARCH=${REAL_ARCH} AUDITWHEEL_PLAT=${POLICY}_${REAL_ARCH}

# Set sccache env vars
ENV CMAKE_CUDA_COMPILER_LAUNCHER=sccache
ENV CMAKE_CXX_COMPILER_LAUNCHER=sccache
ENV CMAKE_C_COMPILER_LAUNCHER=sccache
ENV SCCACHE_BUCKET=rapids-sccache-east
ENV SCCACHE_REGION=us-east-2
ENV SCCACHE_IDLE_TIMEOUT=32768
ENV SCCACHE_S3_USE_SSL=true
ENV SCCACHE_S3_NO_CREDENTIALS=false

# Install ucx
ARG UCX_VERSION=1.14.1
RUN mkdir -p /ucx-src && cd /ucx-src &&\
git clone https://github.com/openucx/ucx -b v${UCX_VERSION} ucx-git-repo &&\
cd ucx-git-repo && \
./autogen.sh && \
./contrib/configure-release \
--prefix=/usr \
--enable-mt \
--enable-cma \
--enable-numa \
--with-gnu-ld \
--with-sysroot \
--without-verbs \
--without-rdmacm \
--with-cuda=/usr/local/cuda && \
CPPFLAGS=-I/usr/local/cuda/include make -j && \
make install && \
cd / && \
rm -rf /ucx-src/

# Install pyenv
RUN curl https://pyenv.run | bash

# Create pyenvs
# TODO: Determine if any cleanup of the pyenv layers is needed to shrink the container
RUN pyenv update

RUN case "${LINUX_VER}" in \
"ubuntu"*) \
pyenv install --verbose "${RAPIDS_PY_VERSION}" \
;; \
"centos"*) \
# Need to specify the openssl location because of the install from source
CPPFLAGS="-I/usr/include/openssl" LDFLAGS="-L/usr/lib" pyenv install --verbose "${RAPIDS_PY_VERSION}" \
;; \
*) \
echo "Unsupported LINUX_VER: ${LINUX_VER}" && exit 1; \
;; \
esac

RUN pyenv global ${PYTHON_VER} && python -m pip install auditwheel patchelf twine rapids-dependency-file-generator && pyenv rehash

# Install latest gha-tools
RUN wget https://github.com/rapidsai/gha-tools/releases/latest/download/tools.tar.gz -O - | tar -xz -C /usr/local/bin

# Install the AWS CLI
RUN mkdir -p /aws_install && cd /aws_install && \
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" && \
unzip awscli-bundle.zip && \
./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws && \
cd / && \
rm -rf /aws_install

# Mark all directories as safe for git so that GHA clones into the root don't
# run into issues
RUN git config --system --add safe.directory '*'

CMD ["/bin/bash"]
File renamed without changes.
27 changes: 27 additions & 0 deletions ci/compute-build-args.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
set -euo pipefail

MANYLINUX_VER="manylinux_2_17"
if [[
"${LINUX_VER}" == "ubuntu18.04" ||
"${LINUX_VER}" == "ubuntu20.04"
]]; then
MANYLINUX_VER="manylinux_2_31"
fi

ARGS=(
# common args
"CUDA_VER=${CUDA_VER}"
"LINUX_VER=${LINUX_VER}"
"PYTHON_VER=${PYTHON_VER}"
# wheel args
"CPU_ARCH=${ARCH}"
"REAL_ARCH=$(arch)"
"MANYLINUX_VER=${MANYLINUX_VER}"
)

cat <<EOF > "${GITHUB_OUTPUT:-/dev/stdout}"
ARGS<<EOT
$(printf "%s\n" "${ARGS[@]}")
EOT
EOF
36 changes: 0 additions & 36 deletions ci/compute-latest-versions.sh

This file was deleted.

11 changes: 5 additions & 6 deletions ci/compute-matrix.jq
AyodeAwe marked this conversation as resolved.
Show resolved Hide resolved
AyodeAwe marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
def compute_arch($x):
["amd64"] |
if
$x.CUDA_VER > "11.2.2" and
$x.LINUX_VER != "centos7"
then
. + ["arm64"]
else
if
(["ubuntu18.04", "centos7"] | index($x.LINUX_VER) != null) or ($x.CUDA_VER <= "11.2.2")
then
.
else
. + ["arm64"]
end |
$x + {ARCHES: .};

Expand Down
2 changes: 1 addition & 1 deletion ci/compute-matrix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ case "${BUILD_TYPE}" in
;;
esac

yq -o json '. | del(.LATEST_VERSIONS)' matrix.yaml | jq -c 'include "ci/compute-matrix"; compute_matrix(.)'
yq -o json matrix.yaml | jq -c 'include "ci/compute-matrix"; compute_matrix(.)'
9 changes: 9 additions & 0 deletions ci/create-multiarch-manifest.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
#!/bin/bash
set -euo pipefail

PREFIX="conda"
if [[ "${IMAGE_REPO}" != "ci" ]]; then
PREFIX="wheels"
fi

LATEST_CUDA_VER=$(yq -r ".$PREFIX.CUDA_VER" latest.yaml)
LATEST_PYTHON_VER=$(yq -r ".$PREFIX.PYTHON_VER" latest.yaml)
LATEST_UBUNTU_VER=$(yq -r ".$PREFIX.LINUX_VER" latest.yaml)

source_tags=()
tag="${IMAGE_NAME}"
for arch in $(echo "${ARCHES}" | jq .[] -r); do
Expand Down
62 changes: 62 additions & 0 deletions citestwheel.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
ARG CUDA_VER=11.8.0
ARG LINUX_VER=ubuntu18.04

ARG BASE_IMAGE=nvidia/cuda:${CUDA_VER}-devel-${LINUX_VER}
FROM ${BASE_IMAGE}

ARG CUDA_VER
ARG PYTHON_VER=3.9

# Set RAPIDS versions env variables
ENV RAPIDS_CUDA_VERSION="${CUDA_VER}"
ENV RAPIDS_PY_VERSION="${PYTHON_VER}"

# RAPIDS pip index
ENV PIP_EXTRA_INDEX_URL="https://pypi.k8s.rapids.ai/simple"

ARG DEBIAN_FRONTEND=noninteractive

ENV PYENV_ROOT="/pyenv"
ENV PATH="/pyenv/bin:/pyenv/shims:$PATH"

RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
wget curl git jq ssh \
make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget \
curl llvm libncursesw5-dev xz-utils tk-dev unzip \
libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev

# Install pyenv
RUN curl https://pyenv.run | bash

# Create pyenvs
RUN pyenv update && pyenv install ${PYTHON_VER}

RUN pyenv global ${PYTHON_VER} && python --version

# add bin to path
ENV PATH="/pyenv/versions/${PYTHON_VER}/bin/:$PATH"

# Install the AWS CLI
# Needed to download wheels for running tests
# Install the AWS CLI
RUN mkdir -p /aws_install && cd /aws_install && \
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" && \
unzip awscli-bundle.zip && \
./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws && \
cd / && \
rm -rf /aws_install

# update git > 2.17
RUN grep '18.04' /etc/issue && bash -c "apt-get install -y software-properties-common && add-apt-repository ppa:git-core/ppa -y && apt-get update && apt-get install --upgrade -y git" || true;

# Install latest gha-tools
RUN wget https://github.com/rapidsai/gha-tools/releases/latest/download/tools.tar.gz -O - \
| tar -xz -C /usr/local/bin

# git safe directory
RUN git config --system --add safe.directory '*'

CMD ["/bin/bash"]
9 changes: 9 additions & 0 deletions latest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Define the values used for the "latest" tag
conda:
CUDA_VER: "12.0.1"
PYTHON_VER: "3.10"
LINUX_VER: "ubuntu22.04"
wheels:
CUDA_VER: "12.0.1"
PYTHON_VER: "3.10"
LINUX_VER: "ubuntu20.04"
Loading