Skip to content

Commit

Permalink
define envvars for scikit-build-core (#282)
Browse files Browse the repository at this point in the history
* define envvars for scikit-build-core

* use INFO not VERBOSE

* fix rapids-python-uses-scikit-build and rapids-python-uses-scikit-build-core

* adjust docstring spacing

* define SKBUILD_BUILD_TOOL_ARGS for scikit-build-core
  • Loading branch information
trxcllnt authored May 1, 2024
1 parent 7013588 commit c1b1a45
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 30 deletions.
2 changes: 1 addition & 1 deletion features/src/rapids-build-utils/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "NVIDIA RAPIDS devcontainer build utilities",
"id": "rapids-build-utils",
"version": "24.6.9",
"version": "24.6.10",
"description": "A feature to install the RAPIDS devcontainer build utilities",
"containerEnv": {
"BASH_ENV": "/etc/bash.bash_env"
Expand Down
15 changes: 11 additions & 4 deletions features/src/rapids-build-utils/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )";
# install global/common scripts
. ./common/install.sh;

check_packages bc jq pigz sudo wget gettext-base bash-completion ca-certificates;
PKGS=(bc jq pigz sudo wget gettext-base bash-completion ca-certificates);

if ! type /usr/bin/python3 >/dev/null 2>&1; then
PKGS+=(python3 python3-pip);
elif ! /usr/bin/python3 -m pip >/dev/null 2>&1; then
PKGS+=(python3-pip);
fi

check_packages "${PKGS[@]}";

# Install yq if not installed
if ! type yq >/dev/null 2>&1; then
Expand All @@ -30,9 +38,8 @@ if [[ ! "23.04" > "${DISTRIB_RELEASE}" ]]; then
fi

# Install the rapids dependency file generator and conda-merge
if type python >/dev/null 2>&1; then
python -m pip install $BREAK_PACKAGES rapids-dependency-file-generator conda-merge toml;
fi
/usr/bin/python3 -m pip install $BREAK_PACKAGES -U pip;
/usr/bin/python3 -m pip install $BREAK_PACKAGES rapids-dependency-file-generator conda-merge toml;

# Install RAPIDS build utility scripts to /opt/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
set -e;

test -f "${1}/pyproject.toml";
test "scikit_build_core.build" = "$(/usr/local/python/current/bin/python -c "import toml; print(toml.load('${1}/pyproject.toml')['build-system']['build-backend'])" 2>/dev/null)";
test "scikit_build_core.build" = "$(/usr/bin/python3 -c "import toml; print(toml.load('${1}/pyproject.toml')['build-system']['build-backend'])" 2>/dev/null)";
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
set -e;

test -f "${1}/pyproject.toml";
test "True" = "$(/usr/local/python/current/bin/python -c "import toml; print(any('scikit-build-core' not in x and 'scikit-build' in x for x in toml.load('${1}/pyproject.toml')['build-system']['requires']))" 2>/dev/null)";
test "True" = "$(/usr/bin/python3 -c "import toml; print(any('scikit-build-core' not in x and 'scikit-build' in x for x in toml.load('${1}/pyproject.toml')['build-system']['requires']))" 2>/dev/null)";
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#
# @_include_value_options rapids-get-num-archs-jobs-and-load -h;
# @_include_cmake_options;
# CMake Install Options:
# --strip Strip before installing.
#
# @_include_pip_wheel_options;
# @_include_pip_package_index_options;
# @_include_pip_general_options;
Expand Down Expand Up @@ -85,15 +88,22 @@ build_${PY_LIB}_python_wheel() {
export ${PY_ENV} PATH="$PATH";

local cudaflags="${CUDAFLAGS:+$CUDAFLAGS }-t=${n_arch}";
local build_type="$(rapids-select-cmake-build-type "${cmake_args_[@]}")";
local nvcc_append_flags="${NVCC_APPEND_FLAGS:+$NVCC_APPEND_FLAGS }-t=${n_arch}";

CUDAFLAGS="${cudaflags}" \
CMAKE_GENERATOR="${G:-Ninja}" \
PARALLEL_LEVEL="${n_jobs}" \
CMAKE_ARGS="${cmake_args[*]}" \
SKBUILD_BUILD_OPTIONS="${ninja_args[*]}" \
NVCC_APPEND_FLAGS="${nvcc_append_flags}" \
python -m pip wheel "${pip_args[@]}" \
CUDAFLAGS="${cudaflags}" \
CMAKE_GENERATOR="${G:-Ninja}" \
PARALLEL_LEVEL="${n_jobs}" \
CMAKE_ARGS="${cmake_args[*]}" \
SKBUILD_BUILD_OPTIONS="${ninja_args[*]}" \
SKBUILD_BUILD_TOOL_ARGS="${ninja_args[*]}" \
SKBUILD_LOGGING_LEVEL="${v:+INFO}" \
SKBUILD_INSTALL_STRIP="${strip:+True}" \
SKBUILD_CMAKE_VERBOSE="${v:+True}" \
SKBUILD_CMAKE_BUILD_TYPE="${build_type}" \
CMAKE_BUILD_PARALLEL_LEVEL="${n_jobs}" \
NVCC_APPEND_FLAGS="${nvcc_append_flags}" \
python -m pip wheel "${pip_args[@]}" \
;
{ set +x; } 2>/dev/null; echo -n "${PY_LIB} wheel build time:";
) 2>&1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#
# @_include_value_options rapids-get-num-archs-jobs-and-load -h;
# @_include_cmake_options;
# CMake Install Options:
# --strip Strip before installing.
#
# @_include_pip_install_options;
# @_include_pip_package_index_options;
# @_include_pip_general_options;
Expand Down Expand Up @@ -103,13 +106,20 @@ install_${PY_LIB}_python() {
export ${PY_ENV} PATH="$PATH";

local cudaflags="${CUDAFLAGS:+$CUDAFLAGS }-t=${n_arch}";
local build_type="$(rapids-select-cmake-build-type "${cmake_args_[@]}")";
local nvcc_append_flags="${NVCC_APPEND_FLAGS:+$NVCC_APPEND_FLAGS }-t=${n_arch}";

CUDAFLAGS="${cudaflags}" \
CMAKE_GENERATOR="${G:-Ninja}" \
PARALLEL_LEVEL="${n_jobs}" \
CMAKE_ARGS="${cmake_args[*]}" \
SKBUILD_BUILD_OPTIONS="${ninja_args[*]}" \
SKBUILD_BUILD_TOOL_ARGS="${ninja_args[*]}" \
SKBUILD_LOGGING_LEVEL="${v:+INFO}" \
SKBUILD_INSTALL_STRIP="${strip:+True}" \
SKBUILD_CMAKE_VERBOSE="${v:+True}" \
SKBUILD_CMAKE_BUILD_TYPE="${build_type}" \
CMAKE_BUILD_PARALLEL_LEVEL="${n_jobs}" \
NVCC_APPEND_FLAGS="${nvcc_append_flags}" \
python -m pip install "${pip_args[@]}" \
;
Expand Down
2 changes: 1 addition & 1 deletion features/src/utils/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "devcontainer-utils",
"id": "utils",
"version": "24.6.0",
"version": "24.6.1",
"description": "A feature to install RAPIDS devcontainer utility scripts",
"containerEnv": {
"BASH_ENV": "/etc/bash.bash_env"
Expand Down
37 changes: 22 additions & 15 deletions features/src/utils/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,27 @@ cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )";
# install global/common scripts
. ./common/install.sh;

check_packages \
jq \
cron \
curl \
sudo \
wget \
socat \
tzdata \
gettext-base \
openssh-client \
bash-completion \
ca-certificates ;
PKGS=(
jq
cron
curl
sudo
wget
socat
tzdata
gettext-base
openssh-client
bash-completion
ca-certificates
);

if ! type /usr/bin/python3 >/dev/null 2>&1; then
PKGS+=(python3 python3-pip);
elif ! /usr/bin/python3 -m pip >/dev/null 2>&1; then
PKGS+=(python3-pip);
fi

check_packages "${PKGS[@]}";

source /etc/lsb-release;

Expand All @@ -27,9 +36,7 @@ if [[ ! "23.04" > "${DISTRIB_RELEASE}" ]]; then
fi

# upgrade pip
if type python >/dev/null 2>&1; then
python -m pip install $BREAK_PACKAGES -U pip;
fi
/usr/bin/python3 -m pip install $BREAK_PACKAGES -U pip;

# Install yq if not installed
if ! type yq >/dev/null 2>&1; then
Expand Down

0 comments on commit c1b1a45

Please sign in to comment.