From 31cc675cbe13a54b68cd06f8644e716f2f7f5741 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Fri, 7 May 2021 12:18:13 -0400 Subject: [PATCH 01/44] Convert cugraph over to using rapids-cmake --- cpp/CMakeLists.txt | 453 ++++++------------------ cpp/cmake/EvalGpuArchs.cmake | 68 ---- cpp/cmake/Modules/FindFAISS.cmake | 98 ----- cpp/cmake/Modules/FindNCCL.cmake | 116 ------ cpp/cmake/faiss_cuda11.patch | 40 --- cpp/cmake/thirdparty/get_cuco.cmake | 35 ++ cpp/cmake/thirdparty/get_cuhornet.cmake | 46 +++ cpp/cmake/thirdparty/get_faiss.cmake | 50 +++ cpp/cmake/thirdparty/get_gtest.cmake | 41 +++ cpp/cmake/thirdparty/get_gunrock.cmake | 64 ++++ cpp/cmake/thirdparty/get_nccl.cmake | 42 +++ cpp/cmake/thirdparty/get_raft.cmake | 36 ++ cpp/cmake/thirdparty/get_rmm.cmake | 41 +++ cpp/cmake/thirdparty/get_thrust.cmake | 29 ++ cpp/tests/CMakeLists.txt | 5 + 15 files changed, 489 insertions(+), 675 deletions(-) delete mode 100644 cpp/cmake/EvalGpuArchs.cmake delete mode 100644 cpp/cmake/Modules/FindFAISS.cmake delete mode 100644 cpp/cmake/Modules/FindNCCL.cmake delete mode 100644 cpp/cmake/faiss_cuda11.patch create mode 100644 cpp/cmake/thirdparty/get_cuco.cmake create mode 100644 cpp/cmake/thirdparty/get_cuhornet.cmake create mode 100644 cpp/cmake/thirdparty/get_faiss.cmake create mode 100644 cpp/cmake/thirdparty/get_gtest.cmake create mode 100644 cpp/cmake/thirdparty/get_gunrock.cmake create mode 100644 cpp/cmake/thirdparty/get_nccl.cmake create mode 100644 cpp/cmake/thirdparty/get_raft.cmake create mode 100644 cpp/cmake/thirdparty/get_rmm.cmake create mode 100644 cpp/cmake/thirdparty/get_thrust.cmake diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 3f421da5e19..9f00c985cef 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -14,7 +14,21 @@ # limitations under the License. #============================================================================= -cmake_minimum_required(VERSION 3.18...3.18 FATAL_ERROR) +cmake_minimum_required(VERSION 3.20.1 FATAL_ERROR) +include(FetchContent) +FetchContent_Declare( + rapids-cmake + GIT_REPOSITORY git@github.com:rapidsai/rapids-cmake.git + GIT_TAG origin/main + ) +FetchContent_MakeAvailable(rapids-cmake) +include(rapids-cmake) +include(rapids-cpm) +include(rapids-cuda) +include(rapids-export) +include(rapids-find) + +rapids_cuda_init_architectures(CUGRAPH) project(CUGRAPH VERSION 0.20.0 LANGUAGES C CXX CUDA) @@ -26,92 +40,31 @@ write_version() # - build type ------------------------------------------------------------------------------------ # Set a default build type if none was specified -set(DEFAULT_BUILD_TYPE "Release") - -if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - message(STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' since none specified.") - set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE - STRING "Choose the type of build." FORCE) - # Set the possible values of build type for cmake-gui - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS - "Debug" "Release" "MinSizeRel" "RelWithDebInfo") -endif() +rapids_cmake_build_type(Release) ############################################################################## # - User Options ------------------------------------------------------------ option(BUILD_CUGRAPH_MG_TESTS "Build cuGraph multigpu algorithm tests" OFF) - -################################################################################################### -# - user options ------------------------------------------------------------------------------ - -set(BLAS_LIBRARIES "" CACHE STRING - "Location of BLAS library for FAISS build.") +set(BLAS_LIBRARIES "" CACHE STRING "Location of BLAS library for FAISS build.") option(BUILD_STATIC_FAISS "Build the FAISS library for nearest neighbors search on GPU" OFF) +option(CMAKE_CUDA_LINEINFO "Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler" OFF) +option(BUILD_TESTS "Configure CMake to build tests" ON) ################################################################################################### # - compiler options ------------------------------------------------------------------------------ -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_C_COMPILER $ENV{CC}) -set(CMAKE_CXX_COMPILER $ENV{CXX}) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -set(CMAKE_CUDA_STANDARD 17) -set(CMAKE_CUDA_STANDARD_REQUIRED ON) +rapids_find_package(CUDAToolkit REQUIRED + BUILD_EXPORT_SET cugraph-exports + INSTALL_EXPORT_SET cugraph-exports + ) if(CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=deprecated-declarations") endif(CMAKE_COMPILER_IS_GNUCXX) -find_package(CUDA) - -# Configure GPU arch to build -set(GUNROCK_GENCODE_SM60 "OFF") -set(GUNROCK_GENCODE_SM61 "OFF") -set(GUNROCK_GENCODE_SM70 "OFF") -set(GUNROCK_GENCODE_SM72 "OFF") -set(GUNROCK_GENCODE_SM75 "OFF") -set(GUNROCK_GENCODE_SM80 "OFF") - -# ARCHS handling: -# -if("${GPU_ARCHS}" STREQUAL "") - include(cmake/EvalGpuArchs.cmake) - evaluate_gpu_archs(GPU_ARCHS) -endif() - - -# CUDA 11 onwards cub ships with CTK -if((CUDA_VERSION_MAJOR EQUAL 11) OR (CUDA_VERSION_MAJOR GREATER 11)) - set(CUB_IS_PART_OF_CTK ON) -else() - set(CUB_IS_PART_OF_CTK OFF) -endif() - -if("${GPU_ARCHS}" STREQUAL "ALL") - set(GPU_ARCHS "60") - if((CUDA_VERSION_MAJOR EQUAL 9) OR (CUDA_VERSION_MAJOR GREATER 9)) - set(GPU_ARCHS "${GPU_ARCHS};70") - endif() - if((CUDA_VERSION_MAJOR EQUAL 10) OR (CUDA_VERSION_MAJOR GREATER 10)) - set(GPU_ARCHS "${GPU_ARCHS};75") - endif() - if((CUDA_VERSION_MAJOR EQUAL 11) OR (CUDA_VERSION_MAJOR GREATER 11)) - set(GPU_ARCHS "${GPU_ARCHS};80") - endif() -endif() - -message("-- Building for GPU_ARCHS = ${GPU_ARCHS}") -foreach(arch ${GPU_ARCHS}) - set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -gencode arch=compute_${arch},code=sm_${arch}") - set(GUNROCK_GENCODE_SM${arch} "ON") - set(FAISS_GPU_ARCHS "${FAISS_GPU_ARCHS} -gencode arch=compute_${arch},code=sm_${arch}") -endforeach() -list(GET GPU_ARCHS -1 ptx) -set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -gencode arch=compute_${ptx},code=compute_${ptx}") -set(FAISS_GPU_ARCHS "${FAISS_GPU_ARCHS} -gencode arch=compute_${ptx},code=compute_${ptx}") +message("-- Building for GPU_ARCHS = ${CMAKE_CUDA_ARCHITECTURES}") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --expt-extended-lambda --expt-relaxed-constexpr") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Werror=cross-execution-space-call -Wno-deprecated-declarations -Xptxas --disable-warnings") @@ -120,7 +73,6 @@ set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xfatbin=-compress-all") # Option to enable line info in CUDA device compilation to allow introspection when profiling / # memchecking -option(CMAKE_CUDA_LINEINFO "Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler" OFF) if (CMAKE_CUDA_LINEINFO) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") endif(CMAKE_CUDA_LINEINFO) @@ -131,35 +83,6 @@ if(CMAKE_BUILD_TYPE MATCHES Debug) set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G -Xcompiler -rdynamic") endif(CMAKE_BUILD_TYPE MATCHES Debug) -# To apply RUNPATH to transitive dependencies (this is a temporary solution) -set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--disable-new-dtags") -set(CMAKE_EXE_LINKER_FLAGS "-Wl,--disable-new-dtags") - -option(BUILD_TESTS "Configure CMake to build tests" - ON) - -################################################################################################### -# - cmake modules --------------------------------------------------------------------------------- - -set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/" ${CMAKE_MODULE_PATH}) - -include(FeatureSummary) -include(CheckIncludeFiles) -include(CheckLibraryExists) -if(BUILD_TESTS) - include(CTest) -endif(BUILD_TESTS) - -################################################################################################### -# - find boost ------------------------------------------------------------------------------------ - -find_package(Boost REQUIRED) -if(Boost_FOUND) - message(STATUS "Boost found in ${Boost_INCLUDE_DIRS}") -else() - message(FATAL_ERROR "Boost not found, please check your settings.") -endif(Boost_FOUND) - ################################################################################################### # - find openmp ----------------------------------------------------------------------------------- @@ -180,219 +103,27 @@ else() endif() ################################################################################################### -# - find gtest ------------------------------------------------------------------------------------ - -if(BUILD_TESTS) - find_package(GTest REQUIRED) -endif(BUILD_TESTS) - -################################################################################################### -# - find RMM -------------------------------------------------------------------------------------- - -find_path(RMM_INCLUDE "rmm" - HINTS - "$ENV{RMM_ROOT}/include" - "$ENV{CONDA_PREFIX}/include/rmm" - "$ENV{CONDA_PREFIX}/include") - -message(STATUS "RMM: RMM_INCLUDE set to ${RMM_INCLUDE}") - -################################################################################################### -# - find NCCL ------------------------------------------------------------------------------------- - -if(NOT NCCL_PATH) - find_package(NCCL REQUIRED) -else() - message("-- Manually set NCCL PATH to ${NCCL_PATH}") - set(NCCL_INCLUDE_DIRS ${NCCL_PATH}/include) - set(NCCL_LIBRARIES ${NCCL_PATH}/lib/libnccl.so) -endif(NOT NCCL_PATH) +# - find CPM based dependencies ------------------------------------------------------------------ -################################################################################################### -# - find MPI - only enabled if MG tests are to be built -if(BUILD_CUGRAPH_MG_TESTS) - find_package(MPI REQUIRED) -endif(BUILD_CUGRAPH_MG_TESTS) +rapids_cpm_init() -################################################################################################### -# - Fetch Content --------------------------------------------------------------------------------- -include(FetchContent) +include(cmake/thirdparty/get_thrust.cmake) +include(cmake/thirdparty/get_faiss.cmake) +include(cmake/thirdparty/get_nccl.cmake) -# - THRUST/CUB -message("Fetching Thrust") - -FetchContent_Declare( - thrust - GIT_REPOSITORY https://github.com/thrust/thrust.git - GIT_TAG 1.12.0 -) - -FetchContent_GetProperties(thrust) -if(NOT thrust_POPULATED) - FetchContent_Populate(thrust) - # We are not using the thrust CMake targets, so no need to call `add_subdirectory()`. -endif() -set(THRUST_INCLUDE_DIR "${thrust_SOURCE_DIR}") - -# - cuco -message("Fetching cuco") - -FetchContent_Declare( - cuco - GIT_REPOSITORY https://github.com/NVIDIA/cuCollections.git - GIT_TAG 7678a5ecaa192b8983b02a0191a140097171713e -) - -FetchContent_GetProperties(cuco) -if(NOT cuco_POPULATED) - FetchContent_Populate(cuco) -endif() -set(CUCO_INCLUDE_DIR "${cuco_SOURCE_DIR}/include") - -# - libcudacxx -# NOTE: This is necessary because libcudacxx is not supported in -# debian cuda 10.2 packages. Once 10.2 is deprecated -# we should not need this any longer. -message("Fetching libcudacxx") - -FetchContent_Declare( - libcudacxx - GIT_REPOSITORY https://github.com/NVIDIA/libcudacxx.git - GIT_TAG 1.3.0 - GIT_SHALLOW true -) +include(cmake/thirdparty/get_raft.cmake) +include(cmake/thirdparty/get_rmm.cmake) -FetchContent_GetProperties(libcudacxx) -if(NOT libcudacxx_POPULATED) - message("populating libcudacxx") - FetchContent_Populate(libcudacxx) -endif() -set(LIBCUDACXX_INCLUDE_DIR "${libcudacxx_SOURCE_DIR}/include") -message("set LIBCUDACXX_INCLUDE_DIR to: ${LIBCUDACXX_INCLUDE_DIR}") +include(cmake/thirdparty/get_cuco.cmake) +include(cmake/thirdparty/get_cuhornet.cmake) -# - CUHORNET -FetchContent_Declare( - cuhornet - GIT_REPOSITORY https://github.com/rapidsai/cuhornet.git - GIT_TAG 6d2fc894cc56dd2ca8fc9d1523a18a6ec444b663 - GIT_SHALLOW true - SOURCE_SUBDIR hornet -) +include(cmake/thirdparty/get_gunrock.cmake) -FetchContent_GetProperties(cuhornet) -if(NOT cuhornet_POPULATED) - message("populating cuhornet") - FetchContent_Populate(cuhornet) - # We are not using the cuhornet CMake targets, so no need to call `add_subdirectory()`. +if(BUILD_TESTS) + include(cmake/thirdparty/get_gtest.cmake) endif() -set(CUHORNET_INCLUDE_DIR ${cuhornet_SOURCE_DIR} CACHE STRING "Path to cuhornet includes") - -# - raft - (header only) -# Only cloned if RAFT_PATH env variable is not defined -if(DEFINED ENV{RAFT_PATH}) - message(STATUS "RAFT_PATH environment variable detected.") - message(STATUS "RAFT_DIR set to $ENV{RAFT_PATH}") - set(RAFT_DIR "$ENV{RAFT_PATH}") - -else(DEFINED ENV{RAFT_PATH}) - message(STATUS "RAFT_PATH environment variable NOT detected, cloning RAFT") - - FetchContent_Declare( - raft - GIT_REPOSITORY https://github.com/rapidsai/raft.git - GIT_TAG 66f82b4e79a3e268d0da3cc864ec7ce4ad065296 - SOURCE_SUBDIR raft - ) - - FetchContent_GetProperties(raft) - if(NOT raft_POPULATED) - message("populating raft") - FetchContent_Populate(raft) - # We are not using any raft CMake targets, so no need to call `add_subdirectory()`. - endif() - set(RAFT_DIR "${raft_SOURCE_DIR}") -endif(DEFINED ENV{RAFT_PATH}) - -################################################################################################### -# - External Projects ----------------------------------------------------------------------------- - -# https://cmake.org/cmake/help/v3.0/module/ExternalProject.html - -# FIXME: gunrock is still using ExternalProject instead of -# FetchContent. Consider migrating to FetchContent soon (this may require -# updates to the gunrock cmake files to support this). - -include(ExternalProject) - -# - GUNROCK -set(GUNROCK_DIR ${CMAKE_CURRENT_BINARY_DIR}/gunrock CACHE STRING "Path to gunrock repo") -set(GUNROCK_INCLUDE_DIR ${GUNROCK_DIR}/src/gunrock_ext CACHE STRING "Path to gunrock includes") - -ExternalProject_Add(gunrock_ext - GIT_REPOSITORY https://github.com/gunrock/gunrock.git - GIT_TAG v1.2 - PREFIX ${GUNROCK_DIR} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX= - -DGUNROCK_BUILD_SHARED_LIBS=OFF - -DGUNROCK_BUILD_TESTS=OFF - -DCUDA_AUTODETECT_GENCODE=OFF - -DGUNROCK_GENCODE_SM60=${GUNROCK_GENCODE_SM60} - -DGUNROCK_GENCODE_SM61=${GUNROCK_GENCODE_SM61} - -DGUNROCK_GENCODE_SM70=${GUNROCK_GENCODE_SM70} - -DGUNROCK_GENCODE_SM72=${GUNROCK_GENCODE_SM72} - -DGUNROCK_GENCODE_SM75=${GUNROCK_GENCODE_SM75} - -DGUNROCK_GENCODE_SM80=${GUNROCK_GENCODE_SM80} - ${GUNROCK_GENCODE} - BUILD_BYPRODUCTS ${GUNROCK_DIR}/src/gunrock_ext-build/lib/libgunrock.a - INSTALL_COMMAND "" -) - -add_library(gunrock STATIC IMPORTED) -add_dependencies(gunrock gunrock_ext) -set_property(TARGET gunrock PROPERTY IMPORTED_LOCATION ${GUNROCK_DIR}/src/gunrock_ext-build/lib/libgunrock.a) - -# - FAISS -# FIXME: The commit currently being fetched from faiss is using autotools which -# is more convenient to build with ExternalProjectAdd. -# Consider migrating to FetchContent once the tagged commit is changed. - -if(BUILD_STATIC_FAISS) - set(FAISS_DIR ${CMAKE_CURRENT_BINARY_DIR}/faiss CACHE STRING - "Path to FAISS source directory") - ExternalProject_Add(faiss - GIT_REPOSITORY https://github.com/facebookresearch/faiss.git - GIT_TAG 7c2d2388a492d65fdda934c7e74ae87acaeed066 - CONFIGURE_COMMAND LIBS=-pthread - CPPFLAGS=-w - LDFLAGS=-L${CMAKE_INSTALL_PREFIX}/lib - cmake -B build . - -DCMAKE_BUILD_TYPE=Release - -DBUILD_TESTING=OFF - -DFAISS_ENABLE_PYTHON=OFF - -DBUILD_SHARED_LIBS=OFF - -DFAISS_ENABLE_GPU=ON - -DCUDAToolkit_ROOT=${CUDA_TOOLKIT_ROOT_DIR} - -DCUDA_ARCHITECTURES=${FAISS_GPU_ARCHS} - -DBLAS_LIBRARIES=${BLAS_LIBRARIES} - PREFIX ${FAISS_DIR} - BUILD_COMMAND make -C build -j${PARALLEL_LEVEL} VERBOSE=1 - BUILD_BYPRODUCTS ${FAISS_DIR}/src/faiss/build/faiss/libfaiss.a - BUILD_ALWAYS 1 - INSTALL_COMMAND "" - UPDATE_COMMAND "" - BUILD_IN_SOURCE 1) - - ExternalProject_Get_Property(faiss install_dir) - add_library(FAISS::FAISS STATIC IMPORTED) - set_property(TARGET FAISS::FAISS PROPERTY - IMPORTED_LOCATION ${FAISS_DIR}/src/faiss/build/faiss/libfaiss.a) - set(FAISS_INCLUDE_DIRS "${FAISS_DIR}/src/faiss") -else() - set(FAISS_INSTALL_DIR ENV{FAISS_ROOT}) - find_package(FAISS REQUIRED) -endif(BUILD_STATIC_FAISS) ################################################################################################### # - library targets ------------------------------------------------------------------------------- @@ -441,17 +172,15 @@ add_library(cugraph SHARED src/tree/mst.cu ) -target_link_directories(cugraph - PRIVATE - # CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES is an undocumented/unsupported variable containing the - # link directories for nvcc. - "${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}") - -# -# NOTE: This dependency will force the building of cugraph to -# wait until after cugunrock is constructed. -# -add_dependencies(cugraph gunrock_ext) +set_target_properties(cugraph + PROPERTIES BUILD_RPATH "\$ORIGIN" + INSTALL_RPATH "\$ORIGIN" + # set target compile options + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED ON + CUDA_STANDARD 17 + CUDA_STANDARD_REQUIRED ON +) # Per-thread default stream option see https://docs.nvidia.com/cuda/cuda-runtime-api/stream-sync-behavior.html # The per-thread default stream does not synchronize with other streams @@ -461,30 +190,33 @@ target_compile_definitions(cugraph PUBLIC CUDA_API_PER_THREAD_DEFAULT_STREAM) # - include paths --------------------------------------------------------------------------------- target_include_directories(cugraph PRIVATE - "${THRUST_INCLUDE_DIR}" - "${CUCO_INCLUDE_DIR}" - "${LIBCUDACXX_INCLUDE_DIR}" - "${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}" - "${Boost_INCLUDE_DIRS}" - "${RMM_INCLUDE}" - "${CMAKE_CURRENT_SOURCE_DIR}/../thirdparty" - "${CUHORNET_INCLUDE_DIR}/hornet/include" - "${CUHORNET_INCLUDE_DIR}/hornetsnest/include" - "${CUHORNET_INCLUDE_DIR}/xlib/include" - "${CUHORNET_INCLUDE_DIR}/primitives" - "${CMAKE_CURRENT_SOURCE_DIR}/src" - "${GUNROCK_INCLUDE_DIR}" - "${NCCL_INCLUDE_DIRS}" - "${RAFT_DIR}/cpp/include" + "${CUCO_INCLUDE_DIR}" + "${CMAKE_CURRENT_SOURCE_DIR}/../thirdparty" + "${CMAKE_CURRENT_SOURCE_DIR}/src" + "${NCCL_INCLUDE_DIRS}" PUBLIC - "${CMAKE_CURRENT_SOURCE_DIR}/include" + "$" + "$" ) ################################################################################################### # - link libraries -------------------------------------------------------------------------------- - -target_link_libraries(cugraph PRIVATE - gunrock cublas cusparse curand cusolver cudart cuda FAISS::FAISS ${NCCL_LIBRARIES}) +target_link_libraries(cugraph + PUBLIC + rmm::rmm + cugraph::Thrust + raft::raft + PRIVATE + cuco::cuco + CUDA::cublas + CUDA::curand + CUDA::cusolver + CUDA::cusparse + cugraph::cuHornet + FAISS::FAISS + gunrock + NCCL::NCCL + ) if(OpenMP_CXX_FOUND) target_link_libraries(cugraph PRIVATE @@ -537,40 +269,55 @@ target_link_libraries(cugraph PRIVATE ${OpenMP_CXX_LIB_NAMES}) endif(OpenMP_CXX_FOUND) -# CUDA_ARCHITECTURES=OFF implies cmake will not pass arch flags to the -# compiler. CUDA_ARCHITECTURES must be set to a non-empty value to prevent cmake -# warnings about policy CMP0104. With this setting, arch flags must be manually -# set! ("evaluate_gpu_archs(GPU_ARCHS)" is the current mechanism used in -# cpp/CMakeLists.txt for setting arch options). Run "cmake --help-policy -# CMP0104" for policy details. -# NOTE: the CUDA_ARCHITECTURES=OFF setting may be removed after migrating to the -# findcudatoolkit features in cmake 3.17+ -set_target_properties(cugraph PROPERTIES - CUDA_ARCHITECTURES OFF) ################################################################################################### # - generate tests -------------------------------------------------------------------------------- if(BUILD_TESTS) - if(GTEST_FOUND) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tests) - endif(GTEST_FOUND) + include(CTest) + add_subdirectory(tests) endif(BUILD_TESTS) ################################################################################################### # - install targets ------------------------------------------------------------------------------- -install(TARGETS cugraph LIBRARY - DESTINATION lib) +install(TARGETS cugraph + DESTINATION lib + EXPORT cugraph-exports) install(DIRECTORY include/ - DESTINATION include/cugraph) + DESTINATION include/cugraph) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/cugraph/version_config.hpp DESTINATION include/cugraph) -install(DIRECTORY ${RAFT_DIR}/cpp/include/raft/ - DESTINATION include/cugraph/raft) +################################################################################################ +# - install export ------------------------------------------------------------------------------- +set(doc_string +[=[ +Provide targets for cuGraph. + +cuGraph library is a collection of GPU accelerated graph algorithms that process data found in +[GPU DataFrames](https://github.com/rapidsai/cudf). + +]=]) + + rapids_export(INSTALL cuGraph + EXPORT_SET cugraph-exports + GLOBAL_TARGETS cugraph + NAMESPACE cugraph:: + DOCUMENTATION doc_string + ) + +################################################################################################ +# - build export ------------------------------------------------------------------------------- +rapids_export(BUILD cuGraph + EXPORT_SET cugraph-exports + GLOBAL_TARGETS cugraph + NAMESPACE cugraph:: + DOCUMENTATION doc_string + ) + ################################################################################################### # - make documentation ---------------------------------------------------------------------------- # requires doxygen and graphviz to be installed diff --git a/cpp/cmake/EvalGpuArchs.cmake b/cpp/cmake/EvalGpuArchs.cmake deleted file mode 100644 index f3918542db9..00000000000 --- a/cpp/cmake/EvalGpuArchs.cmake +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright (c) 2019-2020, NVIDIA CORPORATION. -# -# 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. -# - -function(evaluate_gpu_archs gpu_archs) - set(eval_file ${PROJECT_BINARY_DIR}/eval_gpu_archs.cu) - set(eval_exe ${PROJECT_BINARY_DIR}/eval_gpu_archs) - file(WRITE ${eval_file} - " -#include -#include -#include -using namespace std; -int main(int argc, char** argv) { - set archs; - int nDevices; - if((cudaGetDeviceCount(&nDevices) == cudaSuccess) && (nDevices > 0)) { - for(int dev=0;dev::const_iterator itr=archs.begin();itr!=archs.end();++itr) { - printf(first? \"%s\" : \";%s\", itr->c_str()); - first = false; - } - } - printf(\"\\n\"); - return 0; -} -") - execute_process( - COMMAND ${CUDA_NVCC_EXECUTABLE} - -o ${eval_exe} - --run - ${eval_file} - OUTPUT_VARIABLE __gpu_archs - OUTPUT_STRIP_TRAILING_WHITESPACE) - set(__gpu_archs_filtered "${__gpu_archs}") - foreach(arch ${__gpu_archs}) - if (arch VERSION_LESS 60) - list(REMOVE_ITEM __gpu_archs_filtered ${arch}) - endif() - endforeach() - if (NOT __gpu_archs_filtered) - message(FATAL_ERROR "No supported GPU arch found on this system") - endif() - message("Auto detection of gpu-archs: ${__gpu_archs_filtered}") - set(${gpu_archs} ${__gpu_archs_filtered} PARENT_SCOPE) -endfunction(evaluate_gpu_archs) diff --git a/cpp/cmake/Modules/FindFAISS.cmake b/cpp/cmake/Modules/FindFAISS.cmake deleted file mode 100644 index 7c456edfeef..00000000000 --- a/cpp/cmake/Modules/FindFAISS.cmake +++ /dev/null @@ -1,98 +0,0 @@ -# Copyright (c) 2021, NVIDIA CORPORATION. -# -# 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. -# - -# Based on FindPNG.cmake from cmake 3.14.3 - -#[=======================================================================[.rst: -FindFAISS --------- - -Template to generate FindPKG_NAME.cmake CMake modules - -Find FAISS - -Imported targets -^^^^^^^^^^^^^^^^ - -This module defines the following :prop_tgt:`IMPORTED` target: - -``FAISS::FAISS`` - The libFAISS library, if found. - -Result variables -^^^^^^^^^^^^^^^^ - -This module will set the following variables in your project: - -``FAISS_INCLUDE_DIRS`` - where to find FAISS.hpp , etc. -``FAISS_LIBRARIES`` - the libraries to link against to use libFAISS. -``FAISS_FOUND`` - If false, do not try to use FAISS. -``FAISS_VERSION_STRING`` - the version of the FAISS library found - -#]=======================================================================] - -find_path(FAISS_LOCATION faiss/IndexFlat.h - HINTS ${FAISS_INSTALL_DIR} - PATH_SUFFIXES include include/) - -list(APPEND FAISS_NAMES faiss libfaiss) -set(_FAISS_VERSION_SUFFIXES ) - -foreach(v IN LISTS _FAISS_VERSION_SUFFIXES) - list(APPEND FAISS_NAMES faiss${v} libfaiss${v}) - list(APPEND FAISS_NAMES faiss.${v} libfaiss.${v}) -endforeach() -unset(_FAISS_VERSION_SUFFIXES) - -find_library(FAISS_LIBRARY_RELEASE NAMES ${FAISS_NAMES} - HINTS ${FAISS_INSTALL_DIR} - PATH_SUFFIXES lib) - -include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake) -select_library_configurations(FAISS) -mark_as_advanced(FAISS_LIBRARY_RELEASE) -unset(FAISS_NAMES) - -# Set by select_library_configurations(), but we want the one from -# find_package_handle_standard_args() below. -unset(FAISS_FOUND) - -if (FAISS_LIBRARY AND FAISS_LOCATION) - set(FAISS_INCLUDE_DIRS ${FAISS_LOCATION} ) - set(FAISS_LIBRARY ${FAISS_LIBRARY}) - - if(NOT TARGET FAISS::FAISS) - add_library(FAISS::FAISS UNKNOWN IMPORTED) - set_target_properties(FAISS::FAISS PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${FAISS_INCLUDE_DIRS}") - if(EXISTS "${FAISS_LIBRARY}") - set_target_properties(FAISS::FAISS PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - IMPORTED_LOCATION "${FAISS_LIBRARY}") - endif() - endif() -endif () - - -include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) -find_package_handle_standard_args(FAISS - REQUIRED_VARS FAISS_LIBRARY FAISS_LOCATION - VERSION_VAR FAISS_VERSION_STRING) - -mark_as_advanced(FAISS_LOCATION FAISS_LIBRARY) diff --git a/cpp/cmake/Modules/FindNCCL.cmake b/cpp/cmake/Modules/FindNCCL.cmake deleted file mode 100644 index 0f673707444..00000000000 --- a/cpp/cmake/Modules/FindNCCL.cmake +++ /dev/null @@ -1,116 +0,0 @@ -# Copyright (c) 2019-2020, NVIDIA CORPORATION. -# -# 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. -# - -# Based on FindPNG.cmake from cmake 3.14.3 - -#[=======================================================================[.rst: -FindNCCL --------- - -Find libnccl, the NVIDIA Collective Communication Library. A hint to find NCCL -can be provided by setting NCCL_INSTALL_DIR. - -Imported targets -^^^^^^^^^^^^^^^^ - -This module defines the following :prop_tgt:`IMPORTED` target: - -``NCCL::NCCL`` - The libnccl library, if found. - -Result variables -^^^^^^^^^^^^^^^^ - -This module will set the following variables in your project: - -``NCCL_INCLUDE_DIRS`` - where to find nccl.h , etc. -``NCCL_LIBRARIES`` - the libraries to link against to use NCCL. -``NCCL_FOUND`` - If false, do not try to use NCCL. -``NCCL_VERSION_STRING`` - the version of the NCCL library found - -#]=======================================================================] - -find_path(NCCL_NCCL_INCLUDE_DIR nccl.h HINTS ${NCCL_INSTALL_DIR} PATH_SUFFIXES include) - -#TODO: Does this need to support finding the static library? - -list(APPEND NCCL_NAMES nccl libnccl) -set(_NCCL_VERSION_SUFFIXES 2) - -foreach(v IN LISTS _NCCL_VERSION_SUFFIXES) - list(APPEND NCCL_NAMES nccl${v} libnccl${v}) -endforeach() -unset(_NCCL_VERSION_SUFFIXES) -# For compatibility with versions prior to this multi-config search, honor -# any NCCL_LIBRARY that is already specified and skip the search. -if(NOT NCCL_LIBRARY) - find_library(NCCL_LIBRARY_RELEASE NAMES ${NCCL_NAMES} HINTS ${NCCL_INSTALL_DIR} PATH_SUFFIXES lib) - include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake) - select_library_configurations(NCCL) - mark_as_advanced(NCCL_LIBRARY_RELEASE) -endif() -unset(NCCL_NAMES) - -# Set by select_library_configurations(), but we want the one from -# find_package_handle_standard_args() below. -unset(NCCL_FOUND) - -if (NCCL_LIBRARY AND NCCL_NCCL_INCLUDE_DIR) - set(NCCL_INCLUDE_DIRS ${NCCL_NCCL_INCLUDE_DIR} ) - set(NCCL_LIBRARY ${NCCL_LIBRARY}) - - if(NOT TARGET NCCL::NCCL) - add_library(NCCL::NCCL UNKNOWN IMPORTED) - set_target_properties(NCCL::NCCL PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${NCCL_INCLUDE_DIRS}") - if(EXISTS "${NCCL_LIBRARY}") - set_target_properties(NCCL::NCCL PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${NCCL_LIBRARY}") - endif() - endif() -endif () - -if (NCCL_NCCL_INCLUDE_DIR AND EXISTS "${NCCL_NCCL_INCLUDE_DIR}/nccl.h") - file(STRINGS "${NCCL_NCCL_INCLUDE_DIR}/nccl.h" nccl_major_version_str REGEX "^#define[ \t]+NCCL_MAJOR[ \t]+[0-9]+") - string(REGEX REPLACE "^#define[ \t]+NCCL_MAJOR[ \t]+([0-9]+)" "\\1" nccl_major_version_str "${nccl_major_version_str}") - - file(STRINGS "${NCCL_NCCL_INCLUDE_DIR}/nccl.h" nccl_minor_version_str REGEX "^#define[ \t]+NCCL_MINOR[ \t]+[0-9]+") - string(REGEX REPLACE "^#define[ \t]+NCCL_MINOR[ \t]+([0-9]+)" "\\1" nccl_minor_version_str "${nccl_minor_version_str}") - - file(STRINGS "${NCCL_NCCL_INCLUDE_DIR}/nccl.h" nccl_patch_version_str REGEX "^#define[ \t]+NCCL_PATCH[ \t]+[0-9]+") - string(REGEX REPLACE "^#define[ \t]+NCCL_PATCH[ \t]+([0-9]+)" "\\1" nccl_patch_version_str "${nccl_patch_version_str}") - - file(STRINGS "${NCCL_NCCL_INCLUDE_DIR}/nccl.h" nccl_suffix_version_str REGEX "^#define[ \t]+NCCL_SUFFIX[ \t]+\".*\"") - string(REGEX REPLACE "^#define[ \t]+NCCL_SUFFIX[ \t]+\"(.*)\"" "\\1" nccl_suffix_version_str "${nccl_suffix_version_str}") - - set(NCCL_VERSION_STRING "${nccl_major_version_str}.${nccl_minor_version_str}.${nccl_patch_version_str}${nccl_suffix_version_str}") - - unset(nccl_major_version_str) - unset(nccl_minor_version_str) - unset(nccl_patch_version_str) - unset(nccl_suffix_version_str) -endif () - -include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) -find_package_handle_standard_args(NCCL - REQUIRED_VARS NCCL_LIBRARY NCCL_NCCL_INCLUDE_DIR - VERSION_VAR NCCL_VERSION_STRING) - -mark_as_advanced(NCCL_NCCL_INCLUDE_DIR NCCL_LIBRARY) diff --git a/cpp/cmake/faiss_cuda11.patch b/cpp/cmake/faiss_cuda11.patch deleted file mode 100644 index 496ca0e7b23..00000000000 --- a/cpp/cmake/faiss_cuda11.patch +++ /dev/null @@ -1,40 +0,0 @@ -diff --git a/configure b/configure -index ed40dae..f88ed0a 100755 ---- a/configure -+++ b/configure -@@ -2970,7 +2970,7 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex - ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - -- ax_cxx_compile_alternatives="11 0x" ax_cxx_compile_cxx11_required=true -+ ax_cxx_compile_alternatives="14 11 0x" ax_cxx_compile_cxx11_required=true - ac_ext=cpp - ac_cpp='$CXXCPP $CPPFLAGS' - ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -diff --git a/gpu/utils/DeviceDefs.cuh b/gpu/utils/DeviceDefs.cuh -index 89d3dda..bc0f9b5 100644 ---- a/gpu/utils/DeviceDefs.cuh -+++ b/gpu/utils/DeviceDefs.cuh -@@ -13,7 +13,7 @@ - namespace faiss { namespace gpu { - - #ifdef __CUDA_ARCH__ --#if __CUDA_ARCH__ <= 750 -+#if __CUDA_ARCH__ <= 800 - constexpr int kWarpSize = 32; - #else - #error Unknown __CUDA_ARCH__; please define parameters for compute capability -diff --git a/gpu/utils/MatrixMult-inl.cuh b/gpu/utils/MatrixMult-inl.cuh -index ede225e..4f7eb44 100644 ---- a/gpu/utils/MatrixMult-inl.cuh -+++ b/gpu/utils/MatrixMult-inl.cuh -@@ -51,6 +51,9 @@ rawGemm(cublasHandle_t handle, - auto cBT = GetCudaType::Type; - - // Always accumulate in f32 -+# if __CUDACC_VER_MAJOR__ >= 11 -+ cublasSetMathMode(handle, CUBLAS_MATH_DISALLOW_REDUCED_PRECISION_REDUCTION); -+# endif - return cublasSgemmEx(handle, transa, transb, m, n, k, - &fAlpha, A, cAT, lda, - B, cBT, ldb, diff --git a/cpp/cmake/thirdparty/get_cuco.cmake b/cpp/cmake/thirdparty/get_cuco.cmake new file mode 100644 index 00000000000..a255793285f --- /dev/null +++ b/cpp/cmake/thirdparty/get_cuco.cmake @@ -0,0 +1,35 @@ +#============================================================================= +# Copyright (c) 2021, NVIDIA CORPORATION. +# +# 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. +#============================================================================= + +function(find_and_configure_cuco VERSION) + + rapids_cpm_find(cuco ${VERSION} + GLOBAL_TARGETS cuco cuco::cuco + CPM_ARGS + GIT_REPOSITORY https://github.com/NVIDIA/cuCollections.git + GIT_TAG 7678a5ecaa192b8983b02a0191a140097171713e + OPTIONS "BUILD_TESTS OFF" + "BUILD_BENCHMARKS OFF" + "BUILD_EXAMPLES OFF" + ) + + if(NOT TARGET cuco::cuco) + add_library(cuco::cuco ALIAS cuco) + endif() + +endfunction() + +find_and_configure_cuco(0.0.1) diff --git a/cpp/cmake/thirdparty/get_cuhornet.cmake b/cpp/cmake/thirdparty/get_cuhornet.cmake new file mode 100644 index 00000000000..e33068ed2c3 --- /dev/null +++ b/cpp/cmake/thirdparty/get_cuhornet.cmake @@ -0,0 +1,46 @@ +#============================================================================= +# Copyright (c) 2021, NVIDIA CORPORATION. +# +# 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. +#============================================================================= + +function(find_and_configure_cuhornet) + + # We are not using the cuhornet CMake targets, so no need to call `add_subdirectory()`, + # or to use CPM + FetchContent_Declare( + cuhornet + GIT_REPOSITORY https://github.com/rapidsai/cuhornet.git + GIT_TAG 6d2fc894cc56dd2ca8fc9d1523a18a6ec444b663 + GIT_SHALLOW true + SOURCE_SUBDIR hornet + ) + FetchContent_GetProperties(cuhornet) + + if(NOT cuhornet_POPULATED) + FetchContent_Populate(cuhornet) + endif() + + if(NOT TARGET cugraph::cuHornet) + add_library(cugraph::cuHornet IMPORTED INTERFACE GLOBAL) + target_include_directories(cugraph::cuHornet INTERFACE + "${cuhornet_SOURCE_DIR}/hornet/include" + "${cuhornet_SOURCE_DIR}/hornetsnest/include" + "${cuhornet_SOURCE_DIR}/xlib/include" + "${cuhornet_SOURCE_DIR}/primitives" + ) + endif() +endfunction() + + +find_and_configure_cuhornet() diff --git a/cpp/cmake/thirdparty/get_faiss.cmake b/cpp/cmake/thirdparty/get_faiss.cmake new file mode 100644 index 00000000000..4991990e379 --- /dev/null +++ b/cpp/cmake/thirdparty/get_faiss.cmake @@ -0,0 +1,50 @@ +#============================================================================= +# Copyright (c) 2021, NVIDIA CORPORATION. +# +# 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. +#============================================================================= + +function(find_and_configure_faiss) + set(oneValueArgs VERSION PINNED_TAG) + cmake_parse_arguments(PKG "${options}" "${oneValueArgs}" + "${multiValueArgs}" ${ARGN} ) + + rapids_find_generate_module(FAISS + HEADER_NAMES faiss/IndexFlat.h + LIBRARY_NAMES faiss + ) + + rapids_cpm_find(FAISS ${PKG_VERSION} + GLOBAL_TARGETS faiss + CPM_ARGS + GIT_REPOSITORY https://github.com/facebookresearch/faiss.git + GIT_TAG ${PKG_PINNED_TAG} + OPTIONS + "FAISS_ENABLE_PYTHON OFF" + "BUILD_SHARED_LIBS OFF" + "CUDAToolkit_ROOT ${CUDAToolkit_LIBRARY_DIR}" + "FAISS_ENABLE_GPU ON" + "BUILD_TESTING OFF" + "CMAKE_MESSAGE_LOG_LEVEL VERBOSE" + ) + + if(FAISS_ADDED) + set(FAISS_GPU_HEADERS ${FAISS_SOURCE_DIR} PARENT_SCOPE) + add_library(FAISS::FAISS ALIAS faiss) + endif() + +endfunction() + +find_and_configure_faiss(VERSION 1.7.0 + PINNED_TAG bde7c0027191f29c9dadafe4f6e68ca0ee31fb30 + ) diff --git a/cpp/cmake/thirdparty/get_gtest.cmake b/cpp/cmake/thirdparty/get_gtest.cmake new file mode 100644 index 00000000000..3592c3cb6dd --- /dev/null +++ b/cpp/cmake/thirdparty/get_gtest.cmake @@ -0,0 +1,41 @@ +#============================================================================= +# Copyright (c) 2021, NVIDIA CORPORATION. +# +# 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. +#============================================================================= + +function(find_and_configure_gtest VERSION) + + if(TARGET GTest::gtest) + return() + endif() + + rapids_cpm_find(GTest ${VERSION} + GLOBAL_TARGETS gest gtest_main GTest::gtest GTest::gtest_main + CPM_ARGS + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG release-${VERSION} + GIT_SHALLOW TRUE + OPTIONS "INSTALL_GTEST ON" + # googletest >= 1.10.0 provides a cmake config file -- use it if it exists + FIND_PACKAGE_ARGUMENTS "CONFIG" + ) + + if(NOT TARGET GTest::gtest) + add_library(GTest::gtest ALIAS gtest) + add_library(GTest::gtest_main ALIAS gtest_main) + endif() + +endfunction() + +find_and_configure_gtest(1.10.0) diff --git a/cpp/cmake/thirdparty/get_gunrock.cmake b/cpp/cmake/thirdparty/get_gunrock.cmake new file mode 100644 index 00000000000..ab5fed0a40f --- /dev/null +++ b/cpp/cmake/thirdparty/get_gunrock.cmake @@ -0,0 +1,64 @@ +#============================================================================= +# Copyright (c) 2021, NVIDIA CORPORATION. +# +# 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. +#============================================================================= + +function(find_and_configure_gunrock VERSION) + + if(NOT TARGET gunrock) + set(GUNROCK_GENCODE_SM60 OFF) + set(GUNROCK_GENCODE_SM61 OFF) + set(GUNROCK_GENCODE_SM70 OFF) + set(GUNROCK_GENCODE_SM72 OFF) + set(GUNROCK_GENCODE_SM75 OFF) + set(GUNROCK_GENCODE_SM80 OFF) + + foreach(arch IN LISTS CMAKE_CUDA_ARCHITECTURES) + string(REPLACE "-real" "" ${arch} arch) + set(GUNROCK_GENCODE_SM${arch} "ON") + endforeach() + + # FIXME: gunrock is still using ExternalProject instead of CPM, as version 1.2 + # doesn't work with CPM + + include(ExternalProject) + + set(GUNROCK_DIR ${CMAKE_CURRENT_BINARY_DIR}/gunrock) + ExternalProject_Add(gunrock_ext + GIT_REPOSITORY https://github.com/gunrock/gunrock.git + GIT_TAG v${VERSION} + PREFIX ${GUNROCK_DIR} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX= + -DGUNROCK_BUILD_SHARED_LIBS=OFF + -DGUNROCK_BUILD_TESTS=OFF + -DCUDA_AUTODETECT_GENCODE=OFF + -DGUNROCK_GENCODE_SM60=${GUNROCK_GENCODE_SM60} + -DGUNROCK_GENCODE_SM61=${GUNROCK_GENCODE_SM61} + -DGUNROCK_GENCODE_SM70=${GUNROCK_GENCODE_SM70} + -DGUNROCK_GENCODE_SM72=${GUNROCK_GENCODE_SM72} + -DGUNROCK_GENCODE_SM75=${GUNROCK_GENCODE_SM75} + -DGUNROCK_GENCODE_SM80=${GUNROCK_GENCODE_SM80} + BUILD_BYPRODUCTS ${GUNROCK_DIR}/src/gunrock_ext-build/lib/libgunrock.a + INSTALL_COMMAND "" + ) + + add_library(gunrock STATIC IMPORTED) + add_dependencies(gunrock gunrock_ext) + set_property(TARGET gunrock PROPERTY IMPORTED_LOCATION "${GUNROCK_DIR}/src/gunrock_ext-build/lib/libgunrock.a") + target_include_directories(gunrock INTERFACE "${GUNROCK_DIR}/src/gunrock_ext") + endif() +endfunction() + + +find_and_configure_gunrock(1.2) diff --git a/cpp/cmake/thirdparty/get_nccl.cmake b/cpp/cmake/thirdparty/get_nccl.cmake new file mode 100644 index 00000000000..30ec976f27c --- /dev/null +++ b/cpp/cmake/thirdparty/get_nccl.cmake @@ -0,0 +1,42 @@ +#============================================================================= +# Copyright (c) 2021, NVIDIA CORPORATION. +# +# 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. +#============================================================================= + +function(find_and_configure_nccl) + + if(TARGET NCCL::NCCL) + return() + endif() + + set(oneValueArgs VERSION PINNED_TAG) + cmake_parse_arguments(PKG "${options}" "${oneValueArgs}" + "${multiValueArgs}" ${ARGN} ) + + rapids_find_generate_module(NCCL + HEADER_NAMES nccl.h + LIBRARY_NAMES nccl + ) + + # Currently NCCL has no CMake build-system so we require + # it built and installed on the machine already + rapids_find_package(NCCL REQUIRED) + +endfunction() + +find_and_configure_nccl() + + + + diff --git a/cpp/cmake/thirdparty/get_raft.cmake b/cpp/cmake/thirdparty/get_raft.cmake new file mode 100644 index 00000000000..3e143b660c2 --- /dev/null +++ b/cpp/cmake/thirdparty/get_raft.cmake @@ -0,0 +1,36 @@ +#============================================================================= +# Copyright (c) 2021, NVIDIA CORPORATION. +# +# 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. +#============================================================================= + +function(find_and_configure_raft VERSION) + + rapids_cpm_find(raft ${VERSION} + GLOBAL_TARGETS raft::raft + BUILD_EXPORT_SET cugraph-exports + INSTALL_EXPORT_SET cugraph-exports + CPM_ARGS + # GIT_REPOSITORY https://github.com/rapidsai/raft.git + # GIT_TAG branch-${VERSION} + GIT_REPOSITORY https://github.com/robertmaynard/raft.git + GIT_TAG use_rapids_cmake + SOURCE_SUBDIR cpp + + ) + +endfunction() + +set(CUGRAPH_MIN_VERSION_raft "${CUGRAPH_VERSION_MAJOR}.${CUGRAPH_VERSION_MINOR}") + +find_and_configure_raft(${CUGRAPH_MIN_VERSION_raft}) diff --git a/cpp/cmake/thirdparty/get_rmm.cmake b/cpp/cmake/thirdparty/get_rmm.cmake new file mode 100644 index 00000000000..84d354d01fb --- /dev/null +++ b/cpp/cmake/thirdparty/get_rmm.cmake @@ -0,0 +1,41 @@ +#============================================================================= +# Copyright (c) 2021, NVIDIA CORPORATION. +# +# 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. +#============================================================================= + +function(find_and_configure_rmm VERSION) + + if(TARGET rmm::rmm) + return() + endif() + + rapids_cpm_find(rmm ${VERSION} + GLOBAL_TARGETS rmm::rmm + BUILD_EXPORT_SET cugraph-exports + INSTALL_EXPORT_SET cugraph-exports + CPM_ARGS + GIT_REPOSITORY https://github.com/rapidsai/rmm.git + GIT_TAG branch-${VERSION} + GIT_SHALLOW TRUE + OPTIONS "BUILD_TESTS OFF" + "BUILD_BENCHMARKS OFF" + "CUDA_STATIC_RUNTIME ${CUDA_STATIC_RUNTIME}" + "DISABLE_DEPRECATION_WARNING ${DISABLE_DEPRECATION_WARNING}" + ) + +endfunction() + +set(CUGRAPH_MIN_VERSION_rmm "${CUGRAPH_VERSION_MAJOR}.${CUGRAPH_VERSION_MINOR}") + +find_and_configure_rmm(${CUGRAPH_MIN_VERSION_rmm}) diff --git a/cpp/cmake/thirdparty/get_thrust.cmake b/cpp/cmake/thirdparty/get_thrust.cmake new file mode 100644 index 00000000000..86fcffed5d2 --- /dev/null +++ b/cpp/cmake/thirdparty/get_thrust.cmake @@ -0,0 +1,29 @@ +#============================================================================= +# Copyright (c) 2021, NVIDIA CORPORATION. +# +# 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. +#============================================================================= + +function(find_and_configure_thrust VERSION) + + rapids_cpm_find(Thrust ${VERSION} + CPM_ARGS + GIT_REPOSITORY https://github.com/thrust/thrust.git + GIT_TAG ${VERSION} + ) + + thrust_create_target(cugraph::Thrust FROM_OPTIONS) + +endfunction() + +find_and_configure_thrust(1.12.0) diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index 80484fdfad6..e101e8f9e5e 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -564,6 +564,11 @@ ConfigureTest(RANDOM_WALKS_PROFILING "${RANDOM_WALKS_PROFILING_SRCS}") # - MG tests -------------------------------------------------------------------------------------- if(BUILD_CUGRAPH_MG_TESTS) + + ############################################################################################### + # - find MPI - only enabled if MG tests are to be built + find_package(MPI REQUIRED) + execute_process( COMMAND nvidia-smi -L COMMAND wc -l From 29e171947f8501727bf4c11dcaba6e53a801ead5 Mon Sep 17 00:00:00 2001 From: ptaylor Date: Fri, 7 May 2021 12:08:15 -0500 Subject: [PATCH 02/44] use rapids-cmake HTTPS url --- cpp/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 9f00c985cef..f60bd031017 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -18,8 +18,8 @@ cmake_minimum_required(VERSION 3.20.1 FATAL_ERROR) include(FetchContent) FetchContent_Declare( rapids-cmake - GIT_REPOSITORY git@github.com:rapidsai/rapids-cmake.git - GIT_TAG origin/main + GIT_REPOSITORY https://github.com/rapidsai/rapids-cmake.git + GIT_TAG main ) FetchContent_MakeAvailable(rapids-cmake) include(rapids-cmake) From d58abde6f9f7902a075add0399ff52b690382988 Mon Sep 17 00:00:00 2001 From: ptaylor Date: Fri, 7 May 2021 12:38:13 -0500 Subject: [PATCH 03/44] fix GTest target alias names --- cpp/tests/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index e101e8f9e5e..0019e103eaf 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -91,8 +91,8 @@ function(ConfigureTest CMAKE_TEST_NAME CMAKE_TEST_SRC) PRIVATE cugraphtestutil cugraph - GTest::GTest - GTest::Main + GTest::gtest + GTest::gtest_main ${NCCL_LIBRARIES} cudart cuda @@ -196,8 +196,8 @@ function(ConfigureTestMG CMAKE_TEST_NAME CMAKE_TEST_SRC) PRIVATE cugraphtestutil cugraph - GTest::GTest - GTest::Main + GTest::gtest + GTest::gtest_main ${NCCL_LIBRARIES} cudart cuda From 5b2f073c34f62d4e79a0f213e9868d9e2501a44b Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Fri, 7 May 2021 13:43:49 -0400 Subject: [PATCH 04/44] Checkout rapids-cmake via https --- cpp/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 9f00c985cef..851f863cd78 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -18,7 +18,7 @@ cmake_minimum_required(VERSION 3.20.1 FATAL_ERROR) include(FetchContent) FetchContent_Declare( rapids-cmake - GIT_REPOSITORY git@github.com:rapidsai/rapids-cmake.git + GIT_REPOSITORY https://github.com/rapidsai/rapids-cmake.git GIT_TAG origin/main ) FetchContent_MakeAvailable(rapids-cmake) From 64bd5aa9e57238bfc9334299df76960eada97a46 Mon Sep 17 00:00:00 2001 From: ptaylor Date: Fri, 7 May 2021 12:49:04 -0500 Subject: [PATCH 05/44] rename cuGraph -> cugraph --- cpp/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index f60bd031017..55d26cac168 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -302,7 +302,7 @@ cuGraph library is a collection of GPU accelerated graph algorithms that process ]=]) - rapids_export(INSTALL cuGraph + rapids_export(INSTALL cugraph EXPORT_SET cugraph-exports GLOBAL_TARGETS cugraph NAMESPACE cugraph:: @@ -311,7 +311,7 @@ cuGraph library is a collection of GPU accelerated graph algorithms that process ################################################################################################ # - build export ------------------------------------------------------------------------------- -rapids_export(BUILD cuGraph +rapids_export(BUILD cugraph EXPORT_SET cugraph-exports GLOBAL_TARGETS cugraph NAMESPACE cugraph:: @@ -323,7 +323,7 @@ rapids_export(BUILD cuGraph # requires doxygen and graphviz to be installed # from build directory, run make docs_cugraph -# doc targets for cuGraph +# doc targets for cugraph add_custom_command(OUTPUT CUGRAPH_DOXYGEN WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doxygen COMMAND doxygen Doxyfile From 89c724a59b1646e0eee75e91e8d260387c867d4a Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Fri, 7 May 2021 14:15:36 -0400 Subject: [PATCH 06/44] Explicitly search for Doxygen instead of having it as a side-effect of including RAFT --- cpp/CMakeLists.txt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 9f92b942e5e..e7b24b5d222 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -324,9 +324,12 @@ rapids_export(BUILD cugraph # from build directory, run make docs_cugraph # doc targets for cugraph -add_custom_command(OUTPUT CUGRAPH_DOXYGEN - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doxygen - COMMAND doxygen Doxyfile - VERBATIM) - -add_custom_target(docs_cugraph DEPENDS CUGRAPH_DOXYGEN) +find_package(Doxygen 1.8.11) +if(Doxygen_FOUND) + add_custom_command(OUTPUT CUGRAPH_DOXYGEN + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doxygen + COMMAND doxygen Doxyfile + VERBATIM) + + add_custom_target(docs_cugraph DEPENDS CUGRAPH_DOXYGEN) +endif() From 3e6403965f7270aeca66682d9a7c53fb8bc36f8b Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Fri, 7 May 2021 15:19:56 -0400 Subject: [PATCH 07/44] Use rapids-cmake branch-0.20 --- cpp/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index e7b24b5d222..e6bf47d5bba 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -19,7 +19,7 @@ include(FetchContent) FetchContent_Declare( rapids-cmake GIT_REPOSITORY https://github.com/rapidsai/rapids-cmake.git - GIT_TAG origin/main + GIT_TAG origin/branch-0.20 ) FetchContent_MakeAvailable(rapids-cmake) include(rapids-cmake) From 71f6efc7537ef2ead120433b82a67237a64fcc8c Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Fri, 7 May 2021 15:38:33 -0400 Subject: [PATCH 08/44] cugraph provide an alias target to match exported namespace --- cpp/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index e6bf47d5bba..93e2c219ea9 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -172,6 +172,8 @@ add_library(cugraph SHARED src/tree/mst.cu ) +add_library(cugraph::cugraph ALIAS cugraph) + set_target_properties(cugraph PROPERTIES BUILD_RPATH "\$ORIGIN" INSTALL_RPATH "\$ORIGIN" From e6f7329e3f1d2faaaf7694cc9eeb7e76dcdf24a4 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Mon, 10 May 2021 09:10:32 -0400 Subject: [PATCH 09/44] Update conda CMake requirements --- conda/environments/cugraph_dev_cuda11.0.yml | 2 +- conda/environments/cugraph_dev_cuda11.1.yml | 2 +- conda/environments/cugraph_dev_cuda11.2.yml | 2 +- conda/recipes/libcugraph/meta.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/conda/environments/cugraph_dev_cuda11.0.yml b/conda/environments/cugraph_dev_cuda11.0.yml index 20d56b281d2..e12b6143e69 100644 --- a/conda/environments/cugraph_dev_cuda11.0.yml +++ b/conda/environments/cugraph_dev_cuda11.0.yml @@ -21,7 +21,7 @@ dependencies: - networkx>=2.5.1 - clang=8.0.1 - clang-tools=8.0.1 -- cmake>=3.18 +- cmake>=3.20.1 - python>=3.6,<3.9 - notebook>=0.5.0 - boost diff --git a/conda/environments/cugraph_dev_cuda11.1.yml b/conda/environments/cugraph_dev_cuda11.1.yml index 0eba2baccaa..3fd7013f475 100644 --- a/conda/environments/cugraph_dev_cuda11.1.yml +++ b/conda/environments/cugraph_dev_cuda11.1.yml @@ -21,7 +21,7 @@ dependencies: - networkx>=2.5.1 - clang=8.0.1 - clang-tools=8.0.1 -- cmake>=3.18 +- cmake>=3.20.1 - python>=3.6,<3.9 - notebook>=0.5.0 - boost diff --git a/conda/environments/cugraph_dev_cuda11.2.yml b/conda/environments/cugraph_dev_cuda11.2.yml index 55f6ad75cec..978cbf4dd5f 100644 --- a/conda/environments/cugraph_dev_cuda11.2.yml +++ b/conda/environments/cugraph_dev_cuda11.2.yml @@ -21,7 +21,7 @@ dependencies: - networkx>=2.5.1 - clang=8.0.1 - clang-tools=8.0.1 -- cmake>=3.18 +- cmake>=3.20.1 - python>=3.6,<3.9 - notebook>=0.5.0 - boost diff --git a/conda/recipes/libcugraph/meta.yaml b/conda/recipes/libcugraph/meta.yaml index 71b22c8cf1b..afab0d01dba 100644 --- a/conda/recipes/libcugraph/meta.yaml +++ b/conda/recipes/libcugraph/meta.yaml @@ -31,7 +31,7 @@ build: requirements: build: - - cmake>=3.12.4 + - cmake>=3.20.1 - cudatoolkit {{ cuda_version }}.* - librmm {{ minor_version }}.* - boost-cpp>=1.66 From 74bbea30e6a897b05cf74e40ddfa771770fe3399 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Mon, 10 May 2021 10:37:25 -0400 Subject: [PATCH 10/44] build.sh updated to use CMAKE_CUDA_ARCHITECTURES --- build.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index 7c99b27f632..72b7036d4a0 100755 --- a/build.sh +++ b/build.sh @@ -52,7 +52,7 @@ INSTALL_TARGET=install BUILD_DISABLE_DEPRECATION_WARNING=ON BUILD_CPP_MG_TESTS=OFF BUILD_STATIC_FAISS=OFF -GPU_ARCH="" +BUILD_ALL_GPU_ARCH=0 # Set defaults for vars that may not have been defined externally # FIXME: if PREFIX is not set, check CONDA_PREFIX, but there is no fallback @@ -95,7 +95,7 @@ if hasArg -n; then INSTALL_TARGET="" fi if hasArg --allgpuarch; then - GPU_ARCH="-DGPU_ARCHS=ALL" + BUILD_ALL_GPU_ARCH=1 fi if hasArg --buildfaiss; then BUILD_STATIC_FAISS=ON @@ -129,15 +129,17 @@ fi ################################################################################ # Configure, build, and install libcugraph if buildAll || hasArg libcugraph; then - if [[ ${GPU_ARCH} == "" ]]; 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_BUILD_DIR} cd ${LIBCUGRAPH_BUILD_DIR} cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \ - ${GPU_ARCH} \ + -DCMAKE_CUDA_ARCHITECTURES=${CUGRAPH_CMAKE_CUDA_ARCHITECTURES} \ -DDISABLE_DEPRECATION_WARNING=${BUILD_DISABLE_DEPRECATION_WARNING} \ -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ -DBUILD_STATIC_FAISS=${BUILD_STATIC_FAISS} \ From 9e58947ac7896f5d6ab2f3ecbac7e5d291ec73e5 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Mon, 10 May 2021 15:53:35 -0400 Subject: [PATCH 11/44] Correct issues in compiling tests found by CI --- cpp/CMakeLists.txt | 32 +++--- cpp/cmake/thirdparty/get_gtest.cmake | 4 +- cpp/cmake/thirdparty/get_raft.cmake | 1 + cpp/tests/CMakeLists.txt | 149 +++++++-------------------- 4 files changed, 56 insertions(+), 130 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index ee92a45b9b4..f804745840b 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -108,6 +108,7 @@ endif() rapids_cpm_init() + include(cmake/thirdparty/get_thrust.cmake) include(cmake/thirdparty/get_faiss.cmake) include(cmake/thirdparty/get_nccl.cmake) @@ -193,7 +194,6 @@ target_compile_definitions(cugraph PUBLIC CUDA_API_PER_THREAD_DEFAULT_STREAM) # - include paths --------------------------------------------------------------------------------- target_include_directories(cugraph PRIVATE - "${CUCO_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/../thirdparty" "${CMAKE_CURRENT_SOURCE_DIR}/src" "${NCCL_INCLUDE_DIRS}" @@ -205,21 +205,21 @@ target_include_directories(cugraph ################################################################################################### # - link libraries -------------------------------------------------------------------------------- target_link_libraries(cugraph - PUBLIC - rmm::rmm - cugraph::Thrust - raft::raft - PRIVATE - cuco::cuco - CUDA::cublas - CUDA::curand - CUDA::cusolver - CUDA::cusparse - cugraph::cuHornet - FAISS::FAISS - gunrock - NCCL::NCCL - ) + PUBLIC + rmm::rmm + cugraph::Thrust + raft::raft + PRIVATE + cuco::cuco + CUDA::cublas + CUDA::curand + CUDA::cusolver + CUDA::cusparse + cugraph::cuHornet + FAISS::FAISS + gunrock + NCCL::NCCL +) if(OpenMP_CXX_FOUND) target_link_libraries(cugraph PRIVATE diff --git a/cpp/cmake/thirdparty/get_gtest.cmake b/cpp/cmake/thirdparty/get_gtest.cmake index 3592c3cb6dd..e413cad7601 100644 --- a/cpp/cmake/thirdparty/get_gtest.cmake +++ b/cpp/cmake/thirdparty/get_gtest.cmake @@ -21,7 +21,7 @@ function(find_and_configure_gtest VERSION) endif() rapids_cpm_find(GTest ${VERSION} - GLOBAL_TARGETS gest gtest_main GTest::gtest GTest::gtest_main + GLOBAL_TARGETS gmock gmock_main gtest gtest_main GTest::gmock GTest::gtest GTest::gtest_main CPM_ARGS GIT_REPOSITORY https://github.com/google/googletest.git GIT_TAG release-${VERSION} @@ -32,6 +32,8 @@ function(find_and_configure_gtest VERSION) ) if(NOT TARGET GTest::gtest) + add_library(GTest::gmock ALIAS gmock) + add_library(GTest::gmock_main ALIAS gmock_main) add_library(GTest::gtest ALIAS gtest) add_library(GTest::gtest_main ALIAS gtest_main) endif() diff --git a/cpp/cmake/thirdparty/get_raft.cmake b/cpp/cmake/thirdparty/get_raft.cmake index 3e143b660c2..3635b24a184 100644 --- a/cpp/cmake/thirdparty/get_raft.cmake +++ b/cpp/cmake/thirdparty/get_raft.cmake @@ -26,6 +26,7 @@ function(find_and_configure_raft VERSION) GIT_REPOSITORY https://github.com/robertmaynard/raft.git GIT_TAG use_rapids_cmake SOURCE_SUBDIR cpp + OPTIONS "BUILD_TESTS OFF" ) diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index 0019e103eaf..26385ac382e 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -20,43 +20,30 @@ # - common test utils ----------------------------------------------------------------------------- add_library(cugraphtestutil STATIC - "${CMAKE_CURRENT_SOURCE_DIR}/utilities/matrix_market_file_utilities.cu" - "${CMAKE_CURRENT_SOURCE_DIR}/utilities/rmat_utilities.cu" - "${CMAKE_CURRENT_SOURCE_DIR}/utilities/generate_graph_from_edgelist.cu" - "${CMAKE_CURRENT_SOURCE_DIR}/utilities/thrust_wrapper.cu" - "${CMAKE_CURRENT_SOURCE_DIR}/utilities/misc_utilities.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/components/wcc_graphs.cu" + utilities/matrix_market_file_utilities.cu + utilities/rmat_utilities.cu + utilities/generate_graph_from_edgelist.cu + utilities/thrust_wrapper.cu + utilities/misc_utilities.cpp + components/wcc_graphs.cu "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio/mmio.c") set_property(TARGET cugraphtestutil PROPERTY POSITION_INDEPENDENT_CODE ON) target_include_directories(cugraphtestutil - PRIVATE - "${CUB_INCLUDE_DIR}" - "${THRUST_INCLUDE_DIR}" - "${CUCO_INCLUDE_DIR}" - "${LIBCUDACXX_INCLUDE_DIR}" - "${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}" - "${RMM_INCLUDE}" - "${NCCL_INCLUDE_DIRS}" - "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio" - "${CMAKE_CURRENT_SOURCE_DIR}/../include" - "${CMAKE_CURRENT_SOURCE_DIR}" - "${RAFT_DIR}/cpp/include" + PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio" + "${CMAKE_CURRENT_SOURCE_DIR}" + "${CUGRAPH_SOURCE_DIR}/src" ) -target_link_libraries(cugraphtestutil cugraph) +target_link_libraries(cugraphtestutil + PUBLIC + cugraph + cuco::cuco + NCCL::NCCL +) -# CUDA_ARCHITECTURES=OFF implies cmake will not pass arch flags to the -# compiler. CUDA_ARCHITECTURES must be set to a non-empty value to prevent -# cmake warnings about policy CMP0104. With this setting, arch flags must be -# manually set! ("evaluate_gpu_archs(GPU_ARCHS)" is the current mechanism -# used in cpp/CMakeLists.txt for setting arch options). -# Run "cmake --help-policy CMP0104" for policy details. -# NOTE: the CUDA_ARCHITECTURES=OFF setting may be removed after migrating to -# the findcudatoolkit features in cmake 3.17+ -set_target_properties(cugraphtestutil PROPERTIES - CUDA_ARCHITECTURES OFF) ################################################################################################### # - compiler function ----------------------------------------------------------------------------- @@ -65,41 +52,20 @@ function(ConfigureTest CMAKE_TEST_NAME CMAKE_TEST_SRC) add_executable(${CMAKE_TEST_NAME} ${CMAKE_TEST_SRC}) - target_include_directories(${CMAKE_TEST_NAME} - PRIVATE - "${CUB_INCLUDE_DIR}" - "${THRUST_INCLUDE_DIR}" - "${CUCO_INCLUDE_DIR}" - "${LIBCUDACXX_INCLUDE_DIR}" - "${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}" - "${RMM_INCLUDE}" - "${NCCL_INCLUDE_DIRS}" - "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio" - "${CMAKE_CURRENT_SOURCE_DIR}/../include" - "${CMAKE_CURRENT_SOURCE_DIR}/../src" - "${CMAKE_CURRENT_SOURCE_DIR}" - "${RAFT_DIR}/cpp/include" - ) - - target_link_directories(${CMAKE_TEST_NAME} - PRIVATE - # CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES is an undocumented/unsupported - # variable containing the link directories for nvcc. - "${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}") - target_link_libraries(${CMAKE_TEST_NAME} PRIVATE - cugraphtestutil - cugraph - GTest::gtest - GTest::gtest_main - ${NCCL_LIBRARIES} - cudart - cuda - cublas - cusparse - cusolver - curand) + cugraphtestutil + cugraph + GTest::gmock + GTest::gmock_main + GTest::gtest + GTest::gtest_main + NCCL::NCCL + CUDA::cublas + CUDA::cusparse + CUDA::cusolver + CUDA::curand + ) if(OpenMP_CXX_FOUND) target_link_libraries(${CMAKE_TEST_NAME} PRIVATE @@ -152,17 +118,6 @@ function(ConfigureTest CMAKE_TEST_NAME CMAKE_TEST_SRC) ${OpenMP_CXX_LIB_NAMES}) endif(OpenMP_CXX_FOUND) - # CUDA_ARCHITECTURES=OFF implies cmake will not pass arch flags to the - # compiler. CUDA_ARCHITECTURES must be set to a non-empty value to prevent - # cmake warnings about policy CMP0104. With this setting, arch flags must be - # manually set! ("evaluate_gpu_archs(GPU_ARCHS)" is the current mechanism - # used in cpp/CMakeLists.txt for setting arch options). - # Run "cmake --help-policy CMP0104" for policy details. - # NOTE: the CUDA_ARCHITECTURES=OFF setting may be removed after migrating to - # the findcudatoolkit features in cmake 3.17+ - set_target_properties(${CMAKE_TEST_NAME} PROPERTIES - CUDA_ARCHITECTURES OFF) - add_test(NAME ${CMAKE_TEST_NAME} COMMAND ${CMAKE_TEST_NAME}) endfunction() @@ -170,41 +125,20 @@ function(ConfigureTestMG CMAKE_TEST_NAME CMAKE_TEST_SRC) add_executable(${CMAKE_TEST_NAME} ${CMAKE_TEST_SRC}) - target_include_directories(${CMAKE_TEST_NAME} - PRIVATE - "${CUB_INCLUDE_DIR}" - "${THRUST_INCLUDE_DIR}" - "${CUCO_INCLUDE_DIR}" - "${LIBCUDACXX_INCLUDE_DIR}" - "${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}" - "${RMM_INCLUDE}" - "${NCCL_INCLUDE_DIRS}" - "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio" - "${CMAKE_CURRENT_SOURCE_DIR}/../include" - "${CMAKE_CURRENT_SOURCE_DIR}/../src" - "${CMAKE_CURRENT_SOURCE_DIR}" - "${RAFT_DIR}/cpp/include" - ) - - target_link_directories(${CMAKE_TEST_NAME} - PRIVATE - # CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES is an undocumented/unsupported - # variable containing the link directories for nvcc. - "${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}") - target_link_libraries(${CMAKE_TEST_NAME} PRIVATE cugraphtestutil cugraph + GTest::gmock + GTest::gmock_main GTest::gtest GTest::gtest_main - ${NCCL_LIBRARIES} - cudart - cuda - cublas - cusparse - cusolver - curand) + NCCL::NCCL + CUDA::cublas + CUDA::cusparse + CUDA::cusolver + CUDA::curand + ) if(OpenMP_CXX_FOUND) target_link_libraries(${CMAKE_TEST_NAME} PRIVATE @@ -257,17 +191,6 @@ function(ConfigureTestMG CMAKE_TEST_NAME CMAKE_TEST_SRC) ${OpenMP_CXX_LIB_NAMES}) endif(OpenMP_CXX_FOUND) - # CUDA_ARCHITECTURES=OFF implies cmake will not pass arch flags to the - # compiler. CUDA_ARCHITECTURES must be set to a non-empty value to prevent - # cmake warnings about policy CMP0104. With this setting, arch flags must be - # manually set! ("evaluate_gpu_archs(GPU_ARCHS)" is the current mechanism - # used in cpp/CMakeLists.txt for setting arch options). - # Run "cmake --help-policy CMP0104" for policy details. - # NOTE: the CUDA_ARCHITECTURES=OFF setting may be removed after migrating to - # the findcudatoolkit features in cmake 3.17+ - set_target_properties(${CMAKE_TEST_NAME} PROPERTIES - CUDA_ARCHITECTURES OFF) - add_test(NAME ${CMAKE_TEST_NAME} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} From dbaf6a447b6acded91cc5a47fa16c46d2682bcf6 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Mon, 10 May 2021 17:25:37 -0400 Subject: [PATCH 12/44] Refactor cugraph test CMakeLists.txt to follow modern style --- cpp/tests/CMakeLists.txt | 259 ++++++++------------------------------- 1 file changed, 50 insertions(+), 209 deletions(-) diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index 26385ac382e..d19cd5905c2 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -48,9 +48,8 @@ target_link_libraries(cugraphtestutil ################################################################################################### # - compiler function ----------------------------------------------------------------------------- -function(ConfigureTest CMAKE_TEST_NAME CMAKE_TEST_SRC) - add_executable(${CMAKE_TEST_NAME} - ${CMAKE_TEST_SRC}) +function(ConfigureTest CMAKE_TEST_NAME) + add_executable(${CMAKE_TEST_NAME} ${ARGN}) target_link_libraries(${CMAKE_TEST_NAME} PRIVATE @@ -121,9 +120,8 @@ function(ConfigureTest CMAKE_TEST_NAME CMAKE_TEST_SRC) add_test(NAME ${CMAKE_TEST_NAME} COMMAND ${CMAKE_TEST_NAME}) endfunction() -function(ConfigureTestMG CMAKE_TEST_NAME CMAKE_TEST_SRC) - add_executable(${CMAKE_TEST_NAME} - ${CMAKE_TEST_SRC}) +function(ConfigureTestMG CMAKE_TEST_NAME) + add_executable(${CMAKE_TEST_NAME} ${ARGN}) target_link_libraries(${CMAKE_TEST_NAME} PRIVATE @@ -138,6 +136,7 @@ function(ConfigureTestMG CMAKE_TEST_NAME CMAKE_TEST_SRC) CUDA::cusparse CUDA::cusolver CUDA::curand + MPI::MPI_CXX ) if(OpenMP_CXX_FOUND) @@ -216,271 +215,138 @@ endif(RAPIDS_DATASET_ROOT_DIR) ################################################################################################### # - katz centrality tests ------------------------------------------------------------------------- - -set(KATZ_TEST_SRC - "${CMAKE_CURRENT_SOURCE_DIR}/centrality/katz_centrality_test.cu") - - ConfigureTest(KATZ_TEST "${KATZ_TEST_SRC}") +ConfigureTest(KATZ_TEST centrality/katz_centrality_test.cu) ################################################################################################### # - betweenness centrality tests ------------------------------------------------------------------ - -set(BETWEENNESS_TEST_SRC - "${CMAKE_CURRENT_SOURCE_DIR}/centrality/betweenness_centrality_test.cu") - - ConfigureTest(BETWEENNESS_TEST "${BETWEENNESS_TEST_SRC}") - -set(EDGE_BETWEENNESS_TEST_SRC - "${CMAKE_CURRENT_SOURCE_DIR}/centrality/edge_betweenness_centrality_test.cu") - - ConfigureTest(EDGE_BETWEENNESS_TEST "${EDGE_BETWEENNESS_TEST_SRC}") +ConfigureTest(BETWEENNESS_TEST centrality/betweenness_centrality_test.cu) +ConfigureTest(EDGE_BETWEENNESS_TEST centrality/edge_betweenness_centrality_test.cu) ################################################################################################### # - SSSP tests ------------------------------------------------------------------------------------ - -set(SSSP_TEST_SRCS - "${CMAKE_CURRENT_SOURCE_DIR}/traversal/sssp_test.cu") - -ConfigureTest(SSSP_TEST "${SSSP_TEST_SRCS}") +ConfigureTest(SSSP_TEST traversal/sssp_test.cu) ################################################################################################### # - BFS tests ------------------------------------------------------------------------------------- - -set(BFS_TEST_SRCS - "${CMAKE_CURRENT_SOURCE_DIR}/traversal/bfs_test.cu") - -ConfigureTest(BFS_TEST "${BFS_TEST_SRCS}") +ConfigureTest(BFS_TEST traversal/bfs_test.cu) ################################################################################################### # - LOUVAIN tests --------------------------------------------------------------------------------- - -set(LOUVAIN_TEST_SRC - "${CMAKE_CURRENT_SOURCE_DIR}/community/louvain_test.cpp") - -ConfigureTest(LOUVAIN_TEST "${LOUVAIN_TEST_SRC}") +ConfigureTest(LOUVAIN_TEST community/louvain_test.cpp) ################################################################################################### # - LEIDEN tests --------------------------------------------------------------------------------- - -set(LEIDEN_TEST_SRC - "${CMAKE_CURRENT_SOURCE_DIR}/community/leiden_test.cpp") - -ConfigureTest(LEIDEN_TEST "${LEIDEN_TEST_SRC}") +ConfigureTest(LEIDEN_TEST community/leiden_test.cpp) ################################################################################################### # - ECG tests --------------------------------------------------------------------------------- - -set(ECG_TEST_SRC - "${CMAKE_CURRENT_SOURCE_DIR}/community/ecg_test.cpp") - -ConfigureTest(ECG_TEST "${ECG_TEST_SRC}") +ConfigureTest(ECG_TEST community/ecg_test.cpp) ################################################################################################### # - Balanced cut clustering tests ----------------------------------------------------------------- - -set(BALANCED_TEST_SRC - "${CMAKE_CURRENT_SOURCE_DIR}/community/balanced_edge_test.cpp") - -ConfigureTest(BALANCED_TEST "${BALANCED_TEST_SRC}") +ConfigureTest(BALANCED_TEST community/balanced_edge_test.cpp) ################################################################################################### # - TRIANGLE tests -------------------------------------------------------------------------------- - -set(TRIANGLE_TEST_SRC - "${CMAKE_CURRENT_SOURCE_DIR}/community/triangle_test.cu") - -ConfigureTest(TRIANGLE_TEST "${TRIANGLE_TEST_SRC}") +ConfigureTest(TRIANGLE_TEST community/triangle_test.cu) ################################################################################################### # - EGO tests -------------------------------------------------------------------------------- +ConfigureTest(EGO_TEST community/egonet_test.cu) -set(EGO_TEST_SRC - "${CMAKE_CURRENT_SOURCE_DIR}/community/egonet_test.cu") - -ConfigureTest(EGO_TEST "${EGO_TEST_SRC}" "") ################################################################################################### # - RENUMBERING tests ----------------------------------------------------------------------------- - -set(RENUMBERING_TEST_SRC - "${CMAKE_CURRENT_SOURCE_DIR}/renumber/renumber_test.cu") - -ConfigureTest(RENUMBERING_TEST "${RENUMBERING_TEST_SRC}") +ConfigureTest(RENUMBERING_TEST renumber/renumber_test.cu) ################################################################################################### # - FORCE ATLAS 2 tests -------------------------------------------------------------------------- - -set(FA2_TEST_SRC - "${CMAKE_CURRENT_SOURCE_DIR}/layout/force_atlas2_test.cu") - -ConfigureTest(FA2_TEST "${FA2_TEST_SRC}") +ConfigureTest(FA2_TEST layout/force_atlas2_test.cu) ################################################################################################### # - TSP tests -------------------------------------------------------------------------- - -set(TSP_TEST_SRC - "${CMAKE_CURRENT_SOURCE_DIR}/traversal/tsp_test.cu") - - ConfigureTest(TSP_TEST "${TSP_TEST_SRC}" "") +ConfigureTest(TSP_TEST traversal/tsp_test.cu) ################################################################################################### # - CONNECTED COMPONENTS tests ------------------------------------------------------------------- - -set(CONNECT_TEST_SRC - "${CMAKE_CURRENT_SOURCE_DIR}/components/con_comp_test.cu") - -ConfigureTest(CONNECT_TEST "${CONNECT_TEST_SRC}") +ConfigureTest(CONNECT_TEST components/con_comp_test.cu) ################################################################################################### # - STRONGLY CONNECTED COMPONENTS tests ---------------------------------------------------------- - -set(SCC_TEST_SRC - "${CMAKE_CURRENT_SOURCE_DIR}/components/scc_test.cu") - -ConfigureTest(SCC_TEST "${SCC_TEST_SRC}") +ConfigureTest(SCC_TEST components/scc_test.cu) ################################################################################################### # - WEAKLY CONNECTED COMPONENTS tests ---------------------------------------------------------- - -set(WCC_TEST_SRC - "${CMAKE_CURRENT_SOURCE_DIR}/components/wcc_test.cpp") - -ConfigureTest(WCC_TEST "${WCC_TEST_SRC}") +ConfigureTest(WCC_TEST components/wcc_test.cpp) ################################################################################################### -#-Hungarian (Linear Assignment Problem) tests --------------------------------------------------------------------- - -set(HUNGARIAN_TEST_SRC - "${CMAKE_CURRENT_SOURCE_DIR}/linear_assignment/hungarian_test.cu") - -ConfigureTest(HUNGARIAN_TEST "${HUNGARIAN_TEST_SRC}") +#-Hungarian (Linear Assignment Problem) tests ---------------------------------------------------- +ConfigureTest(HUNGARIAN_TEST linear_assignment/hungarian_test.cu) ################################################################################################### # - MST tests ---------------------------------------------------------------------------- - -set(MST_TEST_SRC - "${CMAKE_CURRENT_SOURCE_DIR}/tree/mst_test.cu") - -ConfigureTest(MST_TEST "${MST_TEST_SRC}") +ConfigureTest(MST_TEST tree/mst_test.cu) ################################################################################################### # - Experimental stream tests ----------------------------------------------------- - -set(EXPERIMENTAL_STREAM_SRCS - "${CMAKE_CURRENT_SOURCE_DIR}/experimental/streams.cu") - -ConfigureTest(EXPERIMENTAL_STREAM "${EXPERIMENTAL_STREAM_SRCS}" "") +ConfigureTest(EXPERIMENTAL_STREAM experimental/streams.cu) ################################################################################################### # - Experimental R-mat graph generation tests ----------------------------------------------------- - -set(EXPERIMENTAL_GENERATE_RMAT_TEST_SRCS - "${CMAKE_CURRENT_SOURCE_DIR}/experimental/generate_rmat_test.cpp") - -ConfigureTest(EXPERIMENTAL_GENERATE_RMAT_TEST "${EXPERIMENTAL_GENERATE_RMAT_TEST_SRCS}" "") +ConfigureTest(EXPERIMENTAL_GENERATE_RMAT_TEST experimental/generate_rmat_test.cpp) ################################################################################################### # - Experimental Graph tests ---------------------------------------------------------------------- - -set(EXPERIMENTAL_GRAPH_TEST_SRCS - "${CMAKE_CURRENT_SOURCE_DIR}/experimental/graph_test.cpp") - -ConfigureTest(EXPERIMENTAL_GRAPH_TEST "${EXPERIMENTAL_GRAPH_TEST_SRCS}") +ConfigureTest(EXPERIMENTAL_GRAPH_TEST experimental/graph_test.cpp) ################################################################################################### # - Experimental weight-sum tests ----------------------------------------------------------------- - -set(EXPERIMENTAL_WEIGHT_SUM_TEST_SRCS - "${CMAKE_CURRENT_SOURCE_DIR}/experimental/weight_sum_test.cpp") - -ConfigureTest(EXPERIMENTAL_WEIGHT_SUM_TEST "${EXPERIMENTAL_WEIGHT_SUM_TEST_SRCS}") +ConfigureTest(EXPERIMENTAL_WEIGHT_SUM_TEST experimental/weight_sum_test.cpp) ################################################################################################### # - Experimental degree tests --------------------------------------------------------------------- - -set(EXPERIMENTAL_DEGREE_TEST_SRCS - "${CMAKE_CURRENT_SOURCE_DIR}/experimental/degree_test.cpp") - -ConfigureTest(EXPERIMENTAL_DEGREE_TEST "${EXPERIMENTAL_DEGREE_TEST_SRCS}") +ConfigureTest(EXPERIMENTAL_DEGREE_TEST experimental/degree_test.cpp) ################################################################################################### # - Experimental coarsening tests ----------------------------------------------------------------- - -set(EXPERIMENTAL_COARSEN_GRAPH_TEST_SRCS - "${CMAKE_CURRENT_SOURCE_DIR}/experimental/coarsen_graph_test.cpp") - -ConfigureTest(EXPERIMENTAL_COARSEN_GRAPH_TEST "${EXPERIMENTAL_COARSEN_GRAPH_TEST_SRCS}") +ConfigureTest(EXPERIMENTAL_COARSEN_GRAPH_TEST experimental/coarsen_graph_test.cpp) ################################################################################################### # - Experimental induced subgraph tests ----------------------------------------------------------- - -set(EXPERIMENTAL_INDUCED_SUBGRAPH_TEST_SRCS - "${CMAKE_CURRENT_SOURCE_DIR}/experimental/induced_subgraph_test.cpp") - -ConfigureTest(EXPERIMENTAL_INDUCED_SUBGRAPH_TEST "${EXPERIMENTAL_INDUCED_SUBGRAPH_TEST_SRCS}") +ConfigureTest(EXPERIMENTAL_INDUCED_SUBGRAPH_TEST experimental/induced_subgraph_test.cpp) ################################################################################################### # - Experimental BFS tests ------------------------------------------------------------------------ - -set(EXPERIMENTAL_BFS_TEST_SRCS - "${CMAKE_CURRENT_SOURCE_DIR}/experimental/bfs_test.cpp") - -ConfigureTest(EXPERIMENTAL_BFS_TEST "${EXPERIMENTAL_BFS_TEST_SRCS}") +ConfigureTest(EXPERIMENTAL_BFS_TEST experimental/bfs_test.cpp) ################################################################################################### # - Experimental BFS tests ------------------------------------------------------------------------ - -set(EXPERIMENTAL_MSBFS_TEST_SRCS - "${CMAKE_CURRENT_SOURCE_DIR}/experimental/ms_bfs_test.cpp") - -ConfigureTest(EXPERIMENTAL_MSBFS_TEST "${EXPERIMENTAL_MSBFS_TEST_SRCS}") +ConfigureTest(EXPERIMENTAL_MSBFS_TEST experimental/ms_bfs_test.cpp) ################################################################################################### # - Experimental SSSP tests ----------------------------------------------------------------------- - -set(EXPERIMENTAL_SSSP_TEST_SRCS - "${CMAKE_CURRENT_SOURCE_DIR}/experimental/sssp_test.cpp") - -ConfigureTest(EXPERIMENTAL_SSSP_TEST "${EXPERIMENTAL_SSSP_TEST_SRCS}") +ConfigureTest(EXPERIMENTAL_SSSP_TEST experimental/sssp_test.cpp) ################################################################################################### # - Experimental PAGERANK tests ------------------------------------------------------------------- - -set(EXPERIMENTAL_PAGERANK_TEST_SRCS - "${CMAKE_CURRENT_SOURCE_DIR}/experimental/pagerank_test.cpp") - -ConfigureTest(EXPERIMENTAL_PAGERANK_TEST "${EXPERIMENTAL_PAGERANK_TEST_SRCS}") +ConfigureTest(EXPERIMENTAL_PAGERANK_TEST experimental/pagerank_test.cpp) ################################################################################################### # - Experimental KATZ_CENTRALITY tests ------------------------------------------------------------ - -set(EXPERIMENTAL_KATZ_CENTRALITY_TEST_SRCS - "${CMAKE_CURRENT_SOURCE_DIR}/experimental/katz_centrality_test.cpp") - -ConfigureTest(EXPERIMENTAL_KATZ_CENTRALITY_TEST "${EXPERIMENTAL_KATZ_CENTRALITY_TEST_SRCS}") +ConfigureTest(EXPERIMENTAL_KATZ_CENTRALITY_TEST experimental/katz_centrality_test.cpp) ################################################################################################### # - Experimental RANDOM_WALKS tests ------------------------------------------------------------ - -set(RANDOM_WALKS_TEST_SRCS - "${CMAKE_CURRENT_SOURCE_DIR}/sampling/random_walks_test.cu") - -ConfigureTest(RANDOM_WALKS_TEST "${RANDOM_WALKS_TEST_SRCS}") +ConfigureTest(RANDOM_WALKS_TEST sampling/random_walks_test.cu) ################################################################################################### -set(RANDOM_WALKS_LOW_LEVEL_SRCS - "${CMAKE_CURRENT_SOURCE_DIR}/sampling/rw_low_level_test.cu") - -ConfigureTest(RANDOM_WALKS_LOW_LEVEL_TEST "${RANDOM_WALKS_LOW_LEVEL_SRCS}") +ConfigureTest(RANDOM_WALKS_LOW_LEVEL_TEST sampling/rw_low_level_test.cu) ################################################################################################### -set(RANDOM_WALKS_PROFILING_SRCS - "${CMAKE_CURRENT_SOURCE_DIR}/sampling/random_walks_profiling.cu") - # FIXME: since this is technically not a test, consider refactoring the the # ConfigureTest function to share common code with a new ConfigureBenchmark # function (which would not link gtest, etc.) -ConfigureTest(RANDOM_WALKS_PROFILING "${RANDOM_WALKS_PROFILING_SRCS}") +ConfigureTest(RANDOM_WALKS_PROFILING sampling/random_walks_profiling.cu) ################################################################################################### @@ -503,54 +369,29 @@ if(BUILD_CUGRAPH_MG_TESTS) if(MPI_CXX_FOUND) ########################################################################################### # - MG PAGERANK tests --------------------------------------------------------------------- - - set(MG_PAGERANK_TEST_SRCS - "${CMAKE_CURRENT_SOURCE_DIR}/pagerank/mg_pagerank_test.cpp") - - ConfigureTestMG(MG_PAGERANK_TEST "${MG_PAGERANK_TEST_SRCS}") - target_link_libraries(MG_PAGERANK_TEST PRIVATE MPI::MPI_C MPI::MPI_CXX) + ConfigureTestMG(MG_PAGERANK_TEST pagerank/mg_pagerank_test.cpp) ########################################################################################### # - MG KATZ CENTRALITY tests -------------------------------------------------------------- - - set(MG_KATZ_CENTRALITY_TEST_SRCS - "${CMAKE_CURRENT_SOURCE_DIR}/experimental/mg_katz_centrality_test.cpp") - - ConfigureTestMG(MG_KATZ_CENTRALITY_TEST "${MG_KATZ_CENTRALITY_TEST_SRCS}") - target_link_libraries(MG_KATZ_CENTRALITY_TEST PRIVATE MPI::MPI_C MPI::MPI_CXX) + ConfigureTestMG(MG_KATZ_CENTRALITY_TEST experimental/mg_katz_centrality_test.cpp) ########################################################################################### # - MG BFS tests -------------------------------------------------------------------------- - - set(MG_BFS_TEST_SRCS - "${CMAKE_CURRENT_SOURCE_DIR}/experimental/mg_bfs_test.cpp") - - ConfigureTestMG(MG_BFS_TEST "${MG_BFS_TEST_SRCS}") - target_link_libraries(MG_BFS_TEST PRIVATE MPI::MPI_C MPI::MPI_CXX) + ConfigureTestMG(MG_BFS_TEST experimental/mg_bfs_test.cpp) ########################################################################################### # - MG SSSP tests ------------------------------------------------------------------------- - - set(MG_SSSP_TEST_SRCS - "${CMAKE_CURRENT_SOURCE_DIR}/experimental/mg_sssp_test.cpp") - - ConfigureTestMG(MG_SSSP_TEST "${MG_SSSP_TEST_SRCS}") - target_link_libraries(MG_SSSP_TEST PRIVATE MPI::MPI_C MPI::MPI_CXX) + ConfigureTestMG(MG_SSSP_TEST experimental/mg_sssp_test.cpp) ########################################################################################### # - MG LOUVAIN tests ---------------------------------------------------------------------- - - set(MG_LOUVAIN_TEST_SRCS - "${CMAKE_CURRENT_SOURCE_DIR}/community/mg_louvain_helper.cu" - "${CMAKE_CURRENT_SOURCE_DIR}/community/mg_louvain_test.cpp") - - ConfigureTestMG(MG_LOUVAIN_TEST "${MG_LOUVAIN_TEST_SRCS}") - target_link_libraries(MG_LOUVAIN_TEST PRIVATE MPI::MPI_C MPI::MPI_CXX) - - else(MPI_CXX_FOUND) + ConfigureTestMG(MG_LOUVAIN_TEST + community/mg_louvain_helper.cu + community/mg_louvain_test.cpp) + else() message(FATAL_ERROR "OpenMPI NOT found, cannot build MG tests.") - endif(MPI_CXX_FOUND) -endif(BUILD_CUGRAPH_MG_TESTS) + endif() +endif() ################################################################################################### ### enable testing ################################################################################ From 170d17d326492e9a9868442618c2275fe0aa0f1a Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Mon, 10 May 2021 17:25:55 -0400 Subject: [PATCH 13/44] Refactor cugraph test CMakeLists.txt to follow modern style --- cpp/tests/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index d19cd5905c2..d7d0f8f8fa9 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -322,7 +322,6 @@ ConfigureTest(EXPERIMENTAL_BFS_TEST experimental/bfs_test.cpp) # - Experimental BFS tests ------------------------------------------------------------------------ ConfigureTest(EXPERIMENTAL_MSBFS_TEST experimental/ms_bfs_test.cpp) - ################################################################################################### # - Experimental SSSP tests ----------------------------------------------------------------------- ConfigureTest(EXPERIMENTAL_SSSP_TEST experimental/sssp_test.cpp) From 52fb9640bd57a09b48277e1ad66d0aed966d5f27 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Tue, 11 May 2021 08:20:26 -0400 Subject: [PATCH 14/44] cugraph won't try to compile for unsupported archs --- cpp/CMakeLists.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index f804745840b..bf032fc30de 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -32,6 +32,28 @@ rapids_cuda_init_architectures(CUGRAPH) project(CUGRAPH VERSION 0.20.0 LANGUAGES C CXX CUDA) +# Remove the following archs from CMAKE_CUDA_ARCHITECTURES that +# cuhornet currently doesn't support +# +# < 60 +# >= 86 +set(supported_archs "60" "62" "70" "72" "75" "80") +foreach( arch IN LISTS CMAKE_CUDA_ARCHITECTURES) + string(REPLACE "-real" "" arch ${arch}) + if( arch IN_LIST supported_archs ) + list(APPEND usable_arch_values ${arch}) + endif() +endforeach() +# Make sure everything but the 'newest' arch +# is marked as `-real` so we only generate PTX for +# arch > 80 +list(POP_BACK usable_arch_values latest_arch) +list(TRANSFORM usable_arch_values APPEND "-real") +list(APPEND usable_arch_values ${latest_arch}) + +set(CMAKE_CUDA_ARCHITECTURES ${usable_arch_values}) + + # Write the version header include(cmake/Modules/Version.cmake) write_version() From af21f48ef860e334139b8136710f2849c0c9cef5 Mon Sep 17 00:00:00 2001 From: Dante Gama Dessavre Date: Tue, 11 May 2021 10:26:31 -0500 Subject: [PATCH 15/44] :ENH Updates to get_raft and setuputils for changes for using rapids-cmake --- cpp/cmake/thirdparty/get_raft.cmake | 36 +++++++++++++------ python/setup.py | 5 +-- python/setuputils.py | 56 ++++++++++++++--------------- 3 files changed, 54 insertions(+), 43 deletions(-) diff --git a/cpp/cmake/thirdparty/get_raft.cmake b/cpp/cmake/thirdparty/get_raft.cmake index 3e143b660c2..6bfa214276b 100644 --- a/cpp/cmake/thirdparty/get_raft.cmake +++ b/cpp/cmake/thirdparty/get_raft.cmake @@ -14,23 +14,37 @@ # limitations under the License. #============================================================================= -function(find_and_configure_raft VERSION) +function(find_and_configure_raft) - rapids_cpm_find(raft ${VERSION} - GLOBAL_TARGETS raft::raft - BUILD_EXPORT_SET cugraph-exports - INSTALL_EXPORT_SET cugraph-exports + set(oneValueArgs VERSION FORK PINNED_TAG) + cmake_parse_arguments(PKG "${options}" "${oneValueArgs}" + "${multiValueArgs}" ${ARGN} ) + + rapids_cpm_find(raft ${PKG_VERSION} + GLOBAL_TARGETS raft::raft + BUILD_EXPORT_SET cuml-exports + INSTALL_EXPORT_SET cuml-exports CPM_ARGS - # GIT_REPOSITORY https://github.com/rapidsai/raft.git - # GIT_TAG branch-${VERSION} - GIT_REPOSITORY https://github.com/robertmaynard/raft.git - GIT_TAG use_rapids_cmake + GIT_REPOSITORY https://github.com/${PKG_FORK}/raft.git + GIT_TAG ${PKG_PINNED_TAG} SOURCE_SUBDIR cpp + OPTIONS + "BUILD_TESTS OFF" ) + message(VERBOSE "CUML: Using RAFT located in ${raft_SOURCE_DIR}") + endfunction() -set(CUGRAPH_MIN_VERSION_raft "${CUGRAPH_VERSION_MAJOR}.${CUGRAPH_VERSION_MINOR}") +set(CUML_MIN_VERSION_raft "${CUML_VERSION_MAJOR}.${CUML_VERSION_MINOR}") + +# Change pinned tag and fork here to test a commit in CI +# To use a different RAFT locally, set the CMake variable +# RPM_raft_SOURCE=/path/to/local/raft +find_and_configure_raft(VERSION ${CUML_MIN_VERSION_raft} + FORK dantegd + PINNED_TAG 020-fea-cpm + ) + -find_and_configure_raft(${CUGRAPH_MIN_VERSION_raft}) diff --git a/python/setup.py b/python/setup.py index 799cb805afa..d614eef24d6 100644 --- a/python/setup.py +++ b/python/setup.py @@ -65,8 +65,9 @@ raft_path = get_environment_option('RAFT_PATH') # FIXME: This could clone RAFT, even if it's not needed (eg. running --clean). -raft_include_dir = use_raft_package(raft_path, libcugraph_path, - git_info_file='../cpp/CMakeLists.txt') +# deprecated: This functionality will go away after +# https://github.com/rapidsai/raft/issues/83 +raft_include_dir = use_raft_package(raft_path, libcugraph_path) class CleanCommand(Command): diff --git a/python/setuputils.py b/python/setuputils.py index d93051d05ef..3a9492c6f97 100644 --- a/python/setuputils.py +++ b/python/setuputils.py @@ -71,7 +71,7 @@ def clean_folder(path): def use_raft_package(raft_path, cpp_build_path, - git_info_file='../cpp/cmake/Dependencies.cmake'): + git_info_file=None): """ Function to use the python code in RAFT in package.raft @@ -139,10 +139,13 @@ def use_raft_package(raft_path, cpp_build_path, def clone_repo_if_needed(name, cpp_build_path=None, git_info_file=None): if git_info_file is None: - git_info_file = _get_repo_path() + '/cpp/CMakeLists.txt' + git_info_file = \ + _get_repo_path() + '/cpp/cmake/thirdparty/get_{}.cmake'.format( + name + ) if cpp_build_path is None or cpp_build_path is False: - cpp_build_path = _get_repo_path() + '/cpp/build/' + cpp_build_path = _get_repo_path() + '/cpp/build/_deps/' repo_cloned = get_submodule_dependency(name, cpp_build_path=cpp_build_path, @@ -152,7 +155,7 @@ def clone_repo_if_needed(name, cpp_build_path=None, repo_path = ( _get_repo_path() + '/python/_external_repositories/' + name + '/') else: - repo_path = os.path.join(cpp_build_path, '_deps', name + '-src') + repo_path = os.path.join(cpp_build_path, name + '-src/') return repo_path, repo_cloned @@ -192,7 +195,7 @@ def get_submodule_dependency(repo, repo_info = get_repo_cmake_info(repos, git_info_file) - if os.path.exists(cpp_build_path): + if os.path.exists(os.path.join(cpp_build_path, repos[0] + '-src/')): print("-- Third party modules found succesfully in the libcugraph++ " "build folder.") @@ -200,11 +203,11 @@ def get_submodule_dependency(repo, else: - warnings.warn("-- Third party repositories have not been found so they" - "will be cloned. To avoid this set the environment " - "variable CUGRAPH_BUILD_PATH, containing the relative " - "path of the root of the repository to the folder " - "where libcugraph++ was built.") + print("-- Third party repositories have not been found so they" + "will be cloned. To avoid this set the environment " + "variable CUGRAPH_BUILD_PATH, containing the relative " + "path of the root of the repository to the folder " + "where libcugraph++ was built.") for repo in repos: clone_repo(repo, repo_info[repo][0], repo_info[repo][1]) @@ -262,8 +265,8 @@ def get_repo_cmake_info(names, file_path): `ExternalProject_Add(name` file_path : String Relative path of the location of the CMakeLists.txt (or the cmake - module which contains FetchContent_Declare or ExternalProject_Add - definitions) to extract the information. + module which contains ExternalProject_Add definitions) to extract + the information. Returns ------- @@ -272,31 +275,24 @@ def get_repo_cmake_info(names, file_path): where results[name][0] is the url of the repo and repo_info[repo][1] is the tag/commit hash to be cloned as specified by cmake. + """ - with open(file_path, encoding='utf-8') as f: + with open(file_path) as f: s = f.read() results = {} - cmake_ext_proj_decls = ["FetchContent_Declare", "ExternalProject_Add"] + print(file_path) for name in names: - res = None - for decl in cmake_ext_proj_decls: - res = re.search(f'{decl}\(\s*' # noqa: W605 - + '(' + re.escape(name) + ')' - + '\s+.*GIT_REPOSITORY\s+(\S+)\s+.+' # noqa: W605 - + '\s+.*GIT_TAG\s+(\S+)', # noqa: W605 - s) - if res: - break - if res is None: - raise RuntimeError('Could not find any of the following ' - f'statements: {cmake_ext_proj_decls}, for ' - f'module "{name}" in file "{file_path}" with ' - 'GIT_REPOSITORY and GIT_TAG settings') - - results[res.group(1)] = [res.group(2), res.group(3)] + repo = re.findall(r'\s.*GIT_REPOSITORY.*', s) + repo = repo[-1].split()[-1] + fork = re.findall(r'\s.*FORK.*', s) + fork = fork[-1].split()[-1] + repo = repo.replace("${PKG_FORK}", fork) + tag = re.findall(r'\s.*PINNED_TAG.*', s) + tag = tag[-1].split()[-1] + results[name] = [repo, tag] return results From 0b35e06f63a50a583db2d496ee65d25a05a0dde0 Mon Sep 17 00:00:00 2001 From: Dante Gama Dessavre Date: Tue, 11 May 2021 10:31:14 -0500 Subject: [PATCH 16/44] FIX Remove print --- python/setuputils.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/python/setuputils.py b/python/setuputils.py index 3a9492c6f97..ee738799a2a 100644 --- a/python/setuputils.py +++ b/python/setuputils.py @@ -282,8 +282,6 @@ def get_repo_cmake_info(names, file_path): results = {} - print(file_path) - for name in names: repo = re.findall(r'\s.*GIT_REPOSITORY.*', s) repo = repo[-1].split()[-1] From 20533e16dc2b0f1fecb428b910e81396e42634f6 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Tue, 11 May 2021 14:55:59 -0400 Subject: [PATCH 17/44] Make sure find_and_configure_raft argument parsing behaves consistently --- cpp/cmake/thirdparty/get_raft.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cpp/cmake/thirdparty/get_raft.cmake b/cpp/cmake/thirdparty/get_raft.cmake index 7c16f3552dd..02c1a454f01 100644 --- a/cpp/cmake/thirdparty/get_raft.cmake +++ b/cpp/cmake/thirdparty/get_raft.cmake @@ -17,8 +17,7 @@ function(find_and_configure_raft) set(oneValueArgs VERSION FORK PINNED_TAG) - cmake_parse_arguments(PKG "${options}" "${oneValueArgs}" - "${multiValueArgs}" ${ARGN} ) + cmake_parse_arguments(PKG "" "${oneValueArgs}" "" ${ARGN} ) rapids_cpm_find(raft ${PKG_VERSION} GLOBAL_TARGETS raft::raft From 8c67407bf81409af3065f02a9cad3629ef0128c3 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Tue, 11 May 2021 16:38:04 -0400 Subject: [PATCH 18/44] Remove unused import statements from setuputils --- python/setuputils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/python/setuputils.py b/python/setuputils.py index ee738799a2a..29df373e094 100644 --- a/python/setuputils.py +++ b/python/setuputils.py @@ -20,7 +20,6 @@ import shutil import subprocess import sys -import warnings from pathlib import Path From f68f0347d3f77ed2de6d34b379cd04482d5b595f Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Wed, 12 May 2021 07:57:08 -0400 Subject: [PATCH 19/44] Correct copy and paste of CUML version extraction --- cpp/cmake/thirdparty/get_raft.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/cmake/thirdparty/get_raft.cmake b/cpp/cmake/thirdparty/get_raft.cmake index 02c1a454f01..dbc5413c2e8 100644 --- a/cpp/cmake/thirdparty/get_raft.cmake +++ b/cpp/cmake/thirdparty/get_raft.cmake @@ -34,12 +34,12 @@ function(find_and_configure_raft) endfunction() -set(CUML_MIN_VERSION_raft "${CUML_VERSION_MAJOR}.${CUML_VERSION_MINOR}") +set(CUGRAPH_MIN_VERSION_raft "${CUGRAPH_VERSION_MAJOR}.${CUGRAPH_VERSION_MINOR}") # Change pinned tag and fork here to test a commit in CI # To use a different RAFT locally, set the CMake variable # RPM_raft_SOURCE=/path/to/local/raft -find_and_configure_raft(VERSION ${CUML_MIN_VERSION_raft} +find_and_configure_raft(VERSION ${CUGRAPH_MIN_VERSION_raft} FORK dantegd PINNED_TAG 020-fea-cpm ) From 923d28a741026a8eab77a6675447a1fc80b0c30d Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Wed, 12 May 2021 15:10:56 -0400 Subject: [PATCH 20/44] Style fix --- cpp/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index bf032fc30de..5d0cfd63711 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -22,6 +22,7 @@ FetchContent_Declare( GIT_TAG origin/branch-0.20 ) FetchContent_MakeAvailable(rapids-cmake) + include(rapids-cmake) include(rapids-cpm) include(rapids-cuda) From 96aa416dc6aed5ceb0479a1682fc7080546854cf Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 13 May 2021 07:48:30 -0400 Subject: [PATCH 21/44] cugraph config module setups up the cugraph::Thrust properly --- cpp/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 5d0cfd63711..023beb13707 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -326,6 +326,11 @@ Provide targets for cuGraph. cuGraph library is a collection of GPU accelerated graph algorithms that process data found in [GPU DataFrames](https://github.com/rapidsai/cudf). +]=]) + +set(code_string +[=[ +thrust_create_target(cugraph::Thrust FROM_OPTIONS) ]=]) rapids_export(INSTALL cugraph @@ -333,6 +338,7 @@ cuGraph library is a collection of GPU accelerated graph algorithms that process GLOBAL_TARGETS cugraph NAMESPACE cugraph:: DOCUMENTATION doc_string + FINAL_CODE_BLOCK code_string ) ################################################################################################ @@ -342,6 +348,7 @@ rapids_export(BUILD cugraph GLOBAL_TARGETS cugraph NAMESPACE cugraph:: DOCUMENTATION doc_string + FINAL_CODE_BLOCK code_string ) ################################################################################################### From c72a0777f94807d34174bd3d27bd57971822c0b3 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 13 May 2021 12:30:36 -0400 Subject: [PATCH 22/44] Correct find_and_configure_gunrock to properly setup CUDA flags for gunrock --- cpp/cmake/thirdparty/get_gunrock.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/cmake/thirdparty/get_gunrock.cmake b/cpp/cmake/thirdparty/get_gunrock.cmake index ab5fed0a40f..056cd4bd5ea 100644 --- a/cpp/cmake/thirdparty/get_gunrock.cmake +++ b/cpp/cmake/thirdparty/get_gunrock.cmake @@ -25,7 +25,7 @@ function(find_and_configure_gunrock VERSION) set(GUNROCK_GENCODE_SM80 OFF) foreach(arch IN LISTS CMAKE_CUDA_ARCHITECTURES) - string(REPLACE "-real" "" ${arch} arch) + string(REPLACE "-real" "" arch ${arch}) set(GUNROCK_GENCODE_SM${arch} "ON") endforeach() From bdb9f2dadf9c3cd958fb9ee337fcf0d1b86189f5 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 13 May 2021 14:23:55 -0400 Subject: [PATCH 23/44] Make sure cugraph adds raft and rmm to the export set correctly --- cpp/CMakeLists.txt | 2 +- cpp/cmake/thirdparty/get_raft.cmake | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 023beb13707..ca5eb69afe7 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -135,9 +135,9 @@ rapids_cpm_init() include(cmake/thirdparty/get_thrust.cmake) include(cmake/thirdparty/get_faiss.cmake) include(cmake/thirdparty/get_nccl.cmake) +include(cmake/thirdparty/get_rmm.cmake) include(cmake/thirdparty/get_raft.cmake) -include(cmake/thirdparty/get_rmm.cmake) include(cmake/thirdparty/get_cuco.cmake) include(cmake/thirdparty/get_cuhornet.cmake) diff --git a/cpp/cmake/thirdparty/get_raft.cmake b/cpp/cmake/thirdparty/get_raft.cmake index dbc5413c2e8..542b6c94ad6 100644 --- a/cpp/cmake/thirdparty/get_raft.cmake +++ b/cpp/cmake/thirdparty/get_raft.cmake @@ -21,8 +21,8 @@ function(find_and_configure_raft) rapids_cpm_find(raft ${PKG_VERSION} GLOBAL_TARGETS raft::raft - BUILD_EXPORT_SET cuml-exports - INSTALL_EXPORT_SET cuml-exports + BUILD_EXPORT_SET cugraph-exports + INSTALL_EXPORT_SET cugraph-exports CPM_ARGS GIT_REPOSITORY https://github.com/${PKG_FORK}/raft.git GIT_TAG ${PKG_PINNED_TAG} From 28cc833daf6fe36caf6666c0d685f43990aa3f2e Mon Sep 17 00:00:00 2001 From: ptaylor Date: Thu, 13 May 2021 19:23:07 -0500 Subject: [PATCH 24/44] add fatbin.ld linker script hack for debug builds (like cudf) --- cpp/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index ca5eb69afe7..99545180474 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -197,6 +197,16 @@ add_library(cugraph SHARED src/utilities/host_barrier.cpp ) +file(WRITE "${CUGRAPH_BINARY_DIR}/fatbin.ld" +[=[ +SECTIONS +{ + .nvFatBinSegment : { *(.nvFatBinSegment) } + .nv_fatbin : { *(.nv_fatbin) } +} +]=]) +target_link_options(cugraph PRIVATE "${CUGRAPH_BINARY_DIR}/fatbin.ld") + add_library(cugraph::cugraph ALIAS cugraph) set_target_properties(cugraph From cc8c563f456599aa02c80e59a8efb6a56618df39 Mon Sep 17 00:00:00 2001 From: ptaylor Date: Thu, 13 May 2021 20:26:30 -0500 Subject: [PATCH 25/44] use -I instead of -isystem for interface include directories --- cpp/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 99545180474..b727cf6f4a9 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -217,6 +217,7 @@ set_target_properties(cugraph CXX_STANDARD_REQUIRED ON CUDA_STANDARD 17 CUDA_STANDARD_REQUIRED ON + NO_SYSTEM_FROM_IMPORTED ON ) # Per-thread default stream option see https://docs.nvidia.com/cuda/cuda-runtime-api/stream-sync-behavior.html From 018c6b5bf944839cbd3ed5bbc531a49ec2c94e63 Mon Sep 17 00:00:00 2001 From: ptaylor Date: Thu, 13 May 2021 20:26:37 -0500 Subject: [PATCH 26/44] compile with -fPIC --- cpp/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index b727cf6f4a9..794cd7a7474 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -218,6 +218,8 @@ set_target_properties(cugraph CUDA_STANDARD 17 CUDA_STANDARD_REQUIRED ON NO_SYSTEM_FROM_IMPORTED ON + POSITION_INDEPENDENT_CODE ON + INTERFACE_POSITION_INDEPENDENT_CODE ON ) # Per-thread default stream option see https://docs.nvidia.com/cuda/cuda-runtime-api/stream-sync-behavior.html From be449bf80ad222a0e34681e96153f60a04a7a378 Mon Sep 17 00:00:00 2001 From: ptaylor Date: Thu, 13 May 2021 23:32:45 -0500 Subject: [PATCH 27/44] don't modify global CMAKE_ cxx and cuda variables, use Xcompiler= syntax to avoid preprocessor errors in ccache --- cpp/CMakeLists.txt | 48 +++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 794cd7a7474..b1d4cefa6a6 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -82,28 +82,31 @@ rapids_find_package(CUDAToolkit REQUIRED INSTALL_EXPORT_SET cugraph-exports ) +set(CUGRAPH_CXX_FLAGS "") +set(CUGRAPH_CUDA_FLAGS "") + if(CMAKE_COMPILER_IS_GNUCXX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=deprecated-declarations") + list(APPEND CUGRAPH_CXX_FLAGS -Werror -Wno-error=deprecated-declarations) endif(CMAKE_COMPILER_IS_GNUCXX) message("-- Building for GPU_ARCHS = ${CMAKE_CUDA_ARCHITECTURES}") -set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --expt-extended-lambda --expt-relaxed-constexpr") -set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Werror=cross-execution-space-call -Wno-deprecated-declarations -Xptxas --disable-warnings") -set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler -Wall,-Wno-error=sign-compare,-Wno-error=unused-but-set-variable") -set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xfatbin=-compress-all") +list(APPEND CUGRAPH_CUDA_FLAGS --expt-extended-lambda --expt-relaxed-constexpr) +list(APPEND CUGRAPH_CUDA_FLAGS -Werror=cross-execution-space-call -Wno-deprecated-declarations -Xptxas --disable-warnings) +list(APPEND CUGRAPH_CUDA_FLAGS -Xcompiler=-Wall,-Wno-error=sign-compare,-Wno-error=unused-but-set-variable) +list(APPEND CUGRAPH_CUDA_FLAGS -Xfatbin=-compress-all) # Option to enable line info in CUDA device compilation to allow introspection when profiling / # memchecking if (CMAKE_CUDA_LINEINFO) - set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo") + list(APPEND CUGRAPH_CUDA_FLAGS -lineinfo) endif(CMAKE_CUDA_LINEINFO) # Debug options if(CMAKE_BUILD_TYPE MATCHES Debug) message(STATUS "Building with debugging flags") - set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G -Xcompiler -rdynamic") + list(APPEND CUGRAPH_CUDA_FLAGS -G -Xcompiler=-rdynamic) endif(CMAKE_BUILD_TYPE MATCHES Debug) ################################################################################################### @@ -112,7 +115,7 @@ endif(CMAKE_BUILD_TYPE MATCHES Debug) find_package(OpenMP) if(OpenMP_FOUND) # find_package(OPenMP) does not automatically add OpenMP flags to CUDA - set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=${OpenMP_CXX_FLAGS}") + list(APPEND CUGRAPH_CUDA_FLAGS -Xcompiler=${OpenMP_CXX_FLAGS}) endif(OpenMP_FOUND) @@ -197,18 +200,6 @@ add_library(cugraph SHARED src/utilities/host_barrier.cpp ) -file(WRITE "${CUGRAPH_BINARY_DIR}/fatbin.ld" -[=[ -SECTIONS -{ - .nvFatBinSegment : { *(.nvFatBinSegment) } - .nv_fatbin : { *(.nv_fatbin) } -} -]=]) -target_link_options(cugraph PRIVATE "${CUGRAPH_BINARY_DIR}/fatbin.ld") - -add_library(cugraph::cugraph ALIAS cugraph) - set_target_properties(cugraph PROPERTIES BUILD_RPATH "\$ORIGIN" INSTALL_RPATH "\$ORIGIN" @@ -222,10 +213,27 @@ set_target_properties(cugraph INTERFACE_POSITION_INDEPENDENT_CODE ON ) +target_compile_options(cugraph + PRIVATE "$<$:${CUGRAPH_CXX_FLAGS}>" + "$<$:${CUGRAPH_CUDA_FLAGS}>" +) + # Per-thread default stream option see https://docs.nvidia.com/cuda/cuda-runtime-api/stream-sync-behavior.html # The per-thread default stream does not synchronize with other streams target_compile_definitions(cugraph PUBLIC CUDA_API_PER_THREAD_DEFAULT_STREAM) +file(WRITE "${CUGRAPH_BINARY_DIR}/fatbin.ld" +[=[ +SECTIONS +{ + .nvFatBinSegment : { *(.nvFatBinSegment) } + .nv_fatbin : { *(.nv_fatbin) } +} +]=]) +target_link_options(cugraph PRIVATE "${CUGRAPH_BINARY_DIR}/fatbin.ld") + +add_library(cugraph::cugraph ALIAS cugraph) + ################################################################################################### # - include paths --------------------------------------------------------------------------------- target_include_directories(cugraph From 39877eec5d1ea8516324c229dbde45df2ea7ee8e Mon Sep 17 00:00:00 2001 From: ptaylor Date: Thu, 13 May 2021 23:46:54 -0500 Subject: [PATCH 28/44] set compile options on cugraphtestutil target --- cpp/tests/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index d7d0f8f8fa9..7eb2862b0a7 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -28,6 +28,11 @@ add_library(cugraphtestutil STATIC components/wcc_graphs.cu "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio/mmio.c") +target_compile_options(cugraphtestutil + PUBLIC "$<$:${CUGRAPH_CXX_FLAGS}>" + "$:${CUGRAPH_CUDA_FLAGS}>>" +) + set_property(TARGET cugraphtestutil PROPERTY POSITION_INDEPENDENT_CODE ON) target_include_directories(cugraphtestutil From 86c6cd3232e53689dd493044d1be349cc7702c83 Mon Sep 17 00:00:00 2001 From: ptaylor Date: Fri, 14 May 2021 11:04:13 -0500 Subject: [PATCH 29/44] remove redundant POSITION_INDEPENDENT_CODE option --- cpp/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index b1d4cefa6a6..b4218a9b04b 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -209,7 +209,6 @@ set_target_properties(cugraph CUDA_STANDARD 17 CUDA_STANDARD_REQUIRED ON NO_SYSTEM_FROM_IMPORTED ON - POSITION_INDEPENDENT_CODE ON INTERFACE_POSITION_INDEPENDENT_CODE ON ) From a408b5e09b0fcfe76114aff96b0254a4fecbbb62 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Fri, 14 May 2021 12:36:31 -0400 Subject: [PATCH 30/44] Make sure we use the correct include path when installed --- cpp/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index b4218a9b04b..2e690ab17d9 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -242,7 +242,7 @@ target_include_directories(cugraph "${NCCL_INCLUDE_DIRS}" PUBLIC "$" - "$" + "$" ) ################################################################################################### From 91d1ea220c6998c2d7839f9b7ddf92f55b5c5036 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Fri, 14 May 2021 12:37:04 -0400 Subject: [PATCH 31/44] Back out NO_SYSTEM_FROM_IMPORTED flag, prefer users set CMAKE_NO_SYSTEM_FROM_IMPORTED --- cpp/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 2e690ab17d9..5f4731ddeee 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -208,7 +208,6 @@ set_target_properties(cugraph CXX_STANDARD_REQUIRED ON CUDA_STANDARD 17 CUDA_STANDARD_REQUIRED ON - NO_SYSTEM_FROM_IMPORTED ON INTERFACE_POSITION_INDEPENDENT_CODE ON ) From 693074d354a41ed0cd076b73806faece05a1a49c Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Fri, 14 May 2021 17:07:29 -0400 Subject: [PATCH 32/44] Update cpm of raft to point upstream as it now is CPMable --- cpp/cmake/thirdparty/get_raft.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/cmake/thirdparty/get_raft.cmake b/cpp/cmake/thirdparty/get_raft.cmake index 542b6c94ad6..282d94e0cd7 100644 --- a/cpp/cmake/thirdparty/get_raft.cmake +++ b/cpp/cmake/thirdparty/get_raft.cmake @@ -40,8 +40,8 @@ set(CUGRAPH_MIN_VERSION_raft "${CUGRAPH_VERSION_MAJOR}.${CUGRAPH_VERSION_MINOR}" # To use a different RAFT locally, set the CMake variable # RPM_raft_SOURCE=/path/to/local/raft find_and_configure_raft(VERSION ${CUGRAPH_MIN_VERSION_raft} - FORK dantegd - PINNED_TAG 020-fea-cpm + FORK rapidsai + PINNED_TAG branch-${CUGRAPH_MIN_VERSION_raft} ) From 3987b2d4415141eaf9feb4fd67861e75cebeed8c Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Mon, 17 May 2021 11:06:08 -0400 Subject: [PATCH 33/44] Fix copyright in ci/release/update-version.sh --- ci/release/update-version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/release/update-version.sh b/ci/release/update-version.sh index 7cd0d9720fc..6e9e955ac67 100755 --- a/ci/release/update-version.sh +++ b/ci/release/update-version.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) 2018-2020, NVIDIA CORPORATION. +# Copyright (c) 2018-2021, NVIDIA CORPORATION. # 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 From af9652e282826505a60ae955d1ea6ad4267540b1 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Tue, 18 May 2021 08:49:30 -0400 Subject: [PATCH 34/44] Update cpp/cmake/thirdparty/get_rmm.cmake Co-authored-by: Paul Taylor --- cpp/cmake/thirdparty/get_rmm.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/cmake/thirdparty/get_rmm.cmake b/cpp/cmake/thirdparty/get_rmm.cmake index 84d354d01fb..ace63c8817d 100644 --- a/cpp/cmake/thirdparty/get_rmm.cmake +++ b/cpp/cmake/thirdparty/get_rmm.cmake @@ -36,6 +36,6 @@ function(find_and_configure_rmm VERSION) endfunction() -set(CUGRAPH_MIN_VERSION_rmm "${CUGRAPH_VERSION_MAJOR}.${CUGRAPH_VERSION_MINOR}") +set(CUGRAPH_MIN_VERSION_rmm "${CUGRAPH_VERSION_MAJOR}.${CUGRAPH_VERSION_MINOR}.00") find_and_configure_rmm(${CUGRAPH_MIN_VERSION_rmm}) From 039afe0395fc06860c798fa23de3e386561ef307 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Tue, 18 May 2021 08:49:36 -0400 Subject: [PATCH 35/44] Update cpp/cmake/thirdparty/get_raft.cmake Co-authored-by: Paul Taylor --- cpp/cmake/thirdparty/get_raft.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cpp/cmake/thirdparty/get_raft.cmake b/cpp/cmake/thirdparty/get_raft.cmake index 282d94e0cd7..aece673025c 100644 --- a/cpp/cmake/thirdparty/get_raft.cmake +++ b/cpp/cmake/thirdparty/get_raft.cmake @@ -34,7 +34,7 @@ function(find_and_configure_raft) endfunction() -set(CUGRAPH_MIN_VERSION_raft "${CUGRAPH_VERSION_MAJOR}.${CUGRAPH_VERSION_MINOR}") +set(CUGRAPH_MIN_VERSION_raft "${CUGRAPH_VERSION_MAJOR}.${CUGRAPH_VERSION_MINOR}.00") # Change pinned tag and fork here to test a commit in CI # To use a different RAFT locally, set the CMake variable @@ -44,4 +44,3 @@ find_and_configure_raft(VERSION ${CUGRAPH_MIN_VERSION_raft} PINNED_TAG branch-${CUGRAPH_MIN_VERSION_raft} ) - From bbf4463957947231b8fd055149affeec62ea02a0 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Tue, 18 May 2021 09:47:17 -0400 Subject: [PATCH 36/44] Handle the update to CalVersion --- cpp/cmake/thirdparty/get_raft.cmake | 4 +++- cpp/cmake/thirdparty/get_rmm.cmake | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cpp/cmake/thirdparty/get_raft.cmake b/cpp/cmake/thirdparty/get_raft.cmake index aece673025c..d8c9358e023 100644 --- a/cpp/cmake/thirdparty/get_raft.cmake +++ b/cpp/cmake/thirdparty/get_raft.cmake @@ -35,12 +35,14 @@ function(find_and_configure_raft) endfunction() set(CUGRAPH_MIN_VERSION_raft "${CUGRAPH_VERSION_MAJOR}.${CUGRAPH_VERSION_MINOR}.00") +set(CUGRAPH_BRANCH_VERSION_raft "${CUGRAPH_VERSION_MAJOR}.${CUGRAPH_VERSION_MINOR}") + # Change pinned tag and fork here to test a commit in CI # To use a different RAFT locally, set the CMake variable # RPM_raft_SOURCE=/path/to/local/raft find_and_configure_raft(VERSION ${CUGRAPH_MIN_VERSION_raft} FORK rapidsai - PINNED_TAG branch-${CUGRAPH_MIN_VERSION_raft} + PINNED_TAG branch-${CUGRAPH_BRANCH_VERSION_raft} ) diff --git a/cpp/cmake/thirdparty/get_rmm.cmake b/cpp/cmake/thirdparty/get_rmm.cmake index ace63c8817d..aecb6489f92 100644 --- a/cpp/cmake/thirdparty/get_rmm.cmake +++ b/cpp/cmake/thirdparty/get_rmm.cmake @@ -16,6 +16,12 @@ function(find_and_configure_rmm VERSION) + if(${VERSION} MATCHES [=[([0-9]+)\.([0-9]+)\.([0-9]+)]=]) + set(MAJOR_AND_MINOR "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}") + else() + set(MAJOR_AND_MINOR "${VERSION}") + endif() + if(TARGET rmm::rmm) return() endif() @@ -26,7 +32,7 @@ function(find_and_configure_rmm VERSION) INSTALL_EXPORT_SET cugraph-exports CPM_ARGS GIT_REPOSITORY https://github.com/rapidsai/rmm.git - GIT_TAG branch-${VERSION} + GIT_TAG branch-${MAJOR_AND_MINOR} GIT_SHALLOW TRUE OPTIONS "BUILD_TESTS OFF" "BUILD_BENCHMARKS OFF" From fbdbc55677bd0f819a34ba53253cac95b7494d30 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Tue, 18 May 2021 11:49:09 -0400 Subject: [PATCH 37/44] Update to use CalVer branch names for rapids-cmake --- cpp/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index b1b3cf126ca..7ee9e1f9547 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -19,7 +19,7 @@ include(FetchContent) FetchContent_Declare( rapids-cmake GIT_REPOSITORY https://github.com/rapidsai/rapids-cmake.git - GIT_TAG origin/branch-0.20 + GIT_TAG origin/branch-21.06 ) FetchContent_MakeAvailable(rapids-cmake) From 16a8f12ca46213c583ab311584cdb9e1fbaa8f4f Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Tue, 18 May 2021 14:40:17 -0400 Subject: [PATCH 38/44] Update compiler flags to use formats that ccache can parse Co-authored-by: Paul Taylor --- cpp/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 7ee9e1f9547..9f965cf214c 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -93,7 +93,7 @@ endif(CMAKE_COMPILER_IS_GNUCXX) message("-- Building for GPU_ARCHS = ${CMAKE_CUDA_ARCHITECTURES}") list(APPEND CUGRAPH_CUDA_FLAGS --expt-extended-lambda --expt-relaxed-constexpr) -list(APPEND CUGRAPH_CUDA_FLAGS -Werror=cross-execution-space-call -Wno-deprecated-declarations -Xptxas --disable-warnings) +list(APPEND CUGRAPH_CUDA_FLAGS -Werror=cross-execution-space-call -Wno-deprecated-declarations -Xptxas=--disable-warnings) list(APPEND CUGRAPH_CUDA_FLAGS -Xcompiler=-Wall,-Wno-error=sign-compare,-Wno-error=unused-but-set-variable) list(APPEND CUGRAPH_CUDA_FLAGS -Xfatbin=-compress-all) From e1b817cd0f3e4f0f1f1f7f5545fd463c83364480 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Wed, 19 May 2021 11:33:06 -0400 Subject: [PATCH 39/44] get_raft must be called with explicit branch names for setuputils.py The setuputils.py script will try to parse the `PINNED_TAG` arguments from `get_raft` and will fail if CMake variables are used. --- cpp/cmake/thirdparty/get_raft.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cpp/cmake/thirdparty/get_raft.cmake b/cpp/cmake/thirdparty/get_raft.cmake index d8c9358e023..817991657c4 100644 --- a/cpp/cmake/thirdparty/get_raft.cmake +++ b/cpp/cmake/thirdparty/get_raft.cmake @@ -35,7 +35,6 @@ function(find_and_configure_raft) endfunction() set(CUGRAPH_MIN_VERSION_raft "${CUGRAPH_VERSION_MAJOR}.${CUGRAPH_VERSION_MINOR}.00") -set(CUGRAPH_BRANCH_VERSION_raft "${CUGRAPH_VERSION_MAJOR}.${CUGRAPH_VERSION_MINOR}") # Change pinned tag and fork here to test a commit in CI @@ -43,6 +42,6 @@ set(CUGRAPH_BRANCH_VERSION_raft "${CUGRAPH_VERSION_MAJOR}.${CUGRAPH_VERSION_MINO # RPM_raft_SOURCE=/path/to/local/raft find_and_configure_raft(VERSION ${CUGRAPH_MIN_VERSION_raft} FORK rapidsai - PINNED_TAG branch-${CUGRAPH_BRANCH_VERSION_raft} + PINNED_TAG branch-21.06 ) From c1f7341d4c9e6a28f42f022806f06efee62605f2 Mon Sep 17 00:00:00 2001 From: Dante Gama Dessavre Date: Wed, 19 May 2021 10:59:10 -0500 Subject: [PATCH 40/44] ENH Make setuputils deduce version of main branch from cmakelists --- python/setuputils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/python/setuputils.py b/python/setuputils.py index 29df373e094..a64e60e1c32 100644 --- a/python/setuputils.py +++ b/python/setuputils.py @@ -290,6 +290,16 @@ def get_repo_cmake_info(names, file_path): tag = re.findall(r'\s.*PINNED_TAG.*', s) tag = tag[-1].split()[-1] results[name] = [repo, tag] + if tag == 'branch-${CUGRAPH_BRANCH_VERSION_raft}': + loc = _get_repo_path() + '/cpp/CMakeLists.txt' + with open(loc) as f: + cmakelists = f.read() + tag = re.findall(r'\s.*project\(CUGRAPH VERSION.*', cmakelists) + print(tag) + tag = tag[-1].split()[2].split('.') + tag = 'branch-{}.{}'.format(tag[0], tag[1]) + + results[name] = [repo, tag] return results From dc26c670ba0c8fb1ba07757777153377b29d5d85 Mon Sep 17 00:00:00 2001 From: Dante Gama Dessavre Date: Wed, 19 May 2021 11:00:39 -0500 Subject: [PATCH 41/44] ENH Change get_raft back to using cugraph major/minor version --- cpp/cmake/thirdparty/get_raft.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cpp/cmake/thirdparty/get_raft.cmake b/cpp/cmake/thirdparty/get_raft.cmake index 817991657c4..80725937fea 100644 --- a/cpp/cmake/thirdparty/get_raft.cmake +++ b/cpp/cmake/thirdparty/get_raft.cmake @@ -35,6 +35,7 @@ function(find_and_configure_raft) endfunction() set(CUGRAPH_MIN_VERSION_raft "${CUGRAPH_VERSION_MAJOR}.${CUGRAPH_VERSION_MINOR}.00") +set(CUGRAPH_BRANCH_VERSION_raft "${CUGRAPH_VERSION_MAJOR}.${CUGRAPH_VERSION_MINOR}") # Change pinned tag and fork here to test a commit in CI @@ -42,6 +43,6 @@ set(CUGRAPH_MIN_VERSION_raft "${CUGRAPH_VERSION_MAJOR}.${CUGRAPH_VERSION_MINOR}. # RPM_raft_SOURCE=/path/to/local/raft find_and_configure_raft(VERSION ${CUGRAPH_MIN_VERSION_raft} FORK rapidsai - PINNED_TAG branch-21.06 + PINNED_TAG PINNED_TAG branch-${CUGRAPH_BRANCH_VERSION_raft} ) From a854c21a1ed6734515aabf065e2941bb0493ecbe Mon Sep 17 00:00:00 2001 From: Dante Gama Dessavre Date: Wed, 19 May 2021 11:01:53 -0500 Subject: [PATCH 42/44] FIX Accidental double pinned_tag --- cpp/cmake/thirdparty/get_raft.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/cmake/thirdparty/get_raft.cmake b/cpp/cmake/thirdparty/get_raft.cmake index 80725937fea..d8c9358e023 100644 --- a/cpp/cmake/thirdparty/get_raft.cmake +++ b/cpp/cmake/thirdparty/get_raft.cmake @@ -43,6 +43,6 @@ set(CUGRAPH_BRANCH_VERSION_raft "${CUGRAPH_VERSION_MAJOR}.${CUGRAPH_VERSION_MINO # RPM_raft_SOURCE=/path/to/local/raft find_and_configure_raft(VERSION ${CUGRAPH_MIN_VERSION_raft} FORK rapidsai - PINNED_TAG PINNED_TAG branch-${CUGRAPH_BRANCH_VERSION_raft} + PINNED_TAG branch-${CUGRAPH_BRANCH_VERSION_raft} ) From 267cb09602e1767bd7cbcd28c3e77f330e13a882 Mon Sep 17 00:00:00 2001 From: ptaylor Date: Thu, 20 May 2021 18:58:27 -0500 Subject: [PATCH 43/44] update cuhornet hash, download the entire cuhornet git tree --- cpp/cmake/thirdparty/get_cuhornet.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cpp/cmake/thirdparty/get_cuhornet.cmake b/cpp/cmake/thirdparty/get_cuhornet.cmake index e33068ed2c3..adcec4ee900 100644 --- a/cpp/cmake/thirdparty/get_cuhornet.cmake +++ b/cpp/cmake/thirdparty/get_cuhornet.cmake @@ -21,8 +21,7 @@ function(find_and_configure_cuhornet) FetchContent_Declare( cuhornet GIT_REPOSITORY https://github.com/rapidsai/cuhornet.git - GIT_TAG 6d2fc894cc56dd2ca8fc9d1523a18a6ec444b663 - GIT_SHALLOW true + GIT_TAG 76a8b53c7dff23e8a6fef0be3caf5f2be88aaf7a SOURCE_SUBDIR hornet ) FetchContent_GetProperties(cuhornet) From 40772b247c417fed587978d4e246db6b4e61653d Mon Sep 17 00:00:00 2001 From: ptaylor Date: Fri, 21 May 2021 12:09:14 -0500 Subject: [PATCH 44/44] update cuhornet hash again --- cpp/cmake/thirdparty/get_cuhornet.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/cmake/thirdparty/get_cuhornet.cmake b/cpp/cmake/thirdparty/get_cuhornet.cmake index adcec4ee900..28c83161ff4 100644 --- a/cpp/cmake/thirdparty/get_cuhornet.cmake +++ b/cpp/cmake/thirdparty/get_cuhornet.cmake @@ -21,7 +21,7 @@ function(find_and_configure_cuhornet) FetchContent_Declare( cuhornet GIT_REPOSITORY https://github.com/rapidsai/cuhornet.git - GIT_TAG 76a8b53c7dff23e8a6fef0be3caf5f2be88aaf7a + GIT_TAG 261399356e62bd76fa7628880f1a847aee713eed SOURCE_SUBDIR hornet ) FetchContent_GetProperties(cuhornet)