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

[REVIEW] use installed C++ RMM in python build #588

Merged
merged 11 commits into from
Oct 16, 2020
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
- PR #581 Improve logging documentation
- PR #585 Update ci/local/README.md
- PR #587 Replaced `move` with `std::move`
- PR #588 Use installed C++ RMM in python build

## Bug Fixes

Expand Down
11 changes: 6 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ PER_THREAD_DEFAULT_STREAM=OFF
RAN_CMAKE=0

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

function hasArg {
Expand Down Expand Up @@ -131,14 +131,15 @@ fi
# Build and install the rmm Python package
if (( NUMARGS == 0 )) || hasArg rmm; then
cd "${REPODIR}/python"
export INSTALL_PREFIX
if [[ ${INSTALL_TARGET} != "" ]]; then
echo "building rmm..."
python setup.py build_ext --inplace --library-dir="${LIBRMM_BUILD_DIR}"
python setup.py build_ext --inplace
echo "installing rmm..."
python setup.py install --single-version-externally-managed --record=record.txt
else
echo "building rmm..."
python setup.py build_ext --inplace --library-dir="${LIBRMM_BUILD_DIR}"
python setup.py build_ext --inplace
fi

fi
11 changes: 8 additions & 3 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ def get_cuda_version_from_header(cuda_include_dir):
cuda_lib_dir = os.path.join(CUDA_HOME, "lib64")
CUDA_VERSION = get_cuda_version_from_header(cuda_include_dir)

INSTALL_PREFIX = os.environ.get("INSTALL_PREFIX", False)
if not os.path.isdir(INSTALL_PREFIX):
raise OSError(
f"Invalid INSTALL_PREFIX: directory does not exist: {INSTALL_PREFIX}"
)
rmm_include_dir = os.path.join(INSTALL_PREFIX, "include")
germasch marked this conversation as resolved.
Show resolved Hide resolved

# Preprocessor step to specify correct pxd file with
# valid symbols for specific version of CUDA.

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

include_dirs = [
"../include/rmm",
"../include",
"../build/include",
rmm_include_dir,
os.path.dirname(sysconfig.get_path("include")),
cuda_include_dir,
]
Expand Down