-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add dist/inplace python build scripts and improve rapids-generate-scr…
…ipts performance
- Loading branch information
Showing
5 changed files
with
122 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
features/src/rapids-build-utils/opt/rapids-build-utils/bin/tmpl/python-build-dist.tmpl.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#! /usr/bin/env bash | ||
|
||
build_${PY_LIB}_python_dist() { | ||
|
||
echo "python dist builds not yet implemented"; | ||
exit 1; | ||
} | ||
|
||
if test -n "${rapids_build_utils_debug:-}"; then | ||
PS4="+ ${BASH_SOURCE[0]}:\${LINENO} "; set -x; | ||
fi | ||
|
||
build_${PY_LIB}_python_dist "$@"; |
74 changes: 74 additions & 0 deletions
74
features/src/rapids-build-utils/opt/rapids-build-utils/bin/tmpl/python-build-inplace.tmpl.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#! /usr/bin/env bash | ||
|
||
build_${PY_LIB}_python_inplace() { | ||
|
||
set -euo pipefail; | ||
|
||
if [[ ! -d ~/${PY_SRC} ]]; then | ||
exit 1; | ||
fi | ||
|
||
local verbose=""; | ||
local parallel=""; | ||
|
||
eval "$( \ | ||
devcontainer-utils-parse-args --names ' | ||
a|archs | | ||
j|parallel | | ||
v|verbose | | ||
m|max-device-obj-memory-usage | | ||
' - <<< "$@" \ | ||
| xargs -r -d'\n' -I% echo -n local %\; \ | ||
)"; | ||
|
||
verbose="${v:-${verbose:-}}"; | ||
parallel="${j:-${parallel:-${JOBS:-${PARALLEL_LEVEL:-$(nproc --ignore=2)}}}}"; | ||
|
||
local cmake_args=(); | ||
|
||
if test -n "${verbose}"; then | ||
cmake_args+=("--log-level=VERBOSE"); | ||
fi | ||
|
||
cmake_args+=(${CMAKE_ARGS:-}); | ||
cmake_args+=(${CPP_DEPS}); | ||
cmake_args+=(${CPP_ARGS}); | ||
cmake_args+=(${__rest__[@]}); | ||
|
||
local ninja_args=(); | ||
if test -n "${verbose}"; then | ||
ninja_args+=("-v"); | ||
fi | ||
if test -n "${parallel}"; then | ||
if [ "${parallel:-}" = "true" ]; then | ||
parallel=""; | ||
fi | ||
ninja_args+=("-j${parallel}"); | ||
fi | ||
|
||
local pip_args=(); | ||
if test -n "${verbose}"; then | ||
pip_args+=("-vv"); | ||
fi | ||
pip_args+=("--no-build-isolation"); | ||
pip_args+=("--no-deps"); | ||
pip_args+=("--editable"); | ||
pip_args+=(~/"${PY_SRC}"); | ||
cmake_args+=("-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON"); | ||
|
||
trap "rm -rf ~/'${PY_SRC}/$(echo "${PY_LIB}" | tr '-' '_').egg-info'" EXIT; | ||
|
||
time \ | ||
CMAKE_GENERATOR="Ninja" \ | ||
CMAKE_ARGS="${cmake_args[@]}" \ | ||
SKBUILD_BUILD_OPTIONS="${ninja_args[@]}" \ | ||
SETUPTOOLS_ENABLE_FEATURES="legacy-editable" \ | ||
python -m pip install ${pip_args[@]} \ | ||
; | ||
} | ||
|
||
if test -n "${rapids_build_utils_debug:-}"; then | ||
PS4="+ ${BASH_SOURCE[0]}:\${LINENO} "; set -x; | ||
fi | ||
|
||
build_${PY_LIB}_python_inplace "$@"; |
67 changes: 10 additions & 57 deletions
67
features/src/rapids-build-utils/opt/rapids-build-utils/bin/tmpl/python-build.tmpl.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,27 @@ | ||
#! /usr/bin/env bash | ||
|
||
build_${PY_LIB}_python() { | ||
|
||
set -euo pipefail; | ||
|
||
if [[ ! -d ~/${PY_SRC} ]]; then | ||
exit 1; | ||
fi | ||
|
||
local verbose=""; | ||
local parallel=""; | ||
build_${PY_LIB}_python_dist() { | ||
|
||
# pull out the --rapids-dist or --rapids-inplace args (if any) | ||
eval "$( \ | ||
devcontainer-utils-parse-args --names ' | ||
a|archs | | ||
j|parallel | | ||
v|verbose | | ||
m|max-device-obj-memory-usage | | ||
rapids-dist | | ||
rapids-inplace | | ||
' - <<< "$@" \ | ||
| xargs -r -d'\n' -I% echo -n local %\; \ | ||
)"; | ||
|
||
verbose="${v:-${verbose:-}}"; | ||
parallel="${j:-${parallel:-${JOBS:-${PARALLEL_LEVEL:-$(nproc --ignore=2)}}}}"; | ||
# check if rapids_dist is set. | ||
|
||
local cmake_args=(); | ||
|
||
if test -n "${verbose}"; then | ||
cmake_args+=("--log-level=VERBOSE"); | ||
if [[ ! -z ${rapids_dist+x} ]]; then | ||
build-${PY_LIB}-python-dist ${__rest__[@]}; | ||
else | ||
build-${PY_LIB}-python-inplace ${__rest__[@]}; | ||
fi | ||
|
||
cmake_args+=(${CMAKE_ARGS:-}); | ||
cmake_args+=(${CPP_DEPS}); | ||
cmake_args+=(${CPP_ARGS}); | ||
cmake_args+=(${__rest__[@]}); | ||
|
||
local ninja_args=(); | ||
if test -n "${verbose}"; then | ||
ninja_args+=("-v"); | ||
fi | ||
if test -n "${parallel}"; then | ||
if [ "${parallel:-}" = "true" ]; then | ||
parallel=""; | ||
fi | ||
ninja_args+=("-j${parallel}"); | ||
fi | ||
|
||
local pip_args=(); | ||
if test -n "${verbose}"; then | ||
pip_args+=("-vv"); | ||
fi | ||
pip_args+=("--no-build-isolation"); | ||
pip_args+=("--no-deps"); | ||
pip_args+=("--editable"); | ||
pip_args+=(~/"${PY_SRC}"); | ||
cmake_args+=("-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON"); | ||
|
||
trap "rm -rf ~/'${PY_SRC}/$(echo "${PY_LIB}" | tr '-' '_').egg-info'" EXIT; | ||
|
||
time \ | ||
CMAKE_GENERATOR="Ninja" \ | ||
CMAKE_ARGS="${cmake_args[@]}" \ | ||
SKBUILD_BUILD_OPTIONS="${ninja_args[@]}" \ | ||
SETUPTOOLS_ENABLE_FEATURES="legacy-editable" \ | ||
python -m pip install ${pip_args[@]} \ | ||
; | ||
} | ||
|
||
if test -n "${rapids_build_utils_debug:-}"; then | ||
PS4="+ ${BASH_SOURCE[0]}:\${LINENO} "; set -x; | ||
fi | ||
|
||
build_${PY_LIB}_python "$@"; | ||
build_${PY_LIB}_python_dist "$@"; |