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] Open source nvgraph in cugraph repository #194

Merged
merged 19 commits into from
Apr 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[submodule "cpp/nvgraph/cpp/thirdparty/cnmem"]
path = cpp/nvgraph/cpp/thirdparty/cnmem
url = https://github.com/NVIDIA/cnmem.git
branch = master
[submodule "cpp/nvgraph/cpp/thirdparty/cub"]
path = cpp/nvgraph/cpp/thirdparty/cub
url = https://github.com/NVlabs/cub.git
branch = 1.8.0
[submodule "cpp/nvgraph/external/cusp"]
path = cpp/nvgraph/external/cusp
url = https://github.com/cusplibrary/cusplibrary.git
branch = cuda9
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
## Improvements
- PR #157 Removed cudatoolkit dependency in setup.py
- PR #185 Update docs version
- PR #194 Open source nvgraph in cugraph repository #194
- PR #190 Added a copy option in graph creation
- PR #196 Fix typos in readme intro


## Bug Fixes
- PR #169 Disable terminal output in sssp
- PR #191 Fix double upload bug
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ conda activate cugraph_dev

3) Build and install `libcugraph`. CMake depends on the `nvcc` executable being on your path or defined in `$CUDACXX`.

This project uses cmake for building the C/C++ library. To configure cmake, run:
This project uses cmake for building the C/C++ library. CMake will also automatically build and install nvGraph library (`$CUGRAPH_HOME/cpp/nvgraph`) which may take a few minutes. To configure cmake, run:

