Skip to content

Commit

Permalink
initial creation of libcugraph_etl.so (#1885)
Browse files Browse the repository at this point in the history
The new renumbering implementation will require C++ integration directly with cudf.  In order to facilitate that, but also support our customers that won't need cudf, this PR will create a separate library (`libcugraph_etl.so`) which will ultimately link with `libcudf.so` and contain the ETL portions of cugraph that require cudf features.

This way our other libcugraph customers that don't need to reference the new library will not need to install all of the cudf dependencies.

To seed this, the PR also includes a proposed API for the new renumbering capability.

Authors:
  - Chuck Hastings (https://github.com/ChuckHastings)
  - Rick Ratzel (https://github.com/rlratzel)

Approvers:
  - Seunghwa Kang (https://github.com/seunghwak)
  - https://github.com/chirayuG-nvidia
  - Rick Ratzel (https://github.com/rlratzel)
  - Jordan Jacobelli (https://github.com/Ethyling)

URL: #1885
  • Loading branch information
ChuckHastings authored Nov 16, 2021
1 parent 8096c53 commit e5b024e
Show file tree
Hide file tree
Showing 13 changed files with 492 additions and 10 deletions.
37 changes: 31 additions & 6 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,18 @@ ARGS=$*
# script, and that this script resides in the repo dir!
REPODIR=$(cd $(dirname $0); pwd)
LIBCUGRAPH_BUILD_DIR=${LIBCUGRAPH_BUILD_DIR:=${REPODIR}/cpp/build}
LIBCUGRAPH_ETL_BUILD_DIR=${LIBCUGRAPH_ETL_BUILD_DIR:=${REPODIR}/cpp/libcugraph_etl/build}

VALIDARGS="clean uninstall libcugraph cugraph pylibcugraph cpp-mgtests docs -v -g -n --allgpuarch --buildfaiss --show_depr_warn --skip_cpp_tests -h --help"
VALIDARGS="clean uninstall libcugraph libcugraph_etl cugraph pylibcugraph cpp-mgtests docs -v -g -n --allgpuarch --buildfaiss --show_depr_warn --skip_cpp_tests -h --help"
HELP="$0 [<target> ...] [<flag> ...]
where <target> is:
clean - remove all existing build artifacts and configuration (start over)
uninstall - uninstall libcugraph and cugraph from a prior build/install (see also -n)
libcugraph - build libcugraph.so and SG test binaries
libcugraph_etl - build libcugraph_etl.so and SG test binaries
cugraph - build the cugraph Python package
pylibcugraph - build the pylibcugraph Python package
cpp-mgtests - build libcugraph MG tests. Builds MPI communicator, adding MPI as a dependency.
cpp-mgtests - build libcugraph and libcugraph_etl MG tests. Builds MPI communicator, adding MPI as a dependency.
docs - build the docs
and <flag> is:
-v - verbose build mode
Expand All @@ -36,17 +38,17 @@ HELP="$0 [<target> ...] [<flag> ...]
--allgpuarch - build for all supported GPU architectures
--buildfaiss - build faiss statically into cugraph
--show_depr_warn - show cmake deprecation warnings
--skip_cpp_tests - do not build the SG test binaries as part of the libcugraph target
--skip_cpp_tests - do not build the SG test binaries as part of the libcugraph and libcugraph_etl targets
-h - print this text
default action (no args) is to build and install 'libcugraph' then 'cugraph' then 'docs' targets
default action (no args) is to build and install 'libcugraph' then 'libcugraph_etl' then 'pylibcugraph' then 'cugraph' then 'docs' targets
libcugraph build dir is: ${LIBCUGRAPH_BUILD_DIR}
Set env var LIBCUGRAPH_BUILD_DIR to override libcugraph build dir.
"
CUGRAPH_BUILD_DIR=${REPODIR}/python/build
BUILD_DIRS="${LIBCUGRAPH_BUILD_DIR} ${CUGRAPH_BUILD_DIR}"
BUILD_DIRS="${LIBCUGRAPH_BUILD_DIR} ${LIBCUGRAPH_ETL_BUILD_DIR} ${CUGRAPH_BUILD_DIR}"

# Set defaults for vars modified by flags to this script
VERBOSE_FLAG=""
Expand Down Expand Up @@ -119,9 +121,11 @@ if hasArg uninstall; then
# uninstall libcugraph
if [[ "$INSTALL_PREFIX" != "" ]]; then
rm -rf ${INSTALL_PREFIX}/include/cugraph
rm -rf ${INSTALL_PREFIX}/include/cugraph_c
rm -f ${INSTALL_PREFIX}/lib/libcugraph.so
rm -rf ${INSTALL_PREFIX}/include/cugraph_c
rm -f ${INSTALL_PREFIX}/lib/libcugraph_c.so
rm -rf ${INSTALL_PREFIX}/include/cugraph_etl
rm -f ${INSTALL_PREFIX}/lib/libcugraph_etl.so
fi
# This may be redundant given the above, but can also be used in case
# there are other installed files outside of the locations above.
Expand Down Expand Up @@ -187,6 +191,27 @@ if buildAll || hasArg libcugraph; then
cmake --build "${LIBCUGRAPH_BUILD_DIR}" -j${PARALLEL_LEVEL} --target ${INSTALL_TARGET} ${VERBOSE_FLAG}
fi

# Configure, build, and install libcugraph_etl
if buildAll || hasArg libcugraph_etl; then
if (( ${BUILD_ALL_GPU_ARCH} == 0 )); then
CUGRAPH_CMAKE_CUDA_ARCHITECTURES="NATIVE"
echo "Building for the architecture of the GPU in the system..."
else
CUGRAPH_CMAKE_CUDA_ARCHITECTURES="ALL"
echo "Building for *ALL* supported GPU architectures..."
fi
mkdir -p ${LIBCUGRAPH_ETL_BUILD_DIR}
cd ${LIBCUGRAPH_ETL_BUILD_DIR}
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
-DCMAKE_CUDA_ARCHITECTURES=${CUGRAPH_CMAKE_CUDA_ARCHITECTURES} \
-DDISABLE_DEPRECATION_WARNING=${BUILD_DISABLE_DEPRECATION_WARNING} \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DBUILD_TESTS=${BUILD_CPP_TESTS} \
-DBUILD_CUGRAPH_MG_TESTS=${BUILD_CPP_MG_TESTS} --log-level=VERBOSE \
${REPODIR}/cpp/libcugraph_etl
cmake --build "${LIBCUGRAPH_ETL_BUILD_DIR}" -j${PARALLEL_LEVEL} --target ${INSTALL_TARGET} ${VERBOSE_FLAG}
fi

# Build, and install pylibcugraph
if buildAll || hasArg pylibcugraph; then
cd ${REPODIR}/python/pylibcugraph
Expand Down
4 changes: 3 additions & 1 deletion ci/cpu/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@ conda config --set ssl_verify False
# BUILD - Conda package builds
###############################################################################

gpuci_logger "Build conda package for libcugraph"
gpuci_logger "Build conda package for libcugraph and libcugraph_etl"
if [ "$BUILD_LIBCUGRAPH" == '1' ]; then
if [[ -z "$PROJECT_FLASH" || "$PROJECT_FLASH" == "0" ]]; then
gpuci_conda_retry build --no-build-id --croot ${CONDA_BLD_DIR} conda/recipes/libcugraph
gpuci_conda_retry build --no-build-id --croot ${CONDA_BLD_DIR} conda/recipes/libcugraph_etl
else
gpuci_conda_retry build --no-build-id --croot ${CONDA_BLD_DIR} --dirty --no-remove-work-dir conda/recipes/libcugraph
gpuci_conda_retry build --no-build-id --croot ${CONDA_BLD_DIR} --dirty --no-remove-work-dir conda/recipes/libcugraph_etl
mkdir -p ${CONDA_BLD_DIR}/libcugraph/work
cp -r ${CONDA_BLD_DIR}/work/* ${CONDA_BLD_DIR}/libcugraph/work
fi
Expand Down
5 changes: 5 additions & 0 deletions ci/cpu/upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ fi
gpuci_logger "Get conda file output locations"

export LIBCUGRAPH_FILE=`conda build --no-build-id --croot ${CONDA_BLD_DIR} conda/recipes/libcugraph --output`
export LIBCUGRAPH_ETL_FILE=`conda build --no-build-id --croot ${CONDA_BLD_DIR} conda/recipes/libcugraph_etl --output`
export PYLIBCUGRAPH_FILE=`conda build --croot ${CONDA_BLD_DIR} conda/recipes/pylibcugraph --python=$PYTHON --output`
export CUGRAPH_FILE=`conda build --croot ${CONDA_BLD_DIR} conda/recipes/cugraph --python=$PYTHON --output`

Expand All @@ -45,6 +46,10 @@ if [[ "$BUILD_LIBCUGRAPH" == "1" && "$UPLOAD_LIBCUGRAPH" == "1" ]]; then
echo "Upload libcugraph"
echo ${LIBCUGRAPH_FILE}
gpuci_retry anaconda -t ${MY_UPLOAD_KEY} upload -u ${CONDA_USERNAME:-rapidsai} ${LABEL_OPTION} --skip-existing ${LIBCUGRAPH_FILE} --no-progress
test -e ${LIBCUGRAPH_ETL_FILE}
echo "Upload libcugraph_etl"
echo ${LIBCUGRAPH_ETL_FILE}
gpuci_retry anaconda -t ${MY_UPLOAD_KEY} upload -u ${CONDA_USERNAME:-rapidsai} ${LABEL_OPTION} --skip-existing ${LIBCUGRAPH_ETL_FILE} --no-progress
fi

if [[ "$BUILD_CUGRAPH" == "1" ]]; then
Expand Down
5 changes: 4 additions & 1 deletion ci/gpu/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ if [[ -z "$PROJECT_FLASH" || "$PROJECT_FLASH" == "0" ]]; then
gpuci_logger "Build from source"
$WORKSPACE/build.sh -v clean libcugraph pylibcugraph cugraph
else
export LIBCUGRAPH_BUILD_DIR="$WORKSPACE/ci/artifacts/cugraph/cpu/conda_work/cpp/build"
# ...cugraph/cpu/conda_work/... is the dir name when only 1 lib* library is
# present. For multiple libs (ie. libcugraph and libcugraph_etl), the
# "_work" dir is prefixed with the lib name.
export LIBCUGRAPH_BUILD_DIR="$WORKSPACE/ci/artifacts/cugraph/cpu/libcugraph_work/cpp/build"

# Faiss patch
echo "Update libcugraph.so"
Expand Down
8 changes: 6 additions & 2 deletions ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ fi
if [[ -z "$PROJECT_FLASH" || "$PROJECT_FLASH" == "0" ]]; then
cd ${CUGRAPH_ROOT}/cpp/build
else
export LD_LIBRARY_PATH="$WORKSPACE/ci/artifacts/cugraph/cpu/conda_work/cpp/build:$CONDA_PREFIX/lib:$LD_LIBRARY_PATH"
cd $WORKSPACE/ci/artifacts/cugraph/cpu/conda_work/cpp/build
# ...cugraph/cpu/conda_work/... is the dir name when only 1 lib* library is
# present. For multiple libs (ie. libcugraph and libcugraph_etl), the
# "_work" dir is prefixed with the lib name.
export LIBCUGRAPH_BUILD_DIR="$WORKSPACE/ci/artifacts/cugraph/cpu/libcugraph_work/cpp/build"
export LD_LIBRARY_PATH="$LIBCUGRAPH_BUILD_DIR:$CONDA_PREFIX/lib:$LD_LIBRARY_PATH"
cd $LIBCUGRAPH_BUILD_DIR
fi

# Do not abort the script on error from this point on. This allows all tests to
Expand Down
1 change: 1 addition & 0 deletions conda/recipes/libcugraph/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ requirements:
- cmake>=3.20.1
- cudatoolkit {{ cuda_version }}.*
- librmm {{ minor_version }}.*
- cudf {{ minor_version }}.*
- boost-cpp>=1.66
- nccl>=2.9.9
- ucx-proc=*=gpu
Expand Down
7 changes: 7 additions & 0 deletions conda/recipes/libcugraph_etl/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

# Copyright (c) 2021, NVIDIA CORPORATION.

# This assumes the script is executed from the root of the repo directory

./build.sh libcugraph_etl -v --allgpuarch
48 changes: 48 additions & 0 deletions conda/recipes/libcugraph_etl/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright (c) 2021, NVIDIA CORPORATION.

# Usage:
# conda build -c nvidia -c rapidsai -c conda-forge .
{% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').lstrip('v') + environ.get('VERSION_SUFFIX', '') %}
{% set minor_version = version.split('.')[0] + '.' + version.split('.')[1] %}
{% set cuda_version='.'.join(environ.get('CUDA', '9.2').split('.')[:2]) %}
package:
name: libcugraph_etl
version: {{ version }}

source:
git_url: ../../..

build:
number: {{ GIT_DESCRIBE_NUMBER }}
string: cuda{{ cuda_version }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
script_env:
- CC
- CXX
- CUDAHOSTCXX
- PARALLEL_LEVEL
- VERSION_SUFFIX
- CCACHE_DIR
- CCACHE_NOHASHDIR
- CCACHE_COMPILERCHECK
- CMAKE_GENERATOR
- CMAKE_C_COMPILER_LAUNCHER
- CMAKE_CXX_COMPILER_LAUNCHER
- CMAKE_CUDA_COMPILER_LAUNCHER

requirements:
build:
- cmake>=3.20.1
- cudatoolkit {{ cuda_version }}.*
- cudf {{ minor_version }}.*
- libcugraph {{ minor_version }}.*
run:
- {{ pin_compatible('cudatoolkit', max_pin='x.x') }}
- libcugraph {{ minor_version }}.*
- faiss-proc=*=cuda
- libfaiss 1.7.0 *_cuda

about:
home: http://rapids.ai/
license: Apache-2.0
license_file: ../../../LICENSE
summary: libcugraph_etl library
Loading

0 comments on commit e5b024e

Please sign in to comment.