-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a7f7f84
Showing
51 changed files
with
6,753 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
#============================================================================= | ||
# Copyright 2018 BlazingDB, Inc. | ||
# Copyright 2018 Percy Camilo Triveño Aucahuasi <[email protected]> | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
#============================================================================= | ||
|
||
# Usage: | ||
# $ mkdir build # create directory for out-of-source build | ||
# $ cd build # enter the build directory | ||
# $ cmake .. # configure build system | ||
# $ make # make libcugraph | ||
# $ make pytest # trigger test | ||
# $ make install # install libcugraph | ||
|
||
PROJECT(libcugraph) | ||
|
||
cmake_minimum_required(VERSION 2.8) # not sure about version required | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
message(STATUS "Using C++ standard: c++${CMAKE_CXX_STANDARD}") | ||
|
||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/" ${CMAKE_MODULE_PATH}) | ||
message(STATUS "CMAKE_MODULE_PATH:" "${CMAKE_MODULE_PATH}") | ||
|
||
#IF(CMAKE_COMPILER_IS_GNUCXX) | ||
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") | ||
#ENDIF(CMAKE_COMPILER_IS_GNUCXX) | ||
|
||
# Include CMake modules | ||
include(FeatureSummary) | ||
include(CheckIncludeFiles) | ||
include(CheckLibraryExists) | ||
include(CTest) | ||
|
||
# Include custom modules (see cmake directory) | ||
include(ConfigureGoogleTest) | ||
|
||
set(CUDA_USE_STATIC_CUDA_RUNTIME OFF CACHE INTERNAL "") | ||
|
||
find_package(CUDA) | ||
set_package_properties( | ||
CUDA PROPERTIES TYPE REQUIRED | ||
PURPOSE "NVIDIA CUDA® parallel computing platform and programming model." | ||
URL "https://developer.nvidia.com/cuda-zone") | ||
|
||
if(CUDA_FOUND) | ||
message(STATUS "CUDA ${CUDA_VERSION} found in ${CUDA_TOOLKIT_ROOT_DIR}") | ||
|
||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-std=c++11;--expt-extended-lambda; -Xcompiler -rdynamic -lineinfo) | ||
# Suppress SHFL warnings caused by modern GPU. | ||
# TODO: remove this when modern GPU is removed or fixed to use shfl_sync | ||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}; | ||
-Wno-deprecated-declarations; | ||
-Xptxas --disable-warnings) | ||
# set warnings as errors | ||
#set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-Werror cross-execution-space-call;-Xcompiler -Wall,-Werror,-Wno-error=sign-compare) | ||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-Werror cross-execution-space-call;-Xcompiler -Wall,-Wno-error=sign-compare) | ||
|
||
message(STATUS "CUDA_NVCC_FLAGS: ${CUDA_NVCC_FLAGS}") | ||
else() | ||
message(FATAL_ERROR "CUDA not found, please check your settings.") | ||
endif() | ||
|
||
find_package(Boost 1.45.0 COMPONENTS system) | ||
|
||
find_package(Git QUIET) | ||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../gunrock/") | ||
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --pretty=format:"%ad" --date=format:%Y%m%d%H%M%S OUTPUT_VARIABLE LATEST_COMMIT_DATE WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../gunrock/") | ||
set(REQUIRED_COMMIT_DATE "\"20181011022038\"") | ||
if(${REQUIRED_COMMIT_DATE} STRGREATER ${LATEST_COMMIT_DATE}) | ||
execute_process(COMMAND ${GIT_EXECUTABLE} checkout master "${CMAKE_CURRENT_SOURCE_DIR}/../gunrock/") | ||
execute_process(COMMAND ${GIT_EXECUTABLE} pull WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../gunrock/") | ||
endif() | ||
else() | ||
execute_process(COMMAND ${GIT_EXECUTABLE} clone --recursive https://github.com/gunrock/gunrock "${CMAKE_CURRENT_SOURCE_DIR}/../gunrock/") | ||
endif() | ||
|
||
include_directories( | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include" | ||
"${CUDA_INCLUDE_DIRS}" | ||
"$ENV{CONDA_PREFIX}/include/cudf" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/../gunrock/" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/../gunrock/externals/moderngpu/include" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/../gunrock/externals/cub" | ||
${Boost_INCLUDE_DIRS} | ||
) | ||
|
||
IF(CUDA_VERSION_MAJOR GREATER 7) | ||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-gencode;arch=compute_60,code=sm_60) | ||
ENDIF(CUDA_VERSION_MAJOR GREATER 7) | ||
|
||
IF(CUDA_VERSION_MAJOR GREATER 8) | ||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-gencode;arch=compute_70,code=sm_70) | ||
ENDIF(CUDA_VERSION_MAJOR GREATER 8) | ||
|
||
IF(CMAKE_BUILD_TYPE MATCHES DEBUG) | ||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-g;-G;-lineinfo) | ||
ENDIF(CMAKE_BUILD_TYPE MATCHES DEBUG) | ||
|
||
find_package(OpenMP) | ||
if (OPENMP_FOUND) | ||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") | ||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") | ||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}") | ||
endif() | ||
|
||
|
||
|
||
cuda_add_library(cugraph SHARED | ||
src/grmat.cu | ||
src/cugraph.cu | ||
src/pagerank.cu | ||
../gunrock/gunrock/util/test_utils.cu | ||
../gunrock/gunrock/util/error_utils.cu | ||
../gunrock/gunrock/util/misc_utils.cu | ||
../gunrock/externals/moderngpu/src/mgpucontext.cu | ||
../gunrock/externals/moderngpu/src/mgpuutil.cpp | ||
../gunrock/gunrock/util/gitsha1.c | ||
) | ||
add_library( cudf SHARED IMPORTED) | ||
set_target_properties( cudf PROPERTIES IMPORTED_LOCATION $ENV{CONDA_PREFIX}/lib/libcudf.so) | ||
target_link_libraries(cugraph cudf) | ||
target_link_libraries(cugraph ${Boost_LIBRARIES}) | ||
message(STATUS "GDF found in $ENV{CONDA_PREFIX}/lib/libcudf.so") | ||
# Command to symlink files into the build directory | ||
add_custom_command( # link the include directory | ||
OUTPUT include | ||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/include include | ||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/include) | ||
|
||
# The install target | ||
install(TARGETS cugraph LIBRARY DESTINATION lib) | ||
install(DIRECTORY include/ DESTINATION include/cugraph) | ||
|
||
# Configure the C++ tests | ||
find_package(GTest QUIET) | ||
set_package_properties(GTest PROPERTIES TYPE OPTIONAL | ||
PURPOSE "Google C++ Testing Framework (Google Test)." | ||
URL "https://github.com/google/googletest") | ||
|
||
if(NOT NVG_PLUGIN) | ||
set(NVG_PLUGIN "FALSE") | ||
else() | ||
if(NOT EXISTS "/usr/local/lib/libnvgraph_st.so") | ||
set(NVG_PLUGIN "FALSE") | ||
endif() | ||
message(STATUS "Could not find Nvgraph plugin in /usr/local/lib/libnvgraph_st.so") | ||
endif() | ||
message(STATUS "Nvgraph plugin : ${NVG_PLUGIN}") | ||
|
||
if(NVG_PLUGIN) | ||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/plugin/nvgraph) | ||
endif() | ||
|
||
if(GTEST_FOUND) | ||
message(STATUS "Google C++ Testing Framework (Google Test) found in ${GTEST_ROOT}") | ||
include_directories(${GTEST_INCLUDE_DIRS}) | ||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/tests) | ||
else() | ||
message(AUTHOR_WARNING "Google C++ Testing Framework (Google Test) not found: automated tests are disabled.") | ||
endif() | ||
|
||
# Print the project summary | ||
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# cuGraph: GPU accelerated graph analytics | ||
|
||
cuGraph is a library implementing Graph Analytics functionalities based on GPU Data Frames. For more project details, see [rapids.ai](https://rapids.ai/). | ||
|
||
## Development Setup | ||
|
||
The following instructions are tested on Linux systems. | ||
|
||
Compiler requirement: | ||
|
||
* `g++` 4.8 or 5.4 | ||
* `cmake` 3.12+ | ||
|
||
CUDA requirement: | ||
|
||
* CUDA 9.0+ | ||
|
||
You can obtain CUDA from [https://developer.nvidia.com/cuda-downloads](https://developer.nvidia.com/cuda-downloads). | ||
|
||
### 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). | ||
|
||
Note: This conda installation only applies to Linux and Python versions 3.5/3.6. | ||
|
||
You can create and activate a development environment using the conda commands: | ||
|
||
```bash | ||
# create the conda environment (assuming in base `cugraph` directory) | ||
conda env create --name cugraph_dev --file conda/environments/dev_py35.yml | ||
# activate the environment | ||
source activate | ||
``` | ||
|
||
The environment can be updated as development includes/changes the depedencies. To do so, run: | ||
|
||
```bash | ||
conda env update --name cugraph_dev --file conda/environments/dev_py35.yml | ||
source activate | ||
``` | ||
|
||
This installs the required `cmake`, `cudf`, `pyarrow` and other | ||
dependencies into the `cugraph_dev` conda environment and activates it. | ||
### Configure and build | ||
|
||
This project uses cmake for building the C/C++ library. To configure cmake, | ||
run: | ||
|
||
```bash | ||
mkdir build # create build directory for out-of-source build | ||
cd build # enter the build directory | ||
cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DNVG_PLUGIN=FALSE # configure cmake ... use $CONDA_PREFIX if you're using Anaconda | ||
``` | ||
|
||
Add `-DNVG_PLUGIN=TRUE` to configure cmake to build nvGraph plugin for cuGraph. | ||
|
||
To build the C/C++ code | ||
```bash | ||
make #This should produce a shared library named `libcugraph.so` | ||
make install #The default locations are `$CMAKE_INSTALL_PREFIX/lib` and `$CMAKE_INSTALL_PREFIX/include/cugraph` respectively. | ||
``` | ||
|
||
Install the Python package to your Python path: | ||
|
||
```bash | ||
python setup.py install # install cudf python bindings | ||
``` | ||
|
||
### Run tests | ||
**C++ stand alone tests** | ||
|
||
From the build directory : `gtests/gdfgraph_test` | ||
|
||
|
||
**Python tests with datasets** | ||
|
||
From cugraph's directory : | ||
```bash | ||
tar -zxvf src/tests/datasets.tar.gz -C / # tests will look for this 'datasets' folder in '/' | ||
pytest | ||
``` | ||
|
||
### Documentation | ||
|
||
Python API documentation can be generated from [docs](docs) directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#============================================================================= | ||
# Copyright 2018 BlazingDB, Inc. | ||
# Copyright 2018 Percy Camilo Triveño Aucahuasi <[email protected]> | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
#============================================================================= | ||
|
||
set(ARROW_DOWNLOAD_BINARY_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/thirdparty/arrow-download/) | ||
|
||
# Download and unpack arrow at configure time | ||
configure_file(${CMAKE_SOURCE_DIR}/cmake/Templates/Arrow.CMakeLists.txt.cmake ${ARROW_DOWNLOAD_BINARY_DIR}/CMakeLists.txt COPYONLY) | ||
|
||
execute_process( | ||
COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . | ||
RESULT_VARIABLE result | ||
WORKING_DIRECTORY ${ARROW_DOWNLOAD_BINARY_DIR} | ||
) | ||
|
||
if(result) | ||
message(FATAL_ERROR "CMake step for arrow failed: ${result}") | ||
endif() | ||
|
||
execute_process( | ||
COMMAND ${CMAKE_COMMAND} --build . | ||
RESULT_VARIABLE result | ||
WORKING_DIRECTORY ${ARROW_DOWNLOAD_BINARY_DIR} | ||
) | ||
|
||
if(result) | ||
message(FATAL_ERROR "Build step for arrow failed: ${result}") | ||
endif() | ||
|
||
# Locate the Arrow package. | ||
# Requires that you build with: | ||
# -DARROW_ROOT:PATH=/path/to/arrow_install_dir | ||
set(ARROW_ROOT ${ARROW_DOWNLOAD_BINARY_DIR}/arrow-prefix/src/arrow-install/usr/local/) | ||
|
||
# Need ARROW_VERSION for setting correct ARROW_GENERATED_IPC_DIR | ||
set(ARROW_VERSION "apache-arrow-0.10.0") | ||
if (NOT "$ENV{PARQUET_ARROW_VERSION}" STREQUAL "") | ||
set(ARROW_VERSION "$ENV{PARQUET_ARROW_VERSION}") | ||
endif() | ||
message(STATUS "C: ARROW_VERSION=${ARROW_VERSION}") | ||
|
||
# Copy the arrow-format flatbuffer headers to include/ipc using configure_file (will sync if input file changes) | ||
if ("${ARROW_VERSION}" STREQUAL "apache-arrow-0.7.1") | ||
set(ARROW_GENERATED_IPC_DIR ${ARROW_DOWNLOAD_BINARY_DIR}/arrow-prefix/src/arrow/cpp/src/arrow/ipc/) | ||
else() | ||
set(ARROW_GENERATED_IPC_DIR ${ARROW_DOWNLOAD_BINARY_DIR}/arrow-prefix/src/arrow-build/src/arrow/ipc/) | ||
endif() | ||
|
||
configure_file(${ARROW_GENERATED_IPC_DIR}/File_generated.h ${CMAKE_SOURCE_DIR}/include/gdf/ipc/File_generated.h COPYONLY) | ||
configure_file(${ARROW_GENERATED_IPC_DIR}/Message_generated.h ${CMAKE_SOURCE_DIR}/include/gdf/ipc/Message_generated.h COPYONLY) | ||
configure_file(${ARROW_GENERATED_IPC_DIR}/Schema_generated.h ${CMAKE_SOURCE_DIR}/include/gdf/ipc/Schema_generated.h COPYONLY) | ||
configure_file(${ARROW_GENERATED_IPC_DIR}/Tensor_generated.h ${CMAKE_SOURCE_DIR}/include/gdf/ipc/Tensor_generated.h COPYONLY) | ||
|
||
# Add transitive dependency: Flatbuffers | ||
set(FLATBUFFERS_ROOT ${ARROW_DOWNLOAD_BINARY_DIR}/arrow-prefix/src/arrow-build/flatbuffers_ep-prefix/src/flatbuffers_ep-install/) | ||
|
||
include_directories(${FLATBUFFERS_ROOT}/include/) | ||
link_directories(${FLATBUFFERS_ROOT}/lib/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#============================================================================= | ||
# Copyright 2018 BlazingDB, Inc. | ||
# Copyright 2018 Percy Camilo Triveño Aucahuasi <[email protected]> | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
#============================================================================= | ||
# Download and unpack googletest at configure time | ||
configure_file(${CMAKE_SOURCE_DIR}/cmake/Templates/GoogleTest.CMakeLists.txt.cmake ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/thirdparty/googletest-download/CMakeLists.txt) | ||
|
||
execute_process( | ||
COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . | ||
RESULT_VARIABLE result | ||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/thirdparty/googletest-download/ | ||
) | ||
|
||
if(result) | ||
message(FATAL_ERROR "CMake step for googletest failed: ${result}") | ||
endif() | ||
|
||
execute_process( | ||
COMMAND ${CMAKE_COMMAND} --build . | ||
RESULT_VARIABLE result | ||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/thirdparty/googletest-download/ | ||
) | ||
|
||
if(result) | ||
message(FATAL_ERROR "Build step for googletest failed: ${result}") | ||
endif() | ||
|
||
# Prevent overriding the parent project's compiler/linker | ||
# settings on Windows | ||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) | ||
|
||
# Prevent overriding the parent project's compiler/linker | ||
# settings on Windows | ||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) | ||
|
||
# Locate the Google Test package. | ||
# Requires that you build with: | ||
# -DGTEST_ROOT:PATH=/path/to/googletest_install_dir | ||
set(GTEST_ROOT ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/thirdparty/googletest-install/) | ||
message(STATUS "GTEST_ROOT: " ${GTEST_ROOT}) | ||
|
||
link_directories(${GTEST_ROOT}/lib/) |
Oops, something went wrong.