```bash
# Set the localtion to cuGraph in an environment variable CUGRAPH_HOME
Expand Down Expand Up @@ -320,8 +320,9 @@ unset LD_LIBRARY_PATH



## nvGraph


The nvGraph library is now open source and part of cuGraph. It can be build as a stand alone by following nvgraph's [readme](cpp/nvgraph/).


------
Expand Down
21 changes: 8 additions & 13 deletions ci/cpu/cugraph/upload-anaconda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,18 @@

set -e

if [ "$BUILD_CUGRAPH" == "1" ]; then
if [ "$BUILD_ABI" == "1" ]; then
export UPLOADFILE=`conda build conda/recipes/cugraph -c rapidsai -c nvidia -c numba -c conda-forge -c defaults --python=$PYTHON --output`
else
export UPLOADFILE=`conda build conda/recipes/cugraph -c rapidsai/label/cf201901 -c nvidia/label/cf201901 -c numba -c conda-forge/label/cf201901 -c defaults --python=$PYTHON --output`
fi
if [ "$UPLOAD_CUGRAPH" == "1" ]; then
export UPLOADFILE=`conda build conda/recipes/cugraph -c rapidsai -c nvidia -c numba -c conda-forge -c defaults --python=$PYTHON --output`

SOURCE_BRANCH=master

# Have to label all CUDA versions due to the compatibility to work with any CUDA
if [ "$LABEL_MAIN" == "1" -a "$BUILD_ABI" == "1" ]; then
if [ "$LABEL_MAIN" == "1" ]; then
LABEL_OPTION="--label main --label cuda9.2 --label cuda10.0"
elif [ "$LABEL_MAIN" == "0" -a "$BUILD_ABI" == "1" ]; then
elif [ "$LABEL_MAIN" == "0" ]; then
LABEL_OPTION="--label dev --label cuda9.2 --label cuda10.0"
elif [ "$LABEL_MAIN" == "1" -a "$BUILD_ABI" == "0" ]; then
LABEL_OPTION="--label cf201901 --label cf201901-cuda9.2 --label cf201901-cuda10.0"
elif [ "$LABEL_MAIN" == "0" -a "$BUILD_ABI" == "0" ]; then
LABEL_OPTION="--label cf201901-dev --label cf201901-cuda9.2 --label cf201901-cuda10.0"
else
echo "Unknown label configuration LABEL_MAIN='$LABEL_MAIN' BUILD_ABI='$BUILD_ABI'"
echo "Unknown label configuration LABEL_MAIN='$LABEL_MAIN'"
exit 1
fi
echo "LABEL_OPTION=${LABEL_OPTION}"
Expand All @@ -44,4 +36,7 @@ if [ "$BUILD_CUGRAPH" == "1" ]; then
echo "Upload"
echo ${UPLOADFILE}
anaconda -t ${MY_UPLOAD_KEY} upload -u ${CONDA_USERNAME:-rapidsai} ${LABEL_OPTION} --force ${UPLOADFILE}
else
echo "Skipping cugraph upload"
return 0
fi
20 changes: 7 additions & 13 deletions ci/cpu/libcugraph/upload-anaconda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,23 @@

set -e

if [ "$BUILD_LIBCUGRAPH" == "1" ]; then
if [ "$UPLOAD_LIBCUGRAPH" == "1" ]; then
CUDA_REL=${CUDA:0:3}
if [ "${CUDA:0:2}" == '10' ]; then
# CUDA 10 release
CUDA_REL=${CUDA:0:4}
fi

if [ "$BUILD_ABI" == "1" ]; then
export UPLOADFILE=`conda build conda/recipes/libcugraph -c rapidsai -c nvidia -c numba -c conda-forge -c defaults --python=$PYTHON --output`
else
export UPLOADFILE=`conda build conda/recipes/libcugraph -c rapidsai/label/cf201901 -c nvidia/label/cf201901 -c numba -c conda-forge/label/cf201901 -c defaults --python=$PYTHON --output`
fi
export UPLOADFILE=`conda build conda/recipes/libcugraph -c rapidsai -c nvidia -c numba -c conda-forge -c defaults --python=$PYTHON --output`

SOURCE_BRANCH=master

if [ "$LABEL_MAIN" == "1" -a "$BUILD_ABI" == "1" ]; then
if [ "$LABEL_MAIN" == "1" ]; then
LABEL_OPTION="--label main --label cuda${CUDA_REL}"
elif [ "$LABEL_MAIN" == "0" -a "$BUILD_ABI" == "1" ]; then
elif [ "$LABEL_MAIN" == "0" ]; then
LABEL_OPTION="--label dev --label cuda${CUDA_REL}"
elif [ "$LABEL_MAIN" == "1" -a "$BUILD_ABI" == "0" ]; then
LABEL_OPTION="--label cf201901 --label cf201901-cuda${CUDA_REL}"
elif [ "$LABEL_MAIN" == "0" -a "$BUILD_ABI" == "0" ]; then
LABEL_OPTION="--label cf201901-dev --label cf201901-cuda${CUDA_REL}"
else
echo "Unknown label configuration LABEL_MAIN='$LABEL_MAIN' BUILD_ABI='$BUILD_ABI'"
echo "Unknown label configuration LABEL_MAIN='$LABEL_MAIN'"
exit 1
fi
echo "LABEL_OPTION=${LABEL_OPTION}"
Expand All @@ -49,4 +41,6 @@ if [ "$BUILD_LIBCUGRAPH" == "1" ]; then
echo "Upload"
echo ${UPLOADFILE}
anaconda -t ${MY_UPLOAD_KEY} upload -u ${CONDA_USERNAME:-rapidsai} ${LABEL_OPTION} --force ${UPLOADFILE}
else
echo "Skipping libcugraph upload"
fi
10 changes: 6 additions & 4 deletions ci/cpu/prebuild.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#!/usr/bin/env bash

export BUILD_ABI=1
export BUILD_CUGRAPH=1
export BUILD_LIBCUGRAPH=1

if [[ "$CUDA" == "9.2" ]]; then
export BUILD_CUGRAPH=1
export UPLOAD_CUGRAPH=1
else
export BUILD_CUGRAPH=0
export UPLOAD_CUGRAPH=0
fi

if [[ "$PYTHON" == "3.6" ]]; then
export BUILD_LIBCUGRAPH=1
export UPLOAD_LIBCUGRAPH=1
else
export BUILD_LIBCUGRAPH=0
export UPLOAD_LIBCUGRAPH=0
fi
1 change: 0 additions & 1 deletion conda/environments/cugraph_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ channels:
- defaults
dependencies:
- cudf>=0.5.1
- nvgraph
- scipy
- networkx
- python-louvain
Expand Down
1 change: 0 additions & 1 deletion conda/environments/cugraph_dev_cuda10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ channels:
- defaults
dependencies:
- cudf>=0.5.1
- nvgraph
- scipy
- networkx
- python-louvain
Expand Down
1 change: 0 additions & 1 deletion conda/environments/cugraph_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ channels:
- defaults
dependencies:
- cudf=0.6
- nvgraph
- scipy
- networkx
- python-louvain
Expand Down
1 change: 0 additions & 1 deletion conda/environments/cugraph_nightly_cuda10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ channels:
- defaults
dependencies:
- cudf=0.6
- nvgraph
- scipy
- networkx
- python-louvain
Expand Down
14 changes: 9 additions & 5 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ message(STATUS "CMAKE_CUDA_FLAGS: ${CMAKE_CUDA_FLAGS}")
# - cmake custom modules --------------------------------------------------------------------------
include(ConfigureGoogleTest)

# speedup build time by avoiding features that are not exposed
set(NVGRAPH_LIGHT True)
# build nvgraph
include(ConfigureNvgraph)

###################################################################################################
# - Find and add different modules and supporting repos -------------------------------------------
find_package(Boost 1.45.0 COMPONENTS system)
Expand Down Expand Up @@ -186,12 +191,11 @@ endif (RMM_INCLUDE AND RMM_LIBRARY)

###################################################################################################
# - add nvgraph -----------------------------------------------------------------------------------

find_path(NVGRAPH_INCLUDE "nvgraph"
HINTS "$ENV{NVGRAPH_ROOT}/include"
"$ENV{CONDA_PREFIX}/include")
find_library(NVGRAPH_LIBRARY "nvgraph_st"
HINTS "$ENV{NVGRAPH_ROOT}/lib"
"$ENV{CONDA_PREFIX}/lib")
HINTS "$ENV{CONDA_PREFIX}/include")
find_library(NVGRAPH_LIBRARY "nvgraph_rapids"
HINTS "$ENV{CONDA_PREFIX}/lib")

add_library( nvgraph SHARED IMPORTED)
if (NVGRAPH_INCLUDE AND NVGRAPH_LIBRARY)
Expand Down
65 changes: 65 additions & 0 deletions cpp/cmake/Modules/ConfigureNvgraph.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
set(NVGRAPH_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/nvgraph")

set(NVGRAPH_CMAKE_ARGS "")
#" -DNVGRAPH_build_samples=ON"
#" -DCMAKE_VERBOSE_MAKEFILE=ON")

if(NOT CMAKE_CXX11_ABI)
message(STATUS "NVGRAPH: Disabling the GLIBCXX11 ABI")
list(APPEND NVGRAPH_CMAKE_ARGS " -DCMAKE_C_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0")
list(APPEND NVGRAPH_CMAKE_ARGS " -DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0")
elseif(CMAKE_CXX11_ABI)
message(STATUS "NVGRAPH: Enabling the GLIBCXX11 ABI")
list(APPEND NVGRAPH_CMAKE_ARGS " -DCMAKE_C_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=1")
list(APPEND NVGRAPH_CMAKE_ARGS " -DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=1")
endif(NOT CMAKE_CXX11_ABI)

#configure_file("${CMAKE_SOURCE_DIR}/cmake/Templates/Nvgraph.CMakeLists.txt.cmake"
# "${NVGRAPH_ROOT}/cpp/CMakeLists.txt")

file(MAKE_DIRECTORY "${NVGRAPH_ROOT}/cpp/build")
#file(MAKE_DIRECTORY "${NVGRAPH_ROOT}/install")

execute_process(COMMAND ${CMAKE_COMMAND} -G ${CMAKE_GENERATOR} .. -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DNVGRAPH_LIGHT=${NVGRAPH_LIGHT}
RESULT_VARIABLE NVGRAPH_CONFIG
WORKING_DIRECTORY ${NVGRAPH_ROOT}/cpp/build)

if(NVGRAPH_CONFIG)
message(FATAL_ERROR "Configuring nvgraph failed: " ${NVGRAPH_CONFIG})
endif(NVGRAPH_CONFIG)

set(PARALLEL_BUILD -j)
if($ENV{PARALLEL_LEVEL})
set(NUM_JOBS $ENV{PARALLEL_LEVEL})
set(PARALLEL_BUILD "${PARALLEL_BUILD}${NUM_JOBS}")
endif($ENV{PARALLEL_LEVEL})

if(${NUM_JOBS})
if(${NUM_JOBS} EQUAL 1)
message(STATUS "NVGRAPH BUILD: Enabling Sequential CMake build")
elseif(${NUM_JOBS} GREATER 1)
message(STATUS "NVGRAPH BUILD: Enabling Parallel CMake build with ${NUM_JOBS} jobs")
endif(${NUM_JOBS} EQUAL 1)
else()
message(STATUS "NVGRAPH BUILD: Enabling Parallel CMake build with all threads")
endif(${NUM_JOBS})

execute_process(COMMAND ${CMAKE_COMMAND} --build . -- ${PARALLEL_BUILD}
RESULT_VARIABLE NVGRAPH_BUILD
WORKING_DIRECTORY ${NVGRAPH_ROOT}/cpp/build)
if(NVGRAPH_BUILD)
message(FATAL_ERROR "Building nvgraph failed: " ${NVGRAPH_BUILD})
endif(NVGRAPH_BUILD)

execute_process(COMMAND ${CMAKE_COMMAND} --build . --target install
RESULT_VARIABLE NVGRAPH_BUILD
WORKING_DIRECTORY ${NVGRAPH_ROOT}/cpp/build)

if(NVGRAPH_BUILD)
message(FATAL_ERROR "Installing nvgraph failed: " ${NVGRAPH_BUILD})
endif(NVGRAPH_BUILD)

message(STATUS "nvgraph installed under: " ${CMAKE_INSTALL_PREFIX})
set(NVGRAPH_INCLUDE "${CMAKE_INSTALL_PREFIX}/include/nvgraph.h ${CMAKE_INSTALL_PREFIX}/include/test_opt_utils.cuh")
set(NVGRAPH_LIBRARY "${CMAKE_INSTALL_PREFIX}/lib/libnvgraph_rapids.so")
set(NVGRAPH_FOUND TRUE)
103 changes: 103 additions & 0 deletions cpp/nvgraph/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# <div align="left"><img src="../../img/rapids_logo.png" width="90px"/>&nbsp;nvgraph - NVIDIA graph library</div>

Data analytics is a growing application of high-performance computing. Many advanced data analytics problems can be couched as graph problems. In turn, many of the common graph problems today can be couched as sparse linear algebra. This is the motivation for nvGRAPH, which harnesses the power of GPUs for linear algebra to handle large graph analytics and big data analytics problems.

## Development Setup

### Conda{#conda}

It is easy to install nvGraph using conda. You can get a minimal conda installation with [Miniconda](https://conda.io/miniconda.html) or get the full installation with [Anaconda](https://www.anaconda.com/download).

Install and update nvGraph using the conda command:

```bash
# CUDA 9.2
conda install -c nvidia nvgraph

