From b7457e0bafdf9f40f40b4b6cd27bdefbb60f120f Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Tue, 1 Jul 2025 10:44:43 -0500 Subject: [PATCH 01/12] Add version change --- ci/build_wheel.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ci/build_wheel.sh b/ci/build_wheel.sh index 3abf5ca8f0..7af2a9f718 100755 --- a/ci/build_wheel.sh +++ b/ci/build_wheel.sh @@ -24,6 +24,9 @@ source rapids-configure-sccache source rapids-date-string source rapids-init-pip +# Update the version to accomdate nightly and release changes for the wheel name +rapids-generate-version > ./VERSION + cd "${package_dir}" sccache --zero-stats From 2c83df0b028f643b0c3e8305f5a361ad0d5960bc Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Tue, 1 Jul 2025 16:57:15 -0500 Subject: [PATCH 02/12] Add workflow to build image --- .github/workflows/build_images.yml | 96 ++++++++++++++ .../workflows/build_test_publish_images.yml | 125 ++++++++++++++++++ 2 files changed, 221 insertions(+) create mode 100644 .github/workflows/build_images.yml create mode 100644 .github/workflows/build_test_publish_images.yml diff --git a/.github/workflows/build_images.yml b/.github/workflows/build_images.yml new file mode 100644 index 0000000000..8ed20c7481 --- /dev/null +++ b/.github/workflows/build_images.yml @@ -0,0 +1,96 @@ +# SPDX-FileCopyrightText: Copyright (c) 2023-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Build and push image variant + +on: + workflow_call: + inputs: + ARCHES: + required: true + type: string + CUDA_VER: + required: true + type: string + PYTHON_VER: + required: true + type: string + CUOPT_VER: + required: true + type: string + +jobs: + build: + strategy: + matrix: + ARCH: ${{ fromJSON(inputs.ARCHES) }} + CUDA_VER: ["${{ inputs.CUDA_VER }}"] + PYTHON_VER: ["${{ inputs.PYTHON_VER }}"] + CUOPT_VER: ["${{ inputs.CUOPT_VER }}"] + fail-fast: false + runs-on: "linux-${{ matrix.ARCH }}-cpu4" + steps: + - name: Checkout code repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install gha-tools + run: | + mkdir -p /tmp/gha-tools + curl -s -L 'https://github.com/rapidsai/gha-tools/releases/latest/download/tools.tar.gz' | tar -xz -C /tmp/gha-tools + echo "/tmp/gha-tools" >> "${GITHUB_PATH}" + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.CUOPT_DOCKERHUB_USERNAME }} + password: ${{ secrets.CUOPT_DOCKERHUB_TOKEN }} + + - name: Login to NGC + uses: docker/login-action@v3 + with: + registry: "nvcr.io" + username: "$oauthtoken" + password: ${{ secrets.CUOPT_NGC_DOCKER_KEY }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + # Using the built-in config from NVIDIA's self-hosted runners means that 'docker build' + # will use NVIDIA's self-hosted DockerHub pull-through cache, which should mean faster builds, + # fewer network failures, and fewer rate-limiting issues + buildkitd-config: /etc/buildkit/buildkitd.toml + driver: docker + endpoint: builders + - name: Build image and push to DockerHub and NGC + uses: docker/build-push-action@v6 + with: + context: context + file: ./ci/docker/Dockerfile + target: cuopt + push: true + pull: true + build-args: | + CUDA_VER=${{ inputs.CUDA_VER }} + PYTHON_VER=${{ inputs.PYTHON_VER }} + CUOPT_VER=${{ inputs.CUOPT_VER }} + tags: nvidia/cuopt:${{ inputs.CUOPT_VER }}-cuda${{ inputs.CUDA_VER }}-${{ matrix.PYTHON_VER }}-${{ matrix.ARCH }} + + - name: Push image to NGC + run: | + docker tag nvidia/cuopt:${{ inputs.CUOPT_VER }}-cuda${{ inputs.CUDA_VER }}-${{ matrix.PYTHON_VER }}-${{ matrix.ARCH }} nvcr.io/nvstaging/nvaie/cuopt:${{ inputs.CUOPT_VER }}-cuda${{ inputs.CUDA_VER }}-${{ matrix.PYTHON_VER }}-${{ matrix.ARCH }} + docker push nvcr.io/nvstaging/nvaie/cuopt:${{ inputs.CUOPT_VER }}-cuda${{ inputs.CUDA_VER }}-${{ matrix.PYTHON_VER }}-${{ matrix.ARCH }} + + + diff --git a/.github/workflows/build_test_publish_images.yml b/.github/workflows/build_test_publish_images.yml new file mode 100644 index 0000000000..017486926f --- /dev/null +++ b/.github/workflows/build_test_publish_images.yml @@ -0,0 +1,125 @@ +# SPDX-FileCopyrightText: Copyright (c) 2023-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Build, Test and Publish cuopt images + +on: + workflow_dispatch: + inputs: + branch: + type: string + date: + type: string + sha: + type: string + build_type: + type: string + +defaults: + run: + shell: bash + +permissions: + actions: read + checks: none + contents: read + deployments: none + discussions: none + id-token: write + issues: none + packages: read + pages: none + pull-requests: read + repository-projects: none + security-events: none + statuses: none + +jobs: + compute-matrix: + runs-on: ubuntu-latest + container: + image: rapidsai/ci-conda:latest + outputs: + MATRIX: ${{ steps.compute-matrix.outputs.MATRIX }} + CUOPT_VER: ${{ steps.compute-cuopt-ver.outputs.CUOPT_VER }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 # unshallow fetch for setuptools-scm + persist-credentials: false + + - name: Compute matrix + id: compute-matrix + run: | + MATRIX=$(cat <> $GITHUB_OUTPUT + + - name: Compute cuopt version + id: compute-cuopt-ver + run: | + ver=$(git describe --tags --abbrev=0) + CUOPT_VER=$(echo "$ver" | sed -E 's/^v//' \ + | sed -E 's/\.0+([0-9])/\.\1/g' \ + | sed -E 's/\.0+([a-zA-Z].*)/.0\1/g' \ + | sed -E 's/\b0*([0-9]+)\b/\1/g') + echo "$CUOPT_VER" >> $GITHUB_OUTPUT + + build-images: + name: Build images for ${inputs.arch} architecture + needs: compute-matrix + strategy: + matrix: ${{ fromJson(needs.compute-matrix.outputs.MATRIX) }} + uses: ./.github/workflows/build-images.yaml + with: + arch: ${{ matrix.arch }} + cuda_ver: ${{ matrix.cuda_ver }} + python_ver: ${{ matrix.python_ver }} + cuopt_ver: ${{ steps.compute-cuopt-ver.outputs.CUOPT_VER }} + + build-cuopt-multiarch-manifest: + name: Build cuopt multiarch manifest + needs: build-images + runs-on: ubuntu-latest + steps: + - name: Checkout code repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.CUOPT_DOCKERHUB_USERNAME }} + password: ${{ secrets.CUOPT_DOCKERHUB_PASSWORD }} + - name: Login to NGC + uses: docker/login-action@v3 + with: + username: ${{ secrets.CUOPT_NGC_USERNAME }} + password: ${{ secrets.CUOPT_NGC_PASSWORD }} + - name: Create multiarch manifest + shell: bash + env: + CUOPT_VER: ${{ steps.compute-cuopt-ver.outputs.CUOPT_VER }} + CUDA_VER: ${{ matrix.cuda_ver }} + PYTHON_VER: ${{ matrix.python_ver }} + ARCH: ${{ matrix.arch }} + + run: ci/docker/create_multiarch_manifest.sh \ No newline at end of file From 49f4095ec79345640fb9f610f443f067cba72d30 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Tue, 1 Jul 2025 18:09:44 -0500 Subject: [PATCH 03/12] add docker folder and update yml --- .../workflows/build_test_publish_images.yml | 4 +- ci/docker/Dockerfile | 109 ++++++++++++++++++ 2 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 ci/docker/Dockerfile diff --git a/.github/workflows/build_test_publish_images.yml b/.github/workflows/build_test_publish_images.yml index 017486926f..cd81d097f2 100644 --- a/.github/workflows/build_test_publish_images.yml +++ b/.github/workflows/build_test_publish_images.yml @@ -67,8 +67,8 @@ jobs: run: | MATRIX=$(cat <> $GITHUB_OUTPUT diff --git a/ci/docker/Dockerfile b/ci/docker/Dockerfile new file mode 100644 index 0000000000..0f013b690f --- /dev/null +++ b/ci/docker/Dockerfile @@ -0,0 +1,109 @@ +# syntax=docker/dockerfile:1.2 +# SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ARG CUDA_VER=12.8.0 +ARG CUOPT_VER=25.8.0 +ARG PYTHON_VER=3.12.11 + +FROM nvidia/cuda:${CUDA_VER}-runtime-ubuntu22.04 AS cuda-libs + +# Install cuOpt +FROM nvidia/cuda:${CUDA_VER}-base-ubuntu22.04 AS python-env + +RUN apt-get update && apt-get install -y \ + wget \ + git \ + gcc \ + build-essential \ + zlib1g-dev \ + libncurses5-dev \ + libgdbm-dev \ + libnss3-dev \ + libssl-dev \ + libreadline-dev \ + libffi-dev \ + libsqlite3-dev \ + libbz2-dev \ + ca-certificates \ + && rm -rf /var/lib/apt/lists/* + +RUN wget https://www.python.org/ftp/python/${PYTHON_VER}/Python-${PYTHON_VER}.tgz \ + && tar xzf Python-${PYTHON_VER}.tgz \ + && cd Python-${PYTHON_VER} \ + && ./configure --enable-optimizations \ + && make -j$(nproc) \ + && make install \ + && cd .. \ + && rm -rf Python-${PYTHON_VER} Python-${PYTHON_VER}.tgz \ + && python3 -m pip install --upgrade pip + +RUN apt-get purge -y \ + build-essential \ + zlib1g-dev \ + libncurses5-dev \ + libgdbm-dev \ + libnss3-dev \ + libssl-dev \ + libreadline-dev \ + libffi-dev \ + libsqlite3-dev \ + libbz2-dev \ + && apt-get autoremove -y \ + && apt-get clean + +RUN ln -sf /usr/local/bin/python3 /usr/local/bin/python +RUN groupadd -r cuopt && useradd -r -g cuopt cuopt +RUN chown -R cuopt:cuopt /usr/local/lib/python3.12/site-packages +USER cuopt + +FROM python-env AS install-env + +WORKDIR /home/cuopt + +ARG cuda-suffix=cu$(echo ${CUDA_VER} | cut -d'.' -f1) +ARG CUOPT_VERSION + +ENV PIP_EXTRA_INDEX_URL="https://pypi.nvidia.com https://pypi.anaconda.org/rapidsai-wheels-nightly/simple" + +RUN if [[ "${CUDA_VER}" == "12.8" ]]; then \ + cuda_suffix="cu12"; \ + python -m pip install nvidia-cuda-runtime-cu12==12.8.0; \ + fi + +RUN python -m pip install --user --no-cache-dir cuopt-server-${cuda_suffix}==${CUOPT_VER}* cuopt-sh-client==${CUOPT_VER}* +USER root + +RUN apt-get purge -y gcc git \ + && apt-get update \ + && apt-get install -y unzip \ + && apt-get autoremove -y \ + && apt-get clean + +USER cuopt + +COPY ./LICENSE /home/cuopt/LICENSE +COPY ./VERSION /home/cuopt/VERSION + + +FROM install-env AS cuopt-final + +ENV PATH="/usr/local/cuda/bin:/usr/bin:/usr/local/bin:/usr/local/nvidia/bin/:/home/cuopt/.local/lib/python3.12/site-packages/libcuopt/bin/:/home/cuopt/.local/bin:$PATH" +ENV LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu:/usr/lib/aarch64-linux-gnu:/usr/local/cuda/lib64:/usr/local/nvidia/lib:/usr/local/nvidia/lib64:/usr/lib/wsl/lib:/usr/lib/wsl/lib/libnvidia-container:/usr/lib/nvidia:/usr/lib/nvidia-current:/home/cuopt/.local/lib/python3.12/site-packages/libcuopt/lib/:/home/cuopt/.local/lib/python3.12/site-packages/rapids_logger/lib64:${LD_LIBRARY_PATH}" +# Make pip packages accessible to all users +ENV PYTHONPATH="/home/cuopt/.local/lib/python${PYTHON_VER%.*}/site-packages:/usr/local/lib/python${PYTHON_VER%.*}/site-packages:${PYTHONPATH:-}" + +COPY --from=cuda-libs /usr/local/cuda/lib64/libnvrtc* /usr/local/cuda/lib64/ +COPY --from=cuda-libs /usr/local/cuda/lib64/libnvJitLink* /usr/local/cuda/lib64/ \ No newline at end of file From 369d07916d4896969c664e83518ac13967f3704d Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Wed, 2 Jul 2025 14:08:47 -0500 Subject: [PATCH 04/12] Update dockerfile --- ci/docker/Dockerfile | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/ci/docker/Dockerfile b/ci/docker/Dockerfile index 0f013b690f..e766e1919d 100644 --- a/ci/docker/Dockerfile +++ b/ci/docker/Dockerfile @@ -17,12 +17,17 @@ ARG CUDA_VER=12.8.0 ARG CUOPT_VER=25.8.0 ARG PYTHON_VER=3.12.11 +ARG PYTHON_SHORT_VER=3.12 FROM nvidia/cuda:${CUDA_VER}-runtime-ubuntu22.04 AS cuda-libs # Install cuOpt FROM nvidia/cuda:${CUDA_VER}-base-ubuntu22.04 AS python-env +ARG CUDA_VER +ARG CUOPT_VER +ARG PYTHON_VER + RUN apt-get update && apt-get install -y \ wget \ git \ @@ -78,12 +83,14 @@ ARG CUOPT_VERSION ENV PIP_EXTRA_INDEX_URL="https://pypi.nvidia.com https://pypi.anaconda.org/rapidsai-wheels-nightly/simple" -RUN if [[ "${CUDA_VER}" == "12.8" ]]; then \ +SHELL ["/bin/bash", "-c"] +RUN if [[ "${CUDA_VER}" =~ ^12\. ]]; then \ cuda_suffix="cu12"; \ - python -m pip install nvidia-cuda-runtime-cu12==12.8.0; \ - fi + python -m pip install nvidia-cuda-runtime-cu12==$(echo ${CUDA_VER} | cut -d'.' -f1-2).*; \ + fi && \ + python -m pip install --user --no-cache-dir cuopt-server-${cuda_suffix}==${CUOPT_VER} cuopt-sh-client==${CUOPT_VER} && \ + python -m pip list -RUN python -m pip install --user --no-cache-dir cuopt-server-${cuda_suffix}==${CUOPT_VER}* cuopt-sh-client==${CUOPT_VER}* USER root RUN apt-get purge -y gcc git \ @@ -97,13 +104,14 @@ USER cuopt COPY ./LICENSE /home/cuopt/LICENSE COPY ./VERSION /home/cuopt/VERSION - FROM install-env AS cuopt-final +ARG PYTHON_SHORT_VER + ENV PATH="/usr/local/cuda/bin:/usr/bin:/usr/local/bin:/usr/local/nvidia/bin/:/home/cuopt/.local/lib/python3.12/site-packages/libcuopt/bin/:/home/cuopt/.local/bin:$PATH" ENV LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu:/usr/lib/aarch64-linux-gnu:/usr/local/cuda/lib64:/usr/local/nvidia/lib:/usr/local/nvidia/lib64:/usr/lib/wsl/lib:/usr/lib/wsl/lib/libnvidia-container:/usr/lib/nvidia:/usr/lib/nvidia-current:/home/cuopt/.local/lib/python3.12/site-packages/libcuopt/lib/:/home/cuopt/.local/lib/python3.12/site-packages/rapids_logger/lib64:${LD_LIBRARY_PATH}" # Make pip packages accessible to all users -ENV PYTHONPATH="/home/cuopt/.local/lib/python${PYTHON_VER%.*}/site-packages:/usr/local/lib/python${PYTHON_VER%.*}/site-packages:${PYTHONPATH:-}" +ENV PYTHONPATH="/home/cuopt/.local/lib/python${PYTHON_SHORT_VER}/site-packages:/usr/local/lib/python${PYTHON_SHORT_VER}/site-packages:${PYTHONPATH:-}" COPY --from=cuda-libs /usr/local/cuda/lib64/libnvrtc* /usr/local/cuda/lib64/ COPY --from=cuda-libs /usr/local/cuda/lib64/libnvJitLink* /usr/local/cuda/lib64/ \ No newline at end of file From 23a34eb7346171e9ce09a9279405c12b3cbf9ae7 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Wed, 2 Jul 2025 14:15:32 -0500 Subject: [PATCH 05/12] Update workflow --- .github/workflows/build_images.yml | 7 ------- .github/workflows/build_test_publish_images.yml | 10 ++++++++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_images.yml b/.github/workflows/build_images.yml index 8ed20c7481..38d1269e4b 100644 --- a/.github/workflows/build_images.yml +++ b/.github/workflows/build_images.yml @@ -46,24 +46,17 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Install gha-tools - run: | - mkdir -p /tmp/gha-tools - curl -s -L 'https://github.com/rapidsai/gha-tools/releases/latest/download/tools.tar.gz' | tar -xz -C /tmp/gha-tools - echo "/tmp/gha-tools" >> "${GITHUB_PATH}" - name: Login to DockerHub uses: docker/login-action@v3 with: username: ${{ secrets.CUOPT_DOCKERHUB_USERNAME }} password: ${{ secrets.CUOPT_DOCKERHUB_TOKEN }} - - name: Login to NGC uses: docker/login-action@v3 with: registry: "nvcr.io" username: "$oauthtoken" password: ${{ secrets.CUOPT_NGC_DOCKER_KEY }} - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 with: diff --git a/.github/workflows/build_test_publish_images.yml b/.github/workflows/build_test_publish_images.yml index cd81d097f2..dfdb49ea71 100644 --- a/.github/workflows/build_test_publish_images.yml +++ b/.github/workflows/build_test_publish_images.yml @@ -66,17 +66,23 @@ jobs: id: compute-matrix run: | MATRIX=$(cat <> $GITHUB_OUTPUT + - name: Install gha-tools + run: | + mkdir -p /tmp/gha-tools + curl -s -L 'https://github.com/rapidsai/gha-tools/releases/latest/download/tools.tar.gz' | tar -xz -C /tmp/gha-tools + echo "/tmp/gha-tools" >> "${GITHUB_PATH}" + - name: Compute cuopt version id: compute-cuopt-ver run: | - ver=$(git describe --tags --abbrev=0) + ver=$(rapids-generate-version) CUOPT_VER=$(echo "$ver" | sed -E 's/^v//' \ | sed -E 's/\.0+([0-9])/\.\1/g' \ | sed -E 's/\.0+([a-zA-Z].*)/.0\1/g' \ From 48544e183031145242f281bcf19ad327b1732263 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Wed, 2 Jul 2025 15:43:12 -0500 Subject: [PATCH 06/12] Add changes to accomdate image tag --- .github/workflows/build_images.yml | 9 ++++++--- .github/workflows/build_test_publish_images.yml | 16 +++++++++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build_images.yml b/.github/workflows/build_images.yml index 38d1269e4b..842b313a1f 100644 --- a/.github/workflows/build_images.yml +++ b/.github/workflows/build_images.yml @@ -30,6 +30,9 @@ on: CUOPT_VER: required: true type: string + IMAGE_TAG_PREFIX: + required: true + type: string jobs: build: @@ -78,12 +81,12 @@ jobs: CUDA_VER=${{ inputs.CUDA_VER }} PYTHON_VER=${{ inputs.PYTHON_VER }} CUOPT_VER=${{ inputs.CUOPT_VER }} - tags: nvidia/cuopt:${{ inputs.CUOPT_VER }}-cuda${{ inputs.CUDA_VER }}-${{ matrix.PYTHON_VER }}-${{ matrix.ARCH }} + tags: nvidia/cuopt:${{ inputs.IMAGE_TAG_PREFIX }}-cuda${{ inputs.CUDA_VER }}-${{ matrix.PYTHON_VER }}-${{ matrix.ARCH }} - name: Push image to NGC run: | - docker tag nvidia/cuopt:${{ inputs.CUOPT_VER }}-cuda${{ inputs.CUDA_VER }}-${{ matrix.PYTHON_VER }}-${{ matrix.ARCH }} nvcr.io/nvstaging/nvaie/cuopt:${{ inputs.CUOPT_VER }}-cuda${{ inputs.CUDA_VER }}-${{ matrix.PYTHON_VER }}-${{ matrix.ARCH }} - docker push nvcr.io/nvstaging/nvaie/cuopt:${{ inputs.CUOPT_VER }}-cuda${{ inputs.CUDA_VER }}-${{ matrix.PYTHON_VER }}-${{ matrix.ARCH }} + docker tag nvidia/cuopt:${{ inputs.IMAGE_TAG_PREFIX }}-cuda${{ inputs.CUDA_VER }}-${{ matrix.PYTHON_VER }}-${{ matrix.ARCH }} nvcr.io/nvstaging/nvaie/cuopt:${{ inputs.IMAGE_TAG_PREFIX }}-cuda${{ inputs.CUDA_VER }}-${{ matrix.PYTHON_VER }}-${{ matrix.ARCH }} + docker push nvcr.io/nvstaging/nvaie/cuopt:${{ inputs.IMAGE_TAG_PREFIX }}-cuda${{ inputs.CUDA_VER }}-${{ matrix.PYTHON_VER }}-${{ matrix.ARCH }} diff --git a/.github/workflows/build_test_publish_images.yml b/.github/workflows/build_test_publish_images.yml index dfdb49ea71..8e551f9ac4 100644 --- a/.github/workflows/build_test_publish_images.yml +++ b/.github/workflows/build_test_publish_images.yml @@ -54,6 +54,7 @@ jobs: outputs: MATRIX: ${{ steps.compute-matrix.outputs.MATRIX }} CUOPT_VER: ${{ steps.compute-cuopt-ver.outputs.CUOPT_VER }} + IMAGE_TAG_PREFIX: ${{ steps.compute-cuopt-ver.outputs.IMAGE_TAG_PREFIX }} steps: - name: Checkout @@ -88,7 +89,11 @@ jobs: | sed -E 's/\.0+([a-zA-Z].*)/.0\1/g' \ | sed -E 's/\b0*([0-9]+)\b/\1/g') echo "$CUOPT_VER" >> $GITHUB_OUTPUT - + if [[ "$CUOPT_VER" == *"a"* ]]; then + IMAGE_TAG_PREFIX=$(echo "$CUOPT_VER" | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+)a.*/\1a/') + else + IMAGE_TAG_PREFIX="$CUOPT_VER" + fi build-images: name: Build images for ${inputs.arch} architecture needs: compute-matrix @@ -96,10 +101,11 @@ jobs: matrix: ${{ fromJson(needs.compute-matrix.outputs.MATRIX) }} uses: ./.github/workflows/build-images.yaml with: - arch: ${{ matrix.arch }} - cuda_ver: ${{ matrix.cuda_ver }} - python_ver: ${{ matrix.python_ver }} - cuopt_ver: ${{ steps.compute-cuopt-ver.outputs.CUOPT_VER }} + ARCHES: ${{ matrix.arch }} + CUDA_VER: ${{ matrix.cuda_ver }} + PYTHON_VER: ${{ matrix.python_ver }} + CUOPT_VER: ${{ steps.compute-cuopt-ver.outputs.CUOPT_VER }} + IMAGE_TAG_PREFIX: ${{ steps.compute-cuopt-ver.outputs.IMAGE_TAG_PREFIX }} build-cuopt-multiarch-manifest: name: Build cuopt multiarch manifest From 3968704ab064ca1b0b5a5aeffa90af7d3e103a1a Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Wed, 2 Jul 2025 17:26:08 -0500 Subject: [PATCH 07/12] Add multi arch script --- .../workflows/build_test_publish_images.yml | 1 + ci/docker/create_multiarch_manifest.sh | 75 +++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 ci/docker/create_multiarch_manifest.sh diff --git a/.github/workflows/build_test_publish_images.yml b/.github/workflows/build_test_publish_images.yml index 8e551f9ac4..4a7e321710 100644 --- a/.github/workflows/build_test_publish_images.yml +++ b/.github/workflows/build_test_publish_images.yml @@ -132,6 +132,7 @@ jobs: CUOPT_VER: ${{ steps.compute-cuopt-ver.outputs.CUOPT_VER }} CUDA_VER: ${{ matrix.cuda_ver }} PYTHON_VER: ${{ matrix.python_ver }} + IMAGE_TAG_PREFIX: ${{ steps.compute-cuopt-ver.outputs.IMAGE_TAG_PREFIX }} ARCH: ${{ matrix.arch }} run: ci/docker/create_multiarch_manifest.sh \ No newline at end of file diff --git a/ci/docker/create_multiarch_manifest.sh b/ci/docker/create_multiarch_manifest.sh new file mode 100644 index 0000000000..237e7849d7 --- /dev/null +++ b/ci/docker/create_multiarch_manifest.sh @@ -0,0 +1,75 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Create manifest for dockerhub and nvstaging + +docker manifest create --amend nvidia/cuopt:${IMAGE_TAG_PREFIX}-cuda${CUDA_VER}-py${PYTHON_VER} \ + nvidia/cuopt:${IMAGE_TAG_PREFIX}-cuda${CUDA_VER}-py${PYTHON_VER}-amd64 \ + nvidia/cuopt:${IMAGE_TAG_PREFIX}-cuda${CUDA_VER}-py${PYTHON_VER}-arm64 + +docker manifest annotate nvidia/cuopt:${IMAGE_TAG_PREFIX}-cuda${CUDA_VER}-py${PYTHON_VER} \ + nvidia/cuopt:${IMAGE_TAG_PREFIX}-cuda${CUDA_VER}-py${PYTHON_VER}-arm64 \ + --arch arm64 + +docker manifest annotate nvidia/cuopt:${IMAGE_TAG_PREFIX}-cuda${CUDA_VER}-py${PYTHON_VER} \ + nvidia/cuopt:${IMAGE_TAG_PREFIX}-cuda${CUDA_VER}-py${PYTHON_VER}-amd64 \ + --arch amd64 + +docker manifest push nvidia/cuopt:${IMAGE_TAG_PREFIX}-cuda${CUDA_VER}-py${PYTHON_VER} + +docker manifest create --amend nvcr.io/nvstaging/nvaie/cuopt:${IMAGE_TAG_PREFIX}-cuda${CUDA_VER}-py${PYTHON_VER} \ + nvcr.io/nvstaging/nvaie/cuopt:${IMAGE_TAG_PREFIX}-cuda${CUDA_VER}-py${PYTHON_VER}-amd64 \ + nvcr.io/nvstaging/nvaie/cuopt:${IMAGE_TAG_PREFIX}-cuda${CUDA_VER}-py${PYTHON_VER}-arm64 + +docker manifest annotate nvcr.io/nvstaging/nvaie/cuopt:${IMAGE_TAG_PREFIX}-cuda${CUDA_VER}-py${PYTHON_VER} \ + nvcr.io/nvstaging/nvaie/cuopt:${IMAGE_TAG_PREFIX}-cuda${CUDA_VER}-py${PYTHON_VER}-arm64 \ + --arch arm64 + +docker manifest annotate nvcr.io/nvstaging/nvaie/cuopt:${IMAGE_TAG_PREFIX}-cuda${CUDA_VER}-py${PYTHON_VER} \ + nvcr.io/nvstaging/nvaie/cuopt:${IMAGE_TAG_PREFIX}-cuda${CUDA_VER}-py${PYTHON_VER}-amd64 \ + --arch amd64 + +docker manifest push nvcr.io/nvstaging/nvaie/cuopt:${IMAGE_TAG_PREFIX}-cuda${CUDA_VER}-py${PYTHON_VER} + +# Only create latest manifests for release builds +if [[ "${BUILD_TYPE}" == "release" ]]; then + docker manifest create --amend nvidia/cuopt:latest-cuda${CUDA_VER}-py${PYTHON_VER} \ + nvidia/cuopt:${IMAGE_TAG_PREFIX}-cuda${CUDA_VER}-py${PYTHON_VER}-amd64 \ + nvidia/cuopt:${IMAGE_TAG_PREFIX}-cuda${CUDA_VER}-py${PYTHON_VER}-arm64 + + docker manifest annotate nvidia/cuopt:latest-cuda${CUDA_VER}-py${PYTHON_VER} \ + nvidia/cuopt:${IMAGE_TAG_PREFIX}-cuda${CUDA_VER}-py${PYTHON_VER}-arm64 \ + --arch arm64 + + docker manifest annotate nvidia/cuopt:latest-cuda${CUDA_VER}-py${PYTHON_VER} \ + nvidia/cuopt:${IMAGE_TAG_PREFIX}-cuda${CUDA_VER}-py${PYTHON_VER}-amd64 \ + --arch amd64 + + docker manifest push nvidia/cuopt:latest-cuda${CUDA_VER}-py${PYTHON_VER} + + docker manifest create --amend nvcr.io/nvstaging/nvaie/cuopt:latest-cuda${CUDA_VER}-py${PYTHON_VER} \ + nvcr.io/nvstaging/nvaie/cuopt:${IMAGE_TAG_PREFIX}-cuda${CUDA_VER}-py${PYTHON_VER}-amd64 \ + nvcr.io/nvstaging/nvaie/cuopt:${IMAGE_TAG_PREFIX}-cuda${CUDA_VER}-py${PYTHON_VER}-arm64 + + docker manifest annotate nvcr.io/nvstaging/nvaie/cuopt:latest-cuda${CUDA_VER}-py${PYTHON_VER} \ + nvcr.io/nvstaging/nvaie/cuopt:${IMAGE_TAG_PREFIX}-cuda${CUDA_VER}-py${PYTHON_VER}-arm64 \ + --arch arm64 + + docker manifest annotate nvcr.io/nvstaging/nvaie/cuopt:latest-cuda${CUDA_VER}-py${PYTHON_VER} \ + nvcr.io/nvstaging/nvaie/cuopt:${IMAGE_TAG_PREFIX}-cuda${CUDA_VER}-py${PYTHON_VER}-amd64 \ + --arch amd64 + + docker manifest push nvcr.io/nvstaging/nvaie/cuopt:latest-cuda${CUDA_VER}-py${PYTHON_VER} +fi \ No newline at end of file From de1e24ec6e065518555b5a85f9281fe6ca22d303 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Wed, 2 Jul 2025 17:30:35 -0500 Subject: [PATCH 08/12] Add multi arch script --- ci/docker/create_multiarch_manifest.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/docker/create_multiarch_manifest.sh b/ci/docker/create_multiarch_manifest.sh index 237e7849d7..d77d4caecd 100644 --- a/ci/docker/create_multiarch_manifest.sh +++ b/ci/docker/create_multiarch_manifest.sh @@ -1,3 +1,5 @@ +#!/bin/bash + # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # From 6ddf3a725d12911242e01952c21a9f57801136b6 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Thu, 3 Jul 2025 10:07:49 -0500 Subject: [PATCH 09/12] enable nightly build --- .github/workflows/build.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4c7458727d..79a2ffee6c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -191,8 +191,8 @@ jobs: date: ${{ inputs.date }} package-name: cuopt_sh_client package-type: python - service-container: - if: inputs.build_type == 'nightly' + build-images: + if: inputs.build_type == 'nightly' || inputs.build_type == 'release' needs: [wheel-build-cuopt, wheel-build-cuopt-server] runs-on: ubuntu-latest steps: @@ -206,7 +206,7 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - gh workflow run service_nightly.yaml \ + gh workflow run build_test_publish_images.yml \ -f branch=${{ inputs.branch }} \ -f sha=${{ inputs.sha }} \ -f date=${{ inputs.date }} \ From 812d7515f24d7757ea3a335bd2487921ba5ae086 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Thu, 3 Jul 2025 10:16:46 -0500 Subject: [PATCH 10/12] test nightly --- .github/workflows/pr.yaml | 241 +++----------------------------------- 1 file changed, 18 insertions(+), 223 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index d21d8e4d3c..94a37b7e62 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -10,226 +10,21 @@ concurrency: cancel-in-progress: true jobs: - pr-builder: - needs: - - changed-files - - checks - - conda-cpp-build - - conda-cpp-tests - - conda-python-build - - conda-python-tests - - wheel-build-libcuopt - # - conda-notebook-tests - - wheel-build-cuopt - - wheel-tests-cuopt - - wheel-build-cuopt-server - - wheel-tests-cuopt-server - - wheel-build-cuopt-mps-parser - - wheel-build-cuopt-sh-client - - test-self-hosted-server - secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/pr-builder.yaml@branch-25.08 - changed-files: - secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/changed-files.yaml@branch-25.08 - with: - files_yaml: | - test_cpp: - - '**' - - '!CONTRIBUTING.md' - - '!README.md' - - '!ci/release/update-version-cuopt.sh' - - '!ci/release/update-version-rapids.sh' - - '!docs/**' - - '!img/**' - - '!notebooks/**' - - '!python/**' - - '!readme_pages/**' - - '!container-builder/**' - - '!helm-chart/**' - - '!ngc/**' - - '!omniverse/**' - - '!regression/**' - - '!resources/**' - - '!ucf/**' - - '!utilities/**' - test_notebooks: - - '**' - - '!CONTRIBUTING.md' - - '!README.md' - - '!ci/release/update-version-cuopt.sh' - - '!ci/release/update-version-rapids.sh' - - '!docs/**' - - '!python/nvcf_client/**' - test_python: - - '**' - - '!CONTRIBUTING.md' - - '!README.md' - - '!ci/release/update-version-cuopt.sh' - - '!ci/release/update-version-rapids.sh' - - '!docs/**' - - '!img/**' - - '!notebooks/**' - - '!python/nvcf_client/**' - test_python_cuopt: - - '**' - - '!CONTRIBUTING.md' - - '!README.md' - - '!ci/release/update-version-cuopt.sh' - - '!ci/release/update-version-rapids.sh' - - '!docs/**' - - '!img/**' - - '!notebooks/**' - - '!python/cuopt_self_hosted/**' - - '!python/cuopt_server/**' - - '!python/nvcf_client/**' - test_python_cuopt_server: - - '**' - - '!CONTRIBUTING.md' - - '!README.md' - - '!ci/release/update-version-cuopt.sh' - - '!ci/release/update-version-rapids.sh' - - '!docs/**' - - '!img/**' - - '!notebooks/**' - - '!python/cuopt_self_hosted/**' - - '!python/nvcf_client/**' - checks: - secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/checks.yaml@branch-25.08 - with: - enable_check_generated_files: false - - conda-cpp-build: - needs: checks - secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-build.yaml@branch-25.08 - with: - build_type: pull-request - matrix_filter: map(select((.CUDA_VER | startswith("12")))) - script: ci/build_cpp.sh - conda-cpp-tests: - needs: [conda-cpp-build, changed-files] - secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/conda-cpp-tests.yaml@branch-25.08 - #if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_cpp - with: - build_type: pull-request - matrix_filter: map(select((.CUDA_VER | startswith("12")))) - script: ci/test_cpp.sh - conda-python-build: - needs: conda-cpp-build - secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/conda-python-build.yaml@branch-25.08 - with: - build_type: pull-request - matrix_filter: map(select((.CUDA_VER | startswith("12")))) - script: ci/build_python.sh - conda-python-tests: - needs: [conda-python-build, changed-files] - secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/conda-python-tests.yaml@branch-25.08 - #if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python - with: - run_codecov: false - build_type: pull-request - matrix_filter: map(select((.CUDA_VER | startswith("12")))) - script: ci/test_python.sh - #docs-build: - # needs: checks - # secrets: inherit - # uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@branch-25.08 - # with: - # build_type: pull-request - # node_type: "cpu4" - # arch: amd64 - # container_image: rapidsai/ci-conda:cuda11.8.0-ubuntu22.04-py3.10 - # run_script: ci/build_docs.sh - #conda-notebook-tests: - # needs: [conda-python-build, changed-files] - # secrets: inherit - # uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@branch-25.08 - # #if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_notebooks - # with: - # build_type: pull-request - # node_type: "gpu-l4-latest-1" - # arch: "amd64" - # container_image: "rapidsai/ci-conda:cuda11.8.0-ubuntu22.04-py3.10" - # run_script: "ci/test_notebooks.sh" - wheel-build-cuopt-mps-parser: - secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-25.08 - with: - build_type: pull-request - script: ci/build_wheel_cuopt_mps_parser.sh - package-name: cuopt_mps_parser - package-type: python - append-cuda-suffix: false - matrix_filter: map(select((.CUDA_VER | startswith("12")))) - wheel-build-libcuopt: - needs: wheel-build-cuopt-mps-parser - secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-25.08 - with: - # build for every combination of arch and CUDA version, but only for the latest Python - matrix_filter: map(select((.CUDA_VER | startswith("12")) and .PY_VER == "3.12")) - package-type: cpp - package-name: libcuopt - build_type: pull-request - script: ci/build_wheel_libcuopt.sh - wheel-build-cuopt: - needs: [wheel-build-cuopt-mps-parser, wheel-build-libcuopt] - secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-25.08 - with: - build_type: pull-request - script: ci/build_wheel_cuopt.sh - package-name: cuopt - package-type: python - matrix_filter: map(select((.CUDA_VER | startswith("12")))) - wheel-tests-cuopt: - needs: [wheel-build-cuopt, wheel-build-cuopt-mps-parser, changed-files] - secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-25.08 - #if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_cuopt - with: - build_type: pull-request - script: ci/test_wheel_cuopt.sh - matrix_filter: map(select((.CUDA_VER | startswith("12")))) - wheel-build-cuopt-server: - needs: wheel-build-cuopt - secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-25.08 - with: - build_type: pull-request - script: ci/build_wheel_cuopt_server.sh - package-name: cuopt_server - package-type: python - matrix_filter: map(select((.CUDA_VER | startswith("12")))) - wheel-build-cuopt-sh-client: - secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-25.08 - with: - build_type: pull-request - script: ci/build_wheel_cuopt_sh_client.sh - matrix_filter: map(select((.CUDA_VER | startswith("12")))) - package-name: cuopt_sh_client - package-type: python - append-cuda-suffix: false - wheel-tests-cuopt-server: - needs: [wheel-build-cuopt-server, changed-files] - secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-25.08 - #if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python_cuopt_server - with: - build_type: pull-request - script: ci/test_wheel_cuopt_server.sh - matrix_filter: map(select((.CUDA_VER | startswith("12")))) - test-self-hosted-server: - needs: [wheel-build-cuopt-server, changed-files] - secrets: inherit - uses: ./.github/workflows/self_hosted_service_test.yaml - #if: fromJSON(needs.changed-files.outputs.changed_file_groups).test_python - with: - build_type: pull-request - script: ci/test_self_hosted_service.sh + build-images: + runs-on: ubuntu-latest + steps: + - name: Checkout code repo + uses: actions/checkout@v3 + with: + ref: ${{ inputs.sha }} + fetch-depth: 0 # unshallow fetch for setuptools-scm + persist-credentials: false + - name: build service + env: + GH_TOKEN: ${{ github.token }} + run: | + gh workflow run build_test_publish_images.yml \ + -f branch="branch-25.08" \ + -f sha="e0dc603" \ + -f date="2025-07-02" \ + -f build_type="nightly" From be5f42c6962ed0ce8ed8bc5711f0946a028fcaef Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Thu, 3 Jul 2025 10:19:53 -0500 Subject: [PATCH 11/12] fix --- .github/workflows/pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 94a37b7e62..f5f8e0ef46 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -23,7 +23,7 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - gh workflow run build_test_publish_images.yml \ + gh workflow run build_test_publish_images.yml --ref pull-request/180 \ -f branch="branch-25.08" \ -f sha="e0dc603" \ -f date="2025-07-02" \ From e9dad7f16542f0308705ee937dbd7f1e22b26403 Mon Sep 17 00:00:00 2001 From: Ramakrishna Prabhu Date: Thu, 3 Jul 2025 10:35:49 -0500 Subject: [PATCH 12/12] test workflow --- .github/workflows/pr.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index f5f8e0ef46..7db270e1e3 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -23,7 +23,8 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - gh workflow run build_test_publish_images.yml --ref pull-request/180 \ + gh workflow run build_test_publish_images.yml --repo NVIDIA/cuopt \ + --ref add_nightly_container_support \ -f branch="branch-25.08" \ -f sha="e0dc603" \ -f date="2025-07-02" \