Skip to content

Commit

Permalink
Update dev Dockerfile and add GitHub action
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Howe <[email protected]>
  • Loading branch information
bmhowe23 committed Feb 5, 2025
1 parent f4b4a1e commit 66feb7d
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 9 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/build_dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build dev image

on:
workflow_dispatch:
inputs:
# FIXME
build_type:
type: choice
required: true
description: 'Build Type (ignored if using artifacts from prior run)'
default: 'Release'
options:
- 'Release'
- 'Debug'
#cudaq_wheels:
# type: choice
# required: true
# description: 'CUDA-Q wheel source (released version from PyPI or Custom built using .cudaq_version in repo)'
# default: 'Custom'
# options:
# - 'Custom'
# - 'PyPI'
#artifacts_from_run:
# type: string
# description: Optional argument to take artifacts from a prior run of this workflow; facilitates rerunning a failed workflow without re-building the artifacts.
# required: false

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-cudaqx-dev:
runs-on: linux-amd64-cpu16
name: Build CUDA-QX Dev Image
steps:
- name: Login to GitHub CR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}

- name: Set up context for buildx
run: |
docker context create builder_context
shell: bash --noprofile --norc -euo pipefail {0}

- name: Set up buildx runner
uses: docker/setup-buildx-action@v3
with:
endpoint: builder_context
driver-opts: network=host

- name: Build dev image
uses: docker/build-push-action@v5
with:
file: ./docker/build_env/Dockerfile
tags: ghcr.io/nvidia/cudaqx-dev:latest
platforms: linux/amd64,linux/arm64
#push: true
31 changes: 22 additions & 9 deletions docker/build_env/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,35 @@
# ============================================================================ #
# Copyright (c) 2024 NVIDIA Corporation & Affiliates. #
# Copyright (c) 2025 NVIDIA Corporation & Affiliates. #
# All rights reserved. #
# #
# This source code and the accompanying materials are made available under #
# the terms of the Apache License 2.0 which accompanies this distribution. #
# ============================================================================ #

FROM ghcr.io/nvidia/cuda-quantum-devdeps:ext-cu11.8-gcc11-main

RUN apt-get update && apt-get install -y gfortran libblas-dev libcusolver-dev-11-8 \
FROM ghcr.io/nvidia/cuda-quantum-devdeps:ext-cu12.0-gcc11-main

LABEL org.opencontainers.image.description="Dev tools for building and testing CUDA-QX libraries"
LABEL org.opencontainers.image.source="https://github.com/NVIDIA/cudaqx"
LABEL org.opencontainers.image.title="cuda-qx-dev"
LABEL org.opencontainers.image.url="https://github.com/NVIDIA/cudaqx"

RUN apt-get update && apt-get install -y gfortran libblas-dev jq cuda-nvtx-12-0 \
&& python3 -m pip install cmake --user \
&& apt-get autoremove -y --purge && apt-get clean && rm -rf /var/lib/apt/lists/*

RUN git clone https://github.com/nvidia/cuda-quantum \
&& cd cuda-quantum && mkdir build && cd build \
&& ~/.local/bin/cmake -G Ninja .. -DLLVM_DIR=/opt/llvm/lib/cmake \
-DCUDAQ_ENABLE_PYTHON=TRUE -DCMAKE_INSTALL_PREFIX=$HOME/.cudaq \
&& ninja install

COPY .cudaq_version /cudaq_version

RUN mkdir -p /workspaces/cudaq && cd /workspaces/cudaq \
&& git init \
&& CUDAQ_REPO=$(jq -r '.cudaq.repository' /cudaq_version) \
&& CUDAQ_COMMIT=$(jq -r '.cudaq.ref' /cudaq_version) \
&& git remote add origin https://github.com/${CUDAQ_REPO} \
&& git fetch -q --depth=1 origin ${CUDAQ_COMMIT} \
&& git reset --hard FETCH_HEAD \
&& bash scripts/build_cudaq.sh -v \
&& rm -rf build

#RUN mkdir -p /workspaces/cudaqx && cd /workspaces/cudaqx \
# && ~/.local/bin/cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCUDAQ_DIR=~/.cudaq/lib/cmake/cudaq .. \
# && ninja install

0 comments on commit 66feb7d

Please sign in to comment.