Skip to content

Commit 4ec890f

Browse files
authored
use installed C++ RMM in python build (rapidsai#588)
* build/python: don't pass --library-dir argument For all I can tell it's not actually recognized by setuptools, nor actually used, and in any case, there is no more actual library. * build/python: add fallback to INSTALL_PREFIX * build/python: use installed location of C++ RMM for python build Various existing hardcoded paths were not actually used anymore, this is generally cleaner, and importantly, if the C++ build pulled in external dependencies that were not locally installed, this will ensure that these are used in the python build. * changelog * autopep8 * reformat via black * reformat again with black-19.10b0 * review feedback: don't require INSTALL_PREFIX to be set If it is not set, fall back to using the uninstalled headers in the source tree.
1 parent d84dfed commit 4ec890f

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
- PR #581 Improve logging documentation
4747
- PR #585 Update ci/local/README.md
4848
- PR #587 Replaced `move` with `std::move`
49+
- PR #588 Use installed C++ RMM in python build
4950

5051
## Bug Fixes
5152

build.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ PER_THREAD_DEFAULT_STREAM=OFF
4545
RAN_CMAKE=0
4646

4747
# Set defaults for vars that may not have been defined externally
48-
# FIXME: if INSTALL_PREFIX is not set, check PREFIX, then check
49-
# CONDA_PREFIX, but there is no fallback from there!
50-
INSTALL_PREFIX=${INSTALL_PREFIX:=${PREFIX:=${CONDA_PREFIX}}}
48+
# If INSTALL_PREFIX is not set, check PREFIX, then check
49+
# CONDA_PREFIX, then fall back to install inside of $LIBRMM_BUILD_DIR
50+
INSTALL_PREFIX=${INSTALL_PREFIX:=${PREFIX:=${CONDA_PREFIX:=$LIBRMM_BUILD_DIR/install}}}
5151
PARALLEL_LEVEL=${PARALLEL_LEVEL:=""}
5252

5353
function hasArg {
@@ -131,14 +131,15 @@ fi
131131
# Build and install the rmm Python package
132132
if (( NUMARGS == 0 )) || hasArg rmm; then
133133
cd "${REPODIR}/python"
134+
export INSTALL_PREFIX
134135
if [[ ${INSTALL_TARGET} != "" ]]; then
135136
echo "building rmm..."
136-
python setup.py build_ext --inplace --library-dir="${LIBRMM_BUILD_DIR}"
137+
python setup.py build_ext --inplace
137138
echo "installing rmm..."
138139
python setup.py install --single-version-externally-managed --record=record.txt
139140
else
140141
echo "building rmm..."
141-
python setup.py build_ext --inplace --library-dir="${LIBRMM_BUILD_DIR}"
142+
python setup.py build_ext --inplace
142143
fi
143144

144145
fi

python/setup.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ def get_cuda_version_from_header(cuda_include_dir):
5252
cuda_lib_dir = os.path.join(CUDA_HOME, "lib64")
5353
CUDA_VERSION = get_cuda_version_from_header(cuda_include_dir)
5454

55+
INSTALL_PREFIX = os.environ.get("INSTALL_PREFIX", False)
56+
if os.path.isdir(INSTALL_PREFIX):
57+
rmm_include_dir = os.path.join(INSTALL_PREFIX, "include")
58+
else:
59+
# use uninstalled headers in source tree
60+
rmm_include_dir = "../include"
61+
5562
# Preprocessor step to specify correct pxd file with
5663
# valid symbols for specific version of CUDA.
5764

@@ -78,9 +85,7 @@ def get_cuda_version_from_header(cuda_include_dir):
7885
nthreads = 0
7986

8087
include_dirs = [
81-
"../include/rmm",
82-
"../include",
83-
"../build/include",
88+
rmm_include_dir,
8489
os.path.dirname(sysconfig.get_path("include")),
8590
cuda_include_dir,
8691
]

0 commit comments

Comments
 (0)