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

Update CI build_cudaq.sh to specify num parallel jobs #63

Merged
merged 1 commit into from
Jan 28, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/build_wheels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:

- name: Build CUDAQ toolchain
run: |
.github/workflows/scripts/build_cudaq.sh ${{ matrix.python }}
.github/workflows/scripts/build_cudaq.sh --python-version ${{ matrix.python }}
- name: Build CUDA-QX wheels
run: |
Expand Down
60 changes: 57 additions & 3 deletions .github/workflows/scripts/build_cudaq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,62 @@
# the terms of the Apache License 2.0 which accompanies this distribution. #
# ============================================================================ #

# ==============================================================================
# Handling options
# ==============================================================================

show_help() {
echo "Usage: $0 [options]"
echo "Options:"
echo " --python-version Python version to build wheel for (e.g. 3.10)"
echo " -j Number of parallel jobs to build CUDA-Q with"
echo " (e.g. 8)"
}

parse_options() {
while (( $# > 0 )); do
case "$1" in
--python-version)
if [[ -n "$2" && "$2" != -* ]]; then
python_version=("$2")
shift 2
else
echo "Error: Argument for $1 is missing" >&2
exit 1
fi
;;
-j)
if [[ -n "$2" && "$2" != -* ]]; then
num_par_jobs=("$2")
cudaq_ninja_jobs_arg="-j $num_par_jobs"
shift 2
else
echo "Error: Argument for $1 is missing" >&2
exit 1
fi
;;
-*)
echo "Error: Unknown option $1" >&2
show_help
exit 1
;;
*)
echo "Error: Unknown argument $1" >&2
show_help
exit 1
;;
esac
done
}

# Defaults
python_version=3.10
cudaq_ninja_jobs_arg=""

# Parse options
parse_options "$@"


export CUDA_VERSION=12.0

# We need to use a newer toolchain because CUDA-QX libraries rely on c++20
Expand All @@ -16,8 +72,6 @@ source /opt/rh/gcc-toolset-11/enable
export CC=gcc
export CXX=g++

python_version=$1
python_version=${python_version:-3.10}
python=python${python_version}
${python} -m pip install --no-cache-dir numpy auditwheel

Expand Down Expand Up @@ -69,5 +123,5 @@ echo "$CUDAQ_PATCH" | git apply --verbose

$python -m venv --system-site-packages .venv
source .venv/bin/activate
CUDAQ_BUILD_TESTS=FALSE bash scripts/build_cudaq.sh -v
CUDAQ_BUILD_TESTS=FALSE bash scripts/build_cudaq.sh -v ${cudaq_ninja_jobs_arg}

Loading