From 00add04090599096d7e7f0da883f3d132906b272 Mon Sep 17 00:00:00 2001 From: Rick Ratzel Date: Sun, 31 Jan 2021 23:48:29 -0600 Subject: [PATCH 01/15] Updated cmake min version to 3.14 for consistency with rest of RAPIDS, replaced usage of CMAKE_SOURCE_DIR with CMAKE_CURRENT_SOURCE_DIR and added project() lines to thirdparty packages to better support users including cugraph as a 3rd party project in their applications (and for consistency with RAPIDS). --- cpp/CMakeLists.txt | 4 +- .../Templates/Arrow.CMakeLists.txt.cmake | 26 ++++++---- .../Templates/GoogleTest.CMakeLists.txt.cmake | 29 +++++++---- cpp/tests/CMakeLists.txt | 48 +++++++++---------- 4 files changed, 63 insertions(+), 44 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 7871ce7581b..8d0f2fb6a03 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -14,7 +14,7 @@ # limitations under the License. #============================================================================= -cmake_minimum_required(VERSION 3.12..3.17 FATAL_ERROR) +cmake_minimum_required(VERSION 3.14..3.17 FATAL_ERROR) project(CUGRAPH VERSION 0.18.0 LANGUAGES C CXX CUDA) @@ -474,7 +474,7 @@ if(BUILD_TESTS) # link_directoires (we should switch to target_link_directories once 3.13 becomes the # minimum required version). link_directories(${GTEST_LIBRARY_DIR}) - add_subdirectory(${CMAKE_SOURCE_DIR}/tests) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tests) endif(GTEST_FOUND) endif(BUILD_TESTS) diff --git a/cpp/cmake/Templates/Arrow.CMakeLists.txt.cmake b/cpp/cmake/Templates/Arrow.CMakeLists.txt.cmake index b1eaf3f0efa..5898b7d6e2b 100644 --- a/cpp/cmake/Templates/Arrow.CMakeLists.txt.cmake +++ b/cpp/cmake/Templates/Arrow.CMakeLists.txt.cmake @@ -1,19 +1,29 @@ -cmake_minimum_required(VERSION 3.12) +#============================================================================= +# 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. +#============================================================================= + +project(cugraph-Arrow) include(ExternalProject) ExternalProject_Add(Arrow GIT_REPOSITORY https://github.com/apache/arrow.git GIT_TAG apache-arrow-0.12.1 + GIT_SHALLOW true SOURCE_DIR "${ARROW_ROOT}/arrow" SOURCE_SUBDIR "cpp" BINARY_DIR "${ARROW_ROOT}/build" INSTALL_DIR "${ARROW_ROOT}/install" CMAKE_ARGS ${ARROW_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=${ARROW_ROOT}/install) - - - - - - - diff --git a/cpp/cmake/Templates/GoogleTest.CMakeLists.txt.cmake b/cpp/cmake/Templates/GoogleTest.CMakeLists.txt.cmake index 66e1dc85a50..1fbee837688 100644 --- a/cpp/cmake/Templates/GoogleTest.CMakeLists.txt.cmake +++ b/cpp/cmake/Templates/GoogleTest.CMakeLists.txt.cmake @@ -1,19 +1,28 @@ -cmake_minimum_required(VERSION 3.12) +#============================================================================= +# 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. +#============================================================================= + +project(cugraph-GoogleTest) include(ExternalProject) ExternalProject_Add(GoogleTest GIT_REPOSITORY https://github.com/google/googletest.git GIT_TAG release-1.8.0 + GIT_SHALLOW true SOURCE_DIR "${GTEST_ROOT}/googletest" BINARY_DIR "${GTEST_ROOT}/build" - INSTALL_DIR "${GTEST_ROOT}/install" + INSTALL_DIR "${GTEST_ROOT}/install" CMAKE_ARGS ${GTEST_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=${GTEST_ROOT}/install) - - - - - - - - diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index 59b84a88fe7..27cdd51e031 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -35,9 +35,9 @@ function(ConfigureTest CMAKE_TEST_NAME CMAKE_TEST_SRC CMAKE_EXTRA_LIBS) "${CUDF_INCLUDE}" "${CUDF_INCLUDE}/libcudf/libcudacxx" "${NCCL_INCLUDE_DIRS}" - "${CMAKE_SOURCE_DIR}/../thirdparty/mmio" - "${CMAKE_SOURCE_DIR}/include" - "${CMAKE_SOURCE_DIR}/src" + "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio" + "${CMAKE_CURRENT_SOURCE_DIR}/../include" + "${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_SOURCE_DIR}" "${RAFT_DIR}/cpp/include" ) @@ -120,7 +120,7 @@ endif(RAPIDS_DATASET_ROOT_DIR) # - katz centrality tests ------------------------------------------------------------------------- set(KATZ_TEST_SRC - "${CMAKE_SOURCE_DIR}/../thirdparty/mmio/mmio.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio/mmio.c" "${CMAKE_CURRENT_SOURCE_DIR}/centrality/katz_centrality_test.cu") ConfigureTest(KATZ_TEST "${KATZ_TEST_SRC}" "") @@ -129,13 +129,13 @@ set(KATZ_TEST_SRC # - betweenness centrality tests ------------------------------------------------------------------ set(BETWEENNESS_TEST_SRC - "${CMAKE_SOURCE_DIR}/../thirdparty/mmio/mmio.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio/mmio.c" "${CMAKE_CURRENT_SOURCE_DIR}/centrality/betweenness_centrality_test.cu") ConfigureTest(BETWEENNESS_TEST "${BETWEENNESS_TEST_SRC}" "") set(EDGE_BETWEENNESS_TEST_SRC - "${CMAKE_SOURCE_DIR}/../thirdparty/mmio/mmio.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio/mmio.c" "${CMAKE_CURRENT_SOURCE_DIR}/centrality/edge_betweenness_centrality_test.cu") ConfigureTest(EDGE_BETWEENNESS_TEST "${EDGE_BETWEENNESS_TEST_SRC}" "") @@ -144,7 +144,7 @@ set(EDGE_BETWEENNESS_TEST_SRC # - pagerank tests -------------------------------------------------------------------------------- set(PAGERANK_TEST_SRC - "${CMAKE_SOURCE_DIR}/../thirdparty/mmio/mmio.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio/mmio.c" "${CMAKE_CURRENT_SOURCE_DIR}/pagerank/pagerank_test.cpp") ConfigureTest(PAGERANK_TEST "${PAGERANK_TEST_SRC}" "") @@ -153,7 +153,7 @@ ConfigureTest(PAGERANK_TEST "${PAGERANK_TEST_SRC}" "") # - SSSP tests ------------------------------------------------------------------------------------ set(SSSP_TEST_SRCS - "${CMAKE_SOURCE_DIR}/../thirdparty/mmio/mmio.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio/mmio.c" "${CMAKE_CURRENT_SOURCE_DIR}/traversal/sssp_test.cu") ConfigureTest(SSSP_TEST "${SSSP_TEST_SRCS}" "") @@ -162,7 +162,7 @@ ConfigureTest(SSSP_TEST "${SSSP_TEST_SRCS}" "") # - BFS tests ------------------------------------------------------------------------------------- set(BFS_TEST_SRCS - "${CMAKE_SOURCE_DIR}/../thirdparty/mmio/mmio.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio/mmio.c" "${CMAKE_CURRENT_SOURCE_DIR}/traversal/bfs_test.cu") ConfigureTest(BFS_TEST "${BFS_TEST_SRCS}" "") @@ -171,7 +171,7 @@ ConfigureTest(BFS_TEST "${BFS_TEST_SRCS}" "") # - LOUVAIN tests --------------------------------------------------------------------------------- set(LOUVAIN_TEST_SRC - "${CMAKE_SOURCE_DIR}/../thirdparty/mmio/mmio.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio/mmio.c" "${CMAKE_CURRENT_SOURCE_DIR}/community/louvain_test.cu") ConfigureTest(LOUVAIN_TEST "${LOUVAIN_TEST_SRC}" "") @@ -180,7 +180,7 @@ ConfigureTest(LOUVAIN_TEST "${LOUVAIN_TEST_SRC}" "") # - LEIDEN tests --------------------------------------------------------------------------------- set(LEIDEN_TEST_SRC - "${CMAKE_SOURCE_DIR}/../thirdparty/mmio/mmio.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio/mmio.c" "${CMAKE_CURRENT_SOURCE_DIR}/community/leiden_test.cpp") ConfigureTest(LEIDEN_TEST "${LEIDEN_TEST_SRC}" "") @@ -213,7 +213,7 @@ ConfigureTest(TRIANGLE_TEST "${TRIANGLE_TEST_SRC}" "") # - RENUMBERING tests ----------------------------------------------------------------------------- set(RENUMBERING_TEST_SRC - "${CMAKE_SOURCE_DIR}/../thirdparty/mmio/mmio.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio/mmio.c" "${CMAKE_CURRENT_SOURCE_DIR}/renumber/renumber_test.cu") ConfigureTest(RENUMBERING_TEST "${RENUMBERING_TEST_SRC}" "") @@ -222,7 +222,7 @@ ConfigureTest(RENUMBERING_TEST "${RENUMBERING_TEST_SRC}" "") # - FORCE ATLAS 2 tests -------------------------------------------------------------------------- set(FA2_TEST_SRC - "${CMAKE_SOURCE_DIR}/../thirdparty/mmio/mmio.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio/mmio.c" "${CMAKE_CURRENT_SOURCE_DIR}/layout/force_atlas2_test.cu") ConfigureTest(FA2_TEST "${FA2_TEST_SRC}" "") @@ -231,7 +231,7 @@ ConfigureTest(FA2_TEST "${FA2_TEST_SRC}" "") # - CONNECTED COMPONENTS tests ------------------------------------------------------------------- set(CONNECT_TEST_SRC - "${CMAKE_SOURCE_DIR}/../thirdparty/mmio/mmio.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio/mmio.c" "${CMAKE_CURRENT_SOURCE_DIR}/components/con_comp_test.cu") ConfigureTest(CONNECT_TEST "${CONNECT_TEST_SRC}" "") @@ -240,7 +240,7 @@ ConfigureTest(CONNECT_TEST "${CONNECT_TEST_SRC}" "") # - STRONGLY CONNECTED COMPONENTS tests ---------------------------------------------------------- set(SCC_TEST_SRC - "${CMAKE_SOURCE_DIR}/../thirdparty/mmio/mmio.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio/mmio.c" "${CMAKE_CURRENT_SOURCE_DIR}/components/scc_test.cu") ConfigureTest(SCC_TEST "${SCC_TEST_SRC}" "") @@ -257,7 +257,7 @@ ConfigureTest(HUNGARIAN_TEST "${HUNGARIAN_TEST_SRC}" "") # - MST tests ---------------------------------------------------------------------------- set(MST_TEST_SRC - "${CMAKE_SOURCE_DIR}/../thirdparty/mmio/mmio.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio/mmio.c" "${CMAKE_CURRENT_SOURCE_DIR}/tree/mst_test.cu") ConfigureTest(MST_TEST "${MST_TEST_SRC}" "") @@ -267,7 +267,7 @@ ConfigureTest(MST_TEST "${MST_TEST_SRC}" "") # - Experimental Graph tests ---------------------------------------------------------------------- set(EXPERIMENTAL_GRAPH_TEST_SRCS - "${CMAKE_SOURCE_DIR}/../thirdparty/mmio/mmio.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio/mmio.c" "${CMAKE_CURRENT_SOURCE_DIR}/experimental/graph_test.cpp") ConfigureTest(EXPERIMENTAL_GRAPH_TEST "${EXPERIMENTAL_GRAPH_TEST_SRCS}" "") @@ -276,7 +276,7 @@ ConfigureTest(EXPERIMENTAL_GRAPH_TEST "${EXPERIMENTAL_GRAPH_TEST_SRCS}" "") # - Experimental coarsening tests ----------------------------------------------------------------- set(EXPERIMENTAL_COARSEN_GRAPH_TEST_SRCS - "${CMAKE_SOURCE_DIR}/../thirdparty/mmio/mmio.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio/mmio.c" "${CMAKE_CURRENT_SOURCE_DIR}/experimental/coarsen_graph_test.cpp") ConfigureTest(EXPERIMENTAL_COARSEN_GRAPH_TEST "${EXPERIMENTAL_COARSEN_GRAPH_TEST_SRCS}" "") @@ -285,7 +285,7 @@ ConfigureTest(EXPERIMENTAL_COARSEN_GRAPH_TEST "${EXPERIMENTAL_COARSEN_GRAPH_TEST # - Experimental induced subgraph tests ----------------------------------------------------------- set(EXPERIMENTAL_INDUCED_SUBGRAPH_TEST_SRCS - "${CMAKE_SOURCE_DIR}/../thirdparty/mmio/mmio.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio/mmio.c" "${CMAKE_CURRENT_SOURCE_DIR}/experimental/induced_subgraph_test.cpp") ConfigureTest(EXPERIMENTAL_INDUCED_SUBGRAPH_TEST "${EXPERIMENTAL_INDUCED_SUBGRAPH_TEST_SRCS}" "") @@ -294,7 +294,7 @@ ConfigureTest(EXPERIMENTAL_INDUCED_SUBGRAPH_TEST "${EXPERIMENTAL_INDUCED_SUBGRAP # - Experimental BFS tests ------------------------------------------------------------------------ set(EXPERIMENTAL_BFS_TEST_SRCS - "${CMAKE_SOURCE_DIR}/../thirdparty/mmio/mmio.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio/mmio.c" "${CMAKE_CURRENT_SOURCE_DIR}/experimental/bfs_test.cpp") ConfigureTest(EXPERIMENTAL_BFS_TEST "${EXPERIMENTAL_BFS_TEST_SRCS}" "") @@ -303,7 +303,7 @@ ConfigureTest(EXPERIMENTAL_BFS_TEST "${EXPERIMENTAL_BFS_TEST_SRCS}" "") # - Experimental SSSP tests ----------------------------------------------------------------------- set(EXPERIMENTAL_SSSP_TEST_SRCS - "${CMAKE_SOURCE_DIR}/../thirdparty/mmio/mmio.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio/mmio.c" "${CMAKE_CURRENT_SOURCE_DIR}/experimental/sssp_test.cpp") ConfigureTest(EXPERIMENTAL_SSSP_TEST "${EXPERIMENTAL_SSSP_TEST_SRCS}" "") @@ -312,7 +312,7 @@ ConfigureTest(EXPERIMENTAL_SSSP_TEST "${EXPERIMENTAL_SSSP_TEST_SRCS}" "") # - Experimental PAGERANK tests ------------------------------------------------------------------- set(EXPERIMENTAL_PAGERANK_TEST_SRCS - "${CMAKE_SOURCE_DIR}/../thirdparty/mmio/mmio.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio/mmio.c" "${CMAKE_CURRENT_SOURCE_DIR}/experimental/pagerank_test.cpp") ConfigureTest(EXPERIMENTAL_PAGERANK_TEST "${EXPERIMENTAL_PAGERANK_TEST_SRCS}" "") @@ -321,7 +321,7 @@ ConfigureTest(EXPERIMENTAL_PAGERANK_TEST "${EXPERIMENTAL_PAGERANK_TEST_SRCS}" "" # - Experimental LOUVAIN tests ------------------------------------------------------------------- set(EXPERIMENTAL_LOUVAIN_TEST_SRCS - "${CMAKE_SOURCE_DIR}/../thirdparty/mmio/mmio.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio/mmio.c" "${CMAKE_CURRENT_SOURCE_DIR}/experimental/louvain_test.cu") ConfigureTest(EXPERIMENTAL_LOUVAIN_TEST "${EXPERIMENTAL_LOUVAIN_TEST_SRCS}" "") @@ -330,7 +330,7 @@ ConfigureTest(EXPERIMENTAL_LOUVAIN_TEST "${EXPERIMENTAL_LOUVAIN_TEST_SRCS}" "") # - Experimental KATZ_CENTRALITY tests ------------------------------------------------------------ set(EXPERIMENTAL_KATZ_CENTRALITY_TEST_SRCS - "${CMAKE_SOURCE_DIR}/../thirdparty/mmio/mmio.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/mmio/mmio.c" "${CMAKE_CURRENT_SOURCE_DIR}/experimental/katz_centrality_test.cpp") ConfigureTest(EXPERIMENTAL_KATZ_CENTRALITY_TEST "${EXPERIMENTAL_KATZ_CENTRALITY_TEST_SRCS}" "") From 8dc88ec4560708ab19d18296f3e530e066931b3a Mon Sep 17 00:00:00 2001 From: Rick Ratzel Date: Mon, 1 Feb 2021 00:15:22 -0600 Subject: [PATCH 02/15] Added CUDA_ARCHITECTURES=OFF setting for test targets, added min cmake requirement back to thirdparty modules to remove warning. --- cpp/CMakeLists.txt | 2 +- cpp/cmake/Templates/Arrow.CMakeLists.txt.cmake | 2 ++ cpp/cmake/Templates/GoogleTest.CMakeLists.txt.cmake | 2 ++ cpp/tests/CMakeLists.txt | 12 +++++++++++- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 8d0f2fb6a03..7c2b4a3502e 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -14,7 +14,7 @@ # limitations under the License. #============================================================================= -cmake_minimum_required(VERSION 3.14..3.17 FATAL_ERROR) +cmake_minimum_required(VERSION 3.14...3.17 FATAL_ERROR) project(CUGRAPH VERSION 0.18.0 LANGUAGES C CXX CUDA) diff --git a/cpp/cmake/Templates/Arrow.CMakeLists.txt.cmake b/cpp/cmake/Templates/Arrow.CMakeLists.txt.cmake index 5898b7d6e2b..85e98e69d5a 100644 --- a/cpp/cmake/Templates/Arrow.CMakeLists.txt.cmake +++ b/cpp/cmake/Templates/Arrow.CMakeLists.txt.cmake @@ -14,6 +14,8 @@ # limitations under the License. #============================================================================= +cmake_minimum_required(VERSION 3.14) + project(cugraph-Arrow) include(ExternalProject) diff --git a/cpp/cmake/Templates/GoogleTest.CMakeLists.txt.cmake b/cpp/cmake/Templates/GoogleTest.CMakeLists.txt.cmake index 1fbee837688..2812662c2a0 100644 --- a/cpp/cmake/Templates/GoogleTest.CMakeLists.txt.cmake +++ b/cpp/cmake/Templates/GoogleTest.CMakeLists.txt.cmake @@ -14,6 +14,8 @@ # limitations under the License. #============================================================================= +cmake_minimum_required(VERSION 3.14) + project(cugraph-GoogleTest) include(ExternalProject) diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index 27cdd51e031..0b0edcddc83 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -96,8 +96,18 @@ function(ConfigureTest CMAKE_TEST_NAME CMAKE_TEST_SRC CMAKE_EXTRA_LIBS) ### BUILD_RPATH "${TARGET_BUILD_RPATH}") ${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 - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/gtests/") + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/gtests/" + CUDA_ARCHITECTURES OFF) add_test(NAME ${CMAKE_TEST_NAME} COMMAND ${CMAKE_TEST_NAME}) endfunction() From a10ad7037b9262abd3b39c946d7558eebee75761 Mon Sep 17 00:00:00 2001 From: Rick Ratzel Date: Mon, 1 Feb 2021 11:35:10 -0600 Subject: [PATCH 03/15] Fixed typo in comment. --- cpp/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 7c2b4a3502e..ae1f3bf7daf 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -471,7 +471,7 @@ endif(OpenMP_CXX_FOUND) if(BUILD_TESTS) if(GTEST_FOUND) # target_link_directories is added in cmake 3.13, and cmake advises to use this instead of - # link_directoires (we should switch to target_link_directories once 3.13 becomes the + # link_directories (we should switch to target_link_directories once 3.13 becomes the # minimum required version). link_directories(${GTEST_LIBRARY_DIR}) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tests) From c5b72c6ab8c3006f0ab9abf4e53a64704aad1b2e Mon Sep 17 00:00:00 2001 From: Rick Ratzel Date: Mon, 1 Feb 2021 15:18:31 -0600 Subject: [PATCH 04/15] Removing unused Arrow cmake files, removing obsolete builddocs conda env file (rapids docs meta pacakge is now recommended) --- conda/environments/builddocs.yml | 19 ---- cpp/cmake/Modules/ConfigureArrow.cmake | 98 ------------------- .../Templates/Arrow.CMakeLists.txt.cmake | 31 ------ 3 files changed, 148 deletions(-) delete mode 100644 conda/environments/builddocs.yml delete mode 100644 cpp/cmake/Modules/ConfigureArrow.cmake delete mode 100644 cpp/cmake/Templates/Arrow.CMakeLists.txt.cmake diff --git a/conda/environments/builddocs.yml b/conda/environments/builddocs.yml deleted file mode 100644 index 89bd44a5542..00000000000 --- a/conda/environments/builddocs.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: builddocs -channels: -- rapidsai -- pytorch -- conda-forge -- numba -- defaults -dependencies: -- python=3.6* -- cugraph=0.8* -- cudatoolkit=9.2 -- cudf=0.8* -- pyarrow=0.12.1.* -- cython=0.29* -- pip: - - numpydoc - - sphinx - - sphinx-rtd-theme - - sphinxcontrib-websupport diff --git a/cpp/cmake/Modules/ConfigureArrow.cmake b/cpp/cmake/Modules/ConfigureArrow.cmake deleted file mode 100644 index b27e53dd415..00000000000 --- a/cpp/cmake/Modules/ConfigureArrow.cmake +++ /dev/null @@ -1,98 +0,0 @@ -set(ARROW_ROOT ${CMAKE_BINARY_DIR}/arrow) - -set(ARROW_CMAKE_ARGS " -DARROW_WITH_LZ4=OFF" - " -DARROW_WITH_ZSTD=OFF" - " -DARROW_WITH_BROTLI=OFF" - " -DARROW_WITH_SNAPPY=OFF" - " -DARROW_WITH_ZLIB=OFF" - " -DARROW_BUILD_STATIC=ON" - " -DARROW_BUILD_SHARED=OFF" - " -DARROW_BOOST_USE_SHARED=ON" - " -DARROW_BUILD_TESTS=OFF" - " -DARROW_TEST_LINKAGE=OFF" - " -DARROW_TEST_MEMCHECK=OFF" - " -DARROW_BUILD_BENCHMARKS=OFF" - " -DARROW_IPC=ON" - " -DARROW_COMPUTE=OFF" - " -DARROW_CUDA=OFF" - " -DARROW_JEMALLOC=OFF" - " -DARROW_BOOST_VENDORED=OFF" - " -DARROW_PYTHON=OFF" - " -DARROW_USE_GLOG=OFF" - " -DCMAKE_VERBOSE_MAKEFILE=ON") - -configure_file("${CMAKE_SOURCE_DIR}/cmake/Templates/Arrow.CMakeLists.txt.cmake" - "${ARROW_ROOT}/CMakeLists.txt") - -file(MAKE_DIRECTORY "${ARROW_ROOT}/build") -file(MAKE_DIRECTORY "${ARROW_ROOT}/install") - -execute_process( - COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . - RESULT_VARIABLE ARROW_CONFIG - WORKING_DIRECTORY ${ARROW_ROOT}) - -if(ARROW_CONFIG) - message(FATAL_ERROR "Configuring Arrow failed: " ${ARROW_CONFIG}) -endif(ARROW_CONFIG) - -set(PARALLEL_BUILD -j) -if($ENV{PARALLEL_LEVEL}) - set(NUM_JOBS $ENV{PARALLEL_LEVEL}) - set(PARALLEL_BUILD "${PARALLEL_BUILD}${NUM_JOBS}") -endif($ENV{PARALLEL_LEVEL}) - -if(${NUM_JOBS}) - if(${NUM_JOBS} EQUAL 1) - message(STATUS "ARROW BUILD: Enabling Sequential CMake build") - elseif(${NUM_JOBS} GREATER 1) - message(STATUS "ARROW BUILD: Enabling Parallel CMake build with ${NUM_JOBS} jobs") - endif(${NUM_JOBS} EQUAL 1) -else() - message(STATUS "ARROW BUILD: Enabling Parallel CMake build with all threads") -endif(${NUM_JOBS}) - -execute_process( - COMMAND ${CMAKE_COMMAND} --build .. -- ${PARALLEL_BUILD} - RESULT_VARIABLE ARROW_BUILD - WORKING_DIRECTORY ${ARROW_ROOT}/build) - -if(ARROW_BUILD) - message(FATAL_ERROR "Building Arrow failed: " ${ARROW_BUILD}) -endif(ARROW_BUILD) - -set(ARROW_GENERATED_IPC_DIR - "${ARROW_ROOT}/build/src/arrow/ipc") - -configure_file(${ARROW_GENERATED_IPC_DIR}/File_generated.h ${CMAKE_SOURCE_DIR}/include/cudf/ipc_generated/File_generated.h COPYONLY) -configure_file(${ARROW_GENERATED_IPC_DIR}/Message_generated.h ${CMAKE_SOURCE_DIR}/include/cudf/ipc_generated/Message_generated.h COPYONLY) -configure_file(${ARROW_GENERATED_IPC_DIR}/Schema_generated.h ${CMAKE_SOURCE_DIR}/include/cudf/ipc_generated/Schema_generated.h COPYONLY) -configure_file(${ARROW_GENERATED_IPC_DIR}/Tensor_generated.h ${CMAKE_SOURCE_DIR}/include/cudf/ipc_generated/Tensor_generated.h COPYONLY) - -message(STATUS "Arrow installed here: " ${ARROW_ROOT}/install) -set(ARROW_LIBRARY_DIR "${ARROW_ROOT}/install/lib") -set(ARROW_INCLUDE_DIR "${ARROW_ROOT}/install/include") - -find_library(ARROW_LIB arrow - NO_DEFAULT_PATH - HINTS "${ARROW_LIBRARY_DIR}") - -if(ARROW_LIB) - message(STATUS "Arrow library: " ${ARROW_LIB}) - set(ARROW_FOUND TRUE) -endif(ARROW_LIB) - -set(FLATBUFFERS_ROOT "${ARROW_ROOT}/build/flatbuffers_ep-prefix/src/flatbuffers_ep-install") - -message(STATUS "FlatBuffers installed here: " ${FLATBUFFERS_ROOT}) -set(FLATBUFFERS_INCLUDE_DIR "${FLATBUFFERS_ROOT}/include") -set(FLATBUFFERS_LIBRARY_DIR "${FLATBUFFERS_ROOT}/lib") - -add_definitions(-DARROW_METADATA_V4) -add_definitions(-DARROW_VERSION=1210) - - - - - - diff --git a/cpp/cmake/Templates/Arrow.CMakeLists.txt.cmake b/cpp/cmake/Templates/Arrow.CMakeLists.txt.cmake deleted file mode 100644 index 85e98e69d5a..00000000000 --- a/cpp/cmake/Templates/Arrow.CMakeLists.txt.cmake +++ /dev/null @@ -1,31 +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. -#============================================================================= - -cmake_minimum_required(VERSION 3.14) - -project(cugraph-Arrow) - -include(ExternalProject) - -ExternalProject_Add(Arrow - GIT_REPOSITORY https://github.com/apache/arrow.git - GIT_TAG apache-arrow-0.12.1 - GIT_SHALLOW true - SOURCE_DIR "${ARROW_ROOT}/arrow" - SOURCE_SUBDIR "cpp" - BINARY_DIR "${ARROW_ROOT}/build" - INSTALL_DIR "${ARROW_ROOT}/install" - CMAKE_ARGS ${ARROW_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=${ARROW_ROOT}/install) From 8fdde72f371ddbf46448b79a236e3a8c94a42e5d Mon Sep 17 00:00:00 2001 From: Rick Ratzel Date: Mon, 1 Feb 2021 16:45:28 -0600 Subject: [PATCH 05/15] Replaced GoogleTest build with a find_package() required call and updated the conda dev env files accordingly. --- conda/environments/cugraph_dev_cuda10.1.yml | 1 + conda/environments/cugraph_dev_cuda10.2.yml | 1 + conda/environments/cugraph_dev_cuda11.0.yml | 1 + cpp/CMakeLists.txt | 10 +--- cpp/cmake/Modules/ConfigureGoogleTest.cmake | 49 ------------------- .../Templates/GoogleTest.CMakeLists.txt.cmake | 30 ------------ cpp/tests/CMakeLists.txt | 15 ++++-- 7 files changed, 16 insertions(+), 91 deletions(-) delete mode 100644 cpp/cmake/Modules/ConfigureGoogleTest.cmake delete mode 100644 cpp/cmake/Templates/GoogleTest.CMakeLists.txt.cmake diff --git a/conda/environments/cugraph_dev_cuda10.1.yml b/conda/environments/cugraph_dev_cuda10.1.yml index 067fd0bc4ba..e490a99b757 100644 --- a/conda/environments/cugraph_dev_cuda10.1.yml +++ b/conda/environments/cugraph_dev_cuda10.1.yml @@ -44,3 +44,4 @@ dependencies: - libcypher-parser - rapids-pytest-benchmark - doxygen +- gtest diff --git a/conda/environments/cugraph_dev_cuda10.2.yml b/conda/environments/cugraph_dev_cuda10.2.yml index 3371340d8bd..fa3af67e533 100644 --- a/conda/environments/cugraph_dev_cuda10.2.yml +++ b/conda/environments/cugraph_dev_cuda10.2.yml @@ -44,3 +44,4 @@ dependencies: - libcypher-parser - rapids-pytest-benchmark - doxygen +- gtest diff --git a/conda/environments/cugraph_dev_cuda11.0.yml b/conda/environments/cugraph_dev_cuda11.0.yml index ee3b57632a1..1496bc6fb5b 100644 --- a/conda/environments/cugraph_dev_cuda11.0.yml +++ b/conda/environments/cugraph_dev_cuda11.0.yml @@ -44,3 +44,4 @@ dependencies: - libcypher-parser - rapids-pytest-benchmark - doxygen +- gtest diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index ae1f3bf7daf..6e267c85b39 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -156,15 +156,7 @@ endif(OpenMP_FOUND) # - find gtest ------------------------------------------------------------------------------------ if(BUILD_TESTS) - include(ConfigureGoogleTest) - - if(GTEST_FOUND) - message(STATUS - "Google C++ Testing Framework (Google Test) found in ${GTEST_ROOT}") - else() - message(AUTHOR_WARNING - "Google C++ Testing Framework (Google Test) not found: automated tests are disabled.") - endif(GTEST_FOUND) + find_package(GTest REQUIRED) endif(BUILD_TESTS) ################################################################################################### diff --git a/cpp/cmake/Modules/ConfigureGoogleTest.cmake b/cpp/cmake/Modules/ConfigureGoogleTest.cmake deleted file mode 100644 index 9fac40f4649..00000000000 --- a/cpp/cmake/Modules/ConfigureGoogleTest.cmake +++ /dev/null @@ -1,49 +0,0 @@ -set(GTEST_ROOT "${CMAKE_BINARY_DIR}/googletest") - -set(GTEST_CMAKE_ARGS "") - #" -Dgtest_build_samples=ON" - #" -DCMAKE_VERBOSE_MAKEFILE=ON") - -configure_file("${CMAKE_SOURCE_DIR}/cmake/Templates/GoogleTest.CMakeLists.txt.cmake" - "${GTEST_ROOT}/CMakeLists.txt") - -file(MAKE_DIRECTORY "${GTEST_ROOT}/build") -file(MAKE_DIRECTORY "${GTEST_ROOT}/install") - -execute_process(COMMAND ${CMAKE_COMMAND} -G ${CMAKE_GENERATOR} . - RESULT_VARIABLE GTEST_CONFIG - WORKING_DIRECTORY ${GTEST_ROOT}) - -if(GTEST_CONFIG) - message(FATAL_ERROR "Configuring GoogleTest failed: " ${GTEST_CONFIG}) -endif(GTEST_CONFIG) - -set(PARALLEL_BUILD -j) -if($ENV{PARALLEL_LEVEL}) - set(NUM_JOBS $ENV{PARALLEL_LEVEL}) - set(PARALLEL_BUILD "${PARALLEL_BUILD}${NUM_JOBS}") -endif($ENV{PARALLEL_LEVEL}) - -if(${NUM_JOBS}) - if(${NUM_JOBS} EQUAL 1) - message(STATUS "GTEST BUILD: Enabling Sequential CMake build") - elseif(${NUM_JOBS} GREATER 1) - message(STATUS "GTEST BUILD: Enabling Parallel CMake build with ${NUM_JOBS} jobs") - endif(${NUM_JOBS} EQUAL 1) -else() - message(STATUS "GTEST BUILD: Enabling Parallel CMake build with all threads") -endif(${NUM_JOBS}) - -execute_process(COMMAND ${CMAKE_COMMAND} --build .. -- ${PARALLEL_BUILD} - RESULT_VARIABLE GTEST_BUILD - WORKING_DIRECTORY ${GTEST_ROOT}/build) - -if(GTEST_BUILD) - message(FATAL_ERROR "Building GoogleTest failed: " ${GTEST_BUILD}) -endif(GTEST_BUILD) - -message(STATUS "GoogleTest installed here: " ${GTEST_ROOT}/install) -set(GTEST_INCLUDE_DIR "${GTEST_ROOT}/install/include") -set(GTEST_LIBRARY_DIR "${GTEST_ROOT}/install/lib") -set(GTEST_FOUND TRUE) - diff --git a/cpp/cmake/Templates/GoogleTest.CMakeLists.txt.cmake b/cpp/cmake/Templates/GoogleTest.CMakeLists.txt.cmake deleted file mode 100644 index 2812662c2a0..00000000000 --- a/cpp/cmake/Templates/GoogleTest.CMakeLists.txt.cmake +++ /dev/null @@ -1,30 +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. -#============================================================================= - -cmake_minimum_required(VERSION 3.14) - -project(cugraph-GoogleTest) - -include(ExternalProject) - -ExternalProject_Add(GoogleTest - GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG release-1.8.0 - GIT_SHALLOW true - SOURCE_DIR "${GTEST_ROOT}/googletest" - BINARY_DIR "${GTEST_ROOT}/build" - INSTALL_DIR "${GTEST_ROOT}/install" - CMAKE_ARGS ${GTEST_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=${GTEST_ROOT}/install) diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index 0b0edcddc83..3d1fe88cc7d 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -30,7 +30,6 @@ function(ConfigureTest CMAKE_TEST_NAME CMAKE_TEST_SRC CMAKE_EXTRA_LIBS) "${CUCO_INCLUDE_DIR}" "${LIBCUDACXX_INCLUDE_DIR}" "${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}" - "${GTEST_INCLUDE_DIR}" "${RMM_INCLUDE}" "${CUDF_INCLUDE}" "${CUDF_INCLUDE}/libcudf/libcudacxx" @@ -44,7 +43,18 @@ function(ConfigureTest CMAKE_TEST_NAME CMAKE_TEST_SRC CMAKE_EXTRA_LIBS) target_link_libraries(${CMAKE_TEST_NAME} PRIVATE - gtest gmock_main gmock cugraph ${CUDF_LIBRARY} ${CMAKE_EXTRA_LIBS} ${NCCL_LIBRARIES} cudart cuda cublas cusparse cusolver curand) + cugraph + GTest::GTest + GTest::Main + ${CUDF_LIBRARY} + ${NCCL_LIBRARIES} + cudart + cuda + cublas + cusparse + cusolver + curand + ${CMAKE_EXTRA_LIBS}) if(OpenMP_CXX_FOUND) target_link_libraries(${CMAKE_TEST_NAME} PRIVATE @@ -106,7 +116,6 @@ function(ConfigureTest CMAKE_TEST_NAME CMAKE_TEST_SRC CMAKE_EXTRA_LIBS) # 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 - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/gtests/" CUDA_ARCHITECTURES OFF) add_test(NAME ${CMAKE_TEST_NAME} COMMAND ${CMAKE_TEST_NAME}) From 27aea253490a61cccc59f18a4f8c760e6b1da771 Mon Sep 17 00:00:00 2001 From: Rick Ratzel Date: Tue, 2 Feb 2021 15:09:36 -0600 Subject: [PATCH 06/15] Updated to use FetchContent for all but gunrock (due to possible issues with gunrock cmake files), updated python setup utils to understand new FetchContent dirs and syntax when reading from CMakeLists.txt --- cpp/CMakeLists.txt | 120 ++++++++++++++++++++++--------------------- python/setuputils.py | 46 ++++++++++++----- 2 files changed, 93 insertions(+), 73 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 6e267c85b39..eba463136cc 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -160,7 +160,7 @@ if(BUILD_TESTS) endif(BUILD_TESTS) ################################################################################################### -# - RMM ------------------------------------------------------------------------------------------- +# - find RMM -------------------------------------------------------------------------------------- find_path(RMM_INCLUDE "rmm" HINTS @@ -170,6 +170,18 @@ find_path(RMM_INCLUDE "rmm" 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) + + ################################################################################################### # - Fetch Content --------------------------------------------------------------------------------- include(FetchContent) @@ -227,26 +239,61 @@ endif() set(LIBCUDACXX_INCLUDE_DIR "${libcudacxx_SOURCE_DIR}/include") message("set LIBCUDACXX_INCLUDE_DIR to: ${LIBCUDACXX_INCLUDE_DIR}") +# - CUHORNET +FetchContent_Declare( + cuhornet + GIT_REPOSITORY https://github.com/rapidsai/cuhornet.git + GIT_TAG 9cb8e8803852bd895a9c95c0fe778ad6eeefa7ad + GIT_SHALLOW true + SOURCE_SUBDIR hornet +) + +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()`. +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") + set(RAFT_DIR ${CMAKE_CURRENT_BINARY_DIR}/raft CACHE STRING "Path to RAFT repo") + + FetchContent_Declare( + raft + GIT_REPOSITORY https://github.com/rapidsai/raft.git + GIT_TAG 9dbf2c8a9134ce8135f7fe947ec523d874fcab6a + 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 -include(ExternalProject) -# - CUHORNET -set(CUHORNET_DIR ${CMAKE_CURRENT_BINARY_DIR}/cuhornet CACHE STRING "Path to cuhornet repo") -set(CUHORNET_INCLUDE_DIR ${CUHORNET_DIR}/src/cuhornet CACHE STRING "Path to cuhornet includes") +# FIXME: gunrock is the only external package still using ExternalProject +# instead of FetchContent. Consider migrating to FetchContent soon (this may +# require updates to the gunrock cmake files to support this). - -ExternalProject_Add(cuhornet - GIT_REPOSITORY https://github.com/rapidsai/cuhornet.git - GIT_TAG 9cb8e8803852bd895a9c95c0fe778ad6eeefa7ad - PREFIX ${CUHORNET_DIR} - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" -) +include(ExternalProject) # - GUNROCK set(GUNROCK_DIR ${CMAKE_CURRENT_BINARY_DIR}/gunrock CACHE STRING "Path to gunrock repo") @@ -272,53 +319,9 @@ ExternalProject_Add(gunrock_ext ) 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) -# - 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) - -# - 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}") - - ExternalProject_Add(raft - DOWNLOAD_COMMAND "" - SOURCE_DIR ${RAFT_DIR} - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "") - -else(DEFINED ENV{RAFT_PATH}) - message(STATUS "RAFT_PATH environment variable NOT detected, cloning RAFT") - set(RAFT_DIR ${CMAKE_CURRENT_BINARY_DIR}/raft CACHE STRING "Path to RAFT repo") - - ExternalProject_Add(raft - GIT_REPOSITORY https://github.com/rapidsai/raft.git - GIT_TAG 9dbf2c8a9134ce8135f7fe947ec523d874fcab6a - PREFIX ${RAFT_DIR} - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "") - - # Redefining RAFT_DIR so it coincides with the one inferred by env variable. - set(RAFT_DIR "${RAFT_DIR}/src/raft/") -endif(DEFINED ENV{RAFT_PATH}) - - ################################################################################################### # - library targets ------------------------------------------------------------------------------- @@ -375,7 +378,6 @@ add_library(cugraph SHARED # wait until after cugunrock is constructed. # add_dependencies(cugraph gunrock_ext) -add_dependencies(cugraph raft) ################################################################################################### # - include paths --------------------------------------------------------------------------------- diff --git a/python/setuputils.py b/python/setuputils.py index 360526c2b56..6ee6cd076ee 100644 --- a/python/setuputils.py +++ b/python/setuputils.py @@ -79,8 +79,8 @@ def use_raft_package(raft_path, cpp_build_path, if you want to change RAFT location. - Uses RAFT located in $RAFT_PATH if $RAFT_PATH exists. - Otherwise it will look for RAFT in the libcugraph build folder, - located either in the default location ../cpp/build or in - $CUGRAPH_BUILD_PATH. + located either in the default locations ../cpp/build/raft, + ../cpp/build/_deps/raft-src, or in $CUGRAPH_BUILD_PATH. -Otherwise it will clone RAFT into _external_repositories. - Branch/git tag cloned is located in git_info_file in this case. @@ -88,17 +88,25 @@ def use_raft_package(raft_path, cpp_build_path, ------- raft_include_path: Str Path to the C++ include folder of RAFT + """ if os.path.isdir('cugraph/raft'): raft_path = os.path.realpath('cugraph/raft') # walk up two dirs from `python/raft` raft_path = os.path.join(raft_path, '..', '..') print("-- Using existing RAFT folder") + elif cpp_build_path and os.path.isdir(os.path.join(cpp_build_path, + '_deps/raft-src')): + raft_path = os.path.join(cpp_build_path, '_deps/raft-src') + raft_path = os.path.realpath(raft_path) + print("-- Using existing RAFT folder in CPP build dir from cmake " + "FetchContent") elif cpp_build_path and os.path.isdir(os.path.join(cpp_build_path, 'raft/src/raft')): raft_path = os.path.join(cpp_build_path, 'raft/src/raft') raft_path = os.path.realpath(raft_path) - print("-- Using existing RAFT folder in CPP build dir") + print("-- Using existing RAFT folder in CPP build dir from cmake " + "ExternalProject") elif isinstance(raft_path, (str, os.PathLike)): print('-- Using RAFT_PATH argument') elif os.environ.get('RAFT_PATH', False) is not False: @@ -253,9 +261,9 @@ def get_repo_cmake_info(names, file_path): the names of the cmake git clone instruction `ExternalProject_Add(name` file_path : String - Relative path of the location of the CMakeLists.txt (or the cmake - module which contains ExternalProject_Add definitions) to extract - the information. + 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. Returns ------- @@ -271,15 +279,25 @@ def get_repo_cmake_info(names, file_path): results = {} + cmake_ext_proj_decls = ["FetchContent_Declare", "ExternalProject_Add"] + for name in names: - res = re.findall(r'ExternalProject_Add\(' + re.escape(name) - + '\s.*GIT_REPOSITORY.*\s.*GIT_TAG.*', # noqa: W605 - s) - - res = re.sub(' +', ' ', res[0]) - res = res.split(' ') - res = [res[2][:-1], res[4]] - results[name] = res + res = None + for decl in cmake_ext_proj_decls: + res = re.search(f'{decl}\(\s*' + + '(' + re.escape(name) + ')' + + '\s+.*GIT_REPOSITORY\s+(\S+)\s+.+' + + '\s+.*GIT_TAG\s+(\S+)', + 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)] return results From 0af9d205fdf8356f586a7c63a85383f14adf5d2e Mon Sep 17 00:00:00 2001 From: Rick Ratzel Date: Tue, 2 Feb 2021 15:16:19 -0600 Subject: [PATCH 07/15] Updated copyright year --- python/setuputils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/setuputils.py b/python/setuputils.py index 6ee6cd076ee..3f9c0a97239 100644 --- a/python/setuputils.py +++ b/python/setuputils.py @@ -1,5 +1,5 @@ # -# 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. From d504ed911a5e025e85179bdf16edf764fccf3ab0 Mon Sep 17 00:00:00 2001 From: Rick Ratzel Date: Tue, 2 Feb 2021 15:31:59 -0600 Subject: [PATCH 08/15] flake8 updates. --- python/setuputils.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/python/setuputils.py b/python/setuputils.py index 3f9c0a97239..47eaf74d4b6 100644 --- a/python/setuputils.py +++ b/python/setuputils.py @@ -261,9 +261,9 @@ def get_repo_cmake_info(names, file_path): the names of the cmake git clone instruction `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. + 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. Returns ------- @@ -272,7 +272,6 @@ 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: s = f.read() @@ -284,10 +283,10 @@ def get_repo_cmake_info(names, file_path): for name in names: res = None for decl in cmake_ext_proj_decls: - res = re.search(f'{decl}\(\s*' + res = re.search(f'{decl}\(\s*' # noqa: W605 + '(' + re.escape(name) + ')' - + '\s+.*GIT_REPOSITORY\s+(\S+)\s+.+' - + '\s+.*GIT_TAG\s+(\S+)', + + '\s+.*GIT_REPOSITORY\s+(\S+)\s+.+' # noqa: W605 + + '\s+.*GIT_TAG\s+(\S+)', # noqa: W605 s) if res: break From 84c5fd561055935987f8d971c2fd08e39c04dac4 Mon Sep 17 00:00:00 2001 From: Rick Ratzel Date: Tue, 2 Feb 2021 15:34:48 -0600 Subject: [PATCH 09/15] Removing unused RAFT_DIR var setting. --- cpp/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index eba463136cc..3c52e210c8d 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -265,7 +265,6 @@ if(DEFINED ENV{RAFT_PATH}) else(DEFINED ENV{RAFT_PATH}) message(STATUS "RAFT_PATH environment variable NOT detected, cloning RAFT") - set(RAFT_DIR ${CMAKE_CURRENT_BINARY_DIR}/raft CACHE STRING "Path to RAFT repo") FetchContent_Declare( raft From 85aa13be436e8c97edcebc4948b4143077433184 Mon Sep 17 00:00:00 2001 From: Rick Ratzel Date: Tue, 2 Feb 2021 15:52:12 -0600 Subject: [PATCH 10/15] Added gtest to libcugraph build deps since it is no longer built from-source as part of the libcugraph build. --- conda/recipes/libcugraph/meta.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/conda/recipes/libcugraph/meta.yaml b/conda/recipes/libcugraph/meta.yaml index 211ec920d27..f6cc566b6f0 100644 --- a/conda/recipes/libcugraph/meta.yaml +++ b/conda/recipes/libcugraph/meta.yaml @@ -32,6 +32,7 @@ requirements: - nccl>=2.7 - ucx-py {{ minor_version }} - ucx-proc=*=gpu + - gtest run: - libcudf={{ minor_version }} - {{ pin_compatible('cudatoolkit', max_pin='x.x') }} From c634af6d45dcde6636891ac21c0a6014bc1b9a48 Mon Sep 17 00:00:00 2001 From: Rick Ratzel Date: Tue, 2 Feb 2021 15:54:32 -0600 Subject: [PATCH 11/15] Updated copyright to include current year. --- conda/recipes/libcugraph/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda/recipes/libcugraph/meta.yaml b/conda/recipes/libcugraph/meta.yaml index f6cc566b6f0..7063d99b665 100644 --- a/conda/recipes/libcugraph/meta.yaml +++ b/conda/recipes/libcugraph/meta.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2018, NVIDIA CORPORATION. +# Copyright (c) 2018-2021, NVIDIA CORPORATION. # Usage: # conda build -c nvidia -c rapidsai -c conda-forge -c defaults . From fa4fd6b1e44699e516c44c616da5b8a461e6250d Mon Sep 17 00:00:00 2001 From: Rick Ratzel Date: Tue, 2 Feb 2021 16:46:41 -0600 Subject: [PATCH 12/15] Adding gmock dependency to support test binary builds that run as part of libcugraph conda build. --- conda/recipes/libcugraph/meta.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/conda/recipes/libcugraph/meta.yaml b/conda/recipes/libcugraph/meta.yaml index 7063d99b665..955c723bd27 100644 --- a/conda/recipes/libcugraph/meta.yaml +++ b/conda/recipes/libcugraph/meta.yaml @@ -33,6 +33,7 @@ requirements: - ucx-py {{ minor_version }} - ucx-proc=*=gpu - gtest + - gmock run: - libcudf={{ minor_version }} - {{ pin_compatible('cudatoolkit', max_pin='x.x') }} From e5c3356abaf7f353f906c6d573790dd0f2c131ad Mon Sep 17 00:00:00 2001 From: Rick Ratzel Date: Tue, 2 Feb 2021 16:53:27 -0600 Subject: [PATCH 13/15] Adding gmock to support building C++ tests that require it. --- conda/environments/cugraph_dev_cuda10.1.yml | 1 + conda/environments/cugraph_dev_cuda10.2.yml | 1 + conda/environments/cugraph_dev_cuda11.0.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/conda/environments/cugraph_dev_cuda10.1.yml b/conda/environments/cugraph_dev_cuda10.1.yml index 83f47b92ada..c11be36f78d 100644 --- a/conda/environments/cugraph_dev_cuda10.1.yml +++ b/conda/environments/cugraph_dev_cuda10.1.yml @@ -46,3 +46,4 @@ dependencies: - doxygen - pytest-cov - gtest +- gmock diff --git a/conda/environments/cugraph_dev_cuda10.2.yml b/conda/environments/cugraph_dev_cuda10.2.yml index bacb829c8b7..67b9fbde780 100644 --- a/conda/environments/cugraph_dev_cuda10.2.yml +++ b/conda/environments/cugraph_dev_cuda10.2.yml @@ -46,3 +46,4 @@ dependencies: - doxygen - pytest-cov - gtest +- gmock diff --git a/conda/environments/cugraph_dev_cuda11.0.yml b/conda/environments/cugraph_dev_cuda11.0.yml index 2d46aaff4f7..b2f6afe388a 100644 --- a/conda/environments/cugraph_dev_cuda11.0.yml +++ b/conda/environments/cugraph_dev_cuda11.0.yml @@ -46,3 +46,4 @@ dependencies: - doxygen - pytest-cov - gtest +- gmock From cd85551ff3d52423dafe4348f725da4facf6b48a Mon Sep 17 00:00:00 2001 From: Rick Ratzel Date: Wed, 3 Feb 2021 14:17:24 -0600 Subject: [PATCH 14/15] Updated min cmake version to 3.18 to match RMM and others. --- cpp/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 3c52e210c8d..08b5e63819a 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -14,7 +14,7 @@ # limitations under the License. #============================================================================= -cmake_minimum_required(VERSION 3.14...3.17 FATAL_ERROR) +cmake_minimum_required(VERSION 3.18...3.18 FATAL_ERROR) project(CUGRAPH VERSION 0.18.0 LANGUAGES C CXX CUDA) From 30640f7cd1e30675075ade99e490d85e8e088aef Mon Sep 17 00:00:00 2001 From: Rick Ratzel Date: Wed, 3 Feb 2021 15:35:01 -0600 Subject: [PATCH 15/15] Setting CUDA_ARCHITECTURES on the libcugraph target as required by cmake 3.18. --- cpp/CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 08b5e63819a..19bfd24a591 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -458,6 +458,17 @@ 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 --------------------------------------------------------------------------------