Skip to content

Commit 51a207e

Browse files
authored
Merge pull request #891 from rapidsai/branch-21.10
[RELEASE] rmm v21.10.01
2 parents 72ee41f + 11374c0 commit 51a207e

File tree

2 files changed

+37
-9
lines changed

2 files changed

+37
-9
lines changed

build.sh

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ARGS=$*
1919
REPODIR=$(cd $(dirname $0); pwd)
2020

2121
VALIDARGS="clean librmm rmm -v -g -n -s --ptds -h"
22-
HELP="$0 [clean] [librmm] [rmm] [-v] [-g] [-n] [-s] [--ptds] [-h]
22+
HELP="$0 [clean] [librmm] [rmm] [-v] [-g] [-n] [-s] [--ptds] [--cmake-args=\"<args>\"] [-h]
2323
clean - remove all existing build artifacts and configuration (start over)
2424
librmm - build and install the librmm C++ code
2525
rmm - build and install the rmm Python package
@@ -28,6 +28,7 @@ HELP="$0 [clean] [librmm] [rmm] [-v] [-g] [-n] [-s] [--ptds] [-h]
2828
-n - no install step
2929
-s - statically link against cudart
3030
--ptds - enable per-thread default stream
31+
--cmake-args=\\\"<args>\\\" - pass arbitrary list of CMake configuration options (escape all quotes in argument)
3132
-h - print this text
3233
3334
default action (no args) is to build and install 'librmm' and 'rmm' targets
@@ -54,16 +55,41 @@ function hasArg {
5455
(( NUMARGS != 0 )) && (echo " ${ARGS} " | grep -q " $1 ")
5556
}
5657

58+
function cmakeArgs {
59+
# Check for multiple cmake args options
60+
if [[ $(echo $ARGS | { grep -Eo "\-\-cmake\-args" || true; } | wc -l ) -gt 1 ]]; then
61+
echo "Multiple --cmake-args options were provided, please provide only one: ${ARGS}"
62+
exit 1
63+
fi
64+
65+
# Check for cmake args option
66+
if [[ -n $(echo $ARGS | { grep -E "\-\-cmake\-args" || true; } ) ]]; then
67+
# There are possible weird edge cases that may cause this regex filter to output nothing and fail silently
68+
# the true pipe will catch any weird edge cases that may happen and will cause the program to fall back
69+
# on the invalid option error
70+
CMAKE_ARGS=$(echo $ARGS | { grep -Eo "\-\-cmake\-args=\".+\"" || true; })
71+
if [[ -n ${CMAKE_ARGS} ]]; then
72+
# Remove the full CMAKE_ARGS argument from list of args so that it passes validArgs function
73+
ARGS=${ARGS//$CMAKE_ARGS/}
74+
# Filter the full argument down to just the extra string that will be added to cmake call
75+
CMAKE_ARGS=$(echo $CMAKE_ARGS | grep -Eo "\".+\"" | sed -e 's/^"//' -e 's/"$//')
76+
fi
77+
fi
78+
}
79+
80+
5781
# Runs cmake if it has not been run already for build directory
5882
# LIBRMM_BUILD_DIR
5983
function ensureCMakeRan {
6084
mkdir -p "${LIBRMM_BUILD_DIR}"
6185
if (( RAN_CMAKE == 0 )); then
6286
echo "Executing cmake for librmm..."
63-
cmake -DCMAKE_INSTALL_PREFIX="${INSTALL_PREFIX}" \
87+
cmake -B "${LIBRMM_BUILD_DIR}" -S . \
88+
-DCMAKE_INSTALL_PREFIX="${INSTALL_PREFIX}" \
6489
-DCUDA_STATIC_RUNTIME="${CUDA_STATIC_RUNTIME}" \
6590
-DPER_THREAD_DEFAULT_STREAM="${PER_THREAD_DEFAULT_STREAM}" \
66-
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} -B "${LIBRMM_BUILD_DIR}" -S .
91+
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
92+
${CMAKE_ARGS}
6793
RAN_CMAKE=1
6894
fi
6995
}
@@ -74,12 +100,14 @@ if hasArg -h; then
74100
fi
75101

76102
# Check for valid usage
77-
if (( NUMARGS != 0 )); then
103+
if (( ${NUMARGS} != 0 )); then
104+
# Check for cmake args
105+
cmakeArgs
78106
for a in ${ARGS}; do
79-
if ! (echo " ${VALIDARGS} " | grep -q " ${a} "); then
80-
echo "Invalid option: ${a}"
81-
exit 1
82-
fi
107+
if ! (echo " ${VALIDARGS} " | grep -q " ${a} "); then
108+
echo "Invalid option or formatting, check --help: ${a}"
109+
exit 1
110+
fi
83111
done
84112
fi
85113

conda/recipes/librmm/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Copyright (c) 2018-2019, NVIDIA CORPORATION.
22

33
# This assumes the script is executed from the root of the repo directory
4-
./build.sh -v clean librmm
4+
./build.sh -v clean librmm --cmake-args=\"-DCMAKE_INSTALL_LIBDIR=lib\"

0 commit comments

Comments
 (0)