# CUDA 10.0
conda install -c nvidia/label/cuda10.0 nvgraph

```

Note: This conda installation only applies to Linux and Python versions 3.6/3.7.

### Build from Source {#source}

The following instructions are for developers and contributors to nvGraph OSS development. These instructions are tested on Linux Ubuntu 16.04 & 18.04. Use these instructions to build nvGraph from source and contribute to its development. Other operating systems may be compatible, but are not currently tested.

The nvGraph package is a C/C++ CUDA library. It needs to be installed in order for nvGraph to operate correctly.

The following instructions are tested on Linux systems.


#### Prerequisites

Compiler requirement:

* `gcc` version 5.4+
* `nvcc` version 9.2
* `cmake` version 3.12



CUDA requirement:

* CUDA 9.2+
* NVIDIA driver 396.44+
* Pascal architecture or better

You can obtain CUDA from [https://developer.nvidia.com/cuda-downloads](https://developer.nvidia.com/cuda-downloads).
Compiler requirements:


#### Build and Install the C/C++ CUDA components

To install cuGraph from source, ensure the dependencies are met and follow the steps below:

1) Clone the repository and submodules

```bash
# Set the localtion to cuGraph in an environment variable CUGRAPH_HOME
export CUGRAPH_HOME=$(pwd)/cugraph

# Download the cuGraph repo
git clone https://github.com/rapidsai/cugraph.git $CUGRAPH_HOME

# Next load all the submodules
cd $CUGRAPH_HOME
git submodule update --init --recursive
```

2) Build and install `libnvgraph_rapids.so`. CMake depends on the `nvcc` executable being on your path or defined in `$CUDACXX`.

This project uses cmake for building the C/C++ library. To configure cmake, run:

```bash
cd $CUGRAPH_HOME
cd cpp/nvgraph/cpp # enter nvgraph's cpp directory
mkdir build # create build directory
cd build # enter the build directory
cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX

# now build the code
make -j # "-j" starts multiple threads
make install # install the libraries
```

The default installation locations are `$CMAKE_INSTALL_PREFIX/lib` and `$CMAKE_INSTALL_PREFIX/include/nvgraph` respectively.

#### C++ stand alone tests

```bash
# Run the cugraph tests
cd $CUGRAPH_HOME
cd cpp/nvgraph/cpp/build
gtests/NVGRAPH_TEST # this is an executable file
```
Other test executables require specific datasets and will result in failure if they are not present.
## Documentation

The C API documentation can be found in the [CUDA Toolkit Documentation](https://docs.nvidia.com/cuda/nvgraph/index.html).



Loading