From 8b67253eb1b094fd9cb27adcf0c6b9b24d95a4be Mon Sep 17 00:00:00 2001 From: James Lamb Date: Thu, 23 Jan 2025 16:28:57 -0600 Subject: [PATCH 1/5] increase parallelism in wheel builds, enforce cmake-format and cmake-lint --- .github/workflows/build.yaml | 4 +- .pre-commit-config.yaml | 27 +- ci/check_style.sh | 6 +- cpp/CMakeLists.txt | 237 ++++++++-------- cpp/benchmarks/CMakeLists.txt | 126 ++++----- cpp/cmake/Modules/ConfigureCUDA.cmake | 25 +- cpp/cmake/config.json | 13 +- cpp/cuproj/CMakeLists.txt | 169 ++++++----- cpp/cuproj/benchmarks/CMakeLists.txt | 48 ++-- cpp/cuproj/cmake/modules/ConfigureCUDA.cmake | 25 +- cpp/cuproj/tests/CMakeLists.txt | 55 ++-- cpp/scripts/run-cmake-format.sh | 83 ++++++ cpp/tests/CMakeLists.txt | 266 ++++++++---------- java/src/main/native/CMakeLists.txt | 133 ++++----- python/cuproj/CMakeLists.txt | 6 +- python/cuproj/cuproj/_lib/CMakeLists.txt | 8 +- .../cuproj/cuproj/cuprojshim/CMakeLists.txt | 88 +++--- .../cuspatial/cuspatial/_lib/CMakeLists.txt | 8 +- python/libcuspatial/CMakeLists.txt | 5 +- rapids_config.cmake | 8 +- 20 files changed, 693 insertions(+), 647 deletions(-) create mode 100755 cpp/scripts/run-cmake-format.sh diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fe7421d7f..505b4c888 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -88,8 +88,10 @@ jobs: date: ${{ inputs.date }} package-name: libcuspatial package-type: cpp + # build for every combination of arch and CUDA version, but only for the latest Python + matrix_filter: group_by([.ARCH, (.CUDA_VER|split(".")|map(tonumber)|.[0])]) | map(max_by(.PY_VER|split(".")|map(tonumber))) wheel-build-cuspatial: - needs: wheel-publish-libcuspatial + needs: wheel-build-libcuspatial secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-25.02 with: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 77a98437e..8af1cfaf9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -52,7 +52,32 @@ repos: hooks: - id: rapids-dependency-file-generator args: ["--clean"] - + - repo: local + hooks: + - id: cmake-format + name: cmake-format + entry: ./cpp/scripts/run-cmake-format.sh cmake-format + language: python + types: [cmake] + exclude: .*/thirdparty/.* + # Note that pre-commit autoupdate does not update the versions + # of dependencies, so we'll have to update this manually. + additional_dependencies: + - cmakelang==0.6.13 + verbose: true + require_serial: true + - id: cmake-lint + name: cmake-lint + entry: ./cpp/scripts/run-cmake-format.sh cmake-lint + language: python + types: [cmake] + exclude: .*/thirdparty/.* + # Note that pre-commit autoupdate does not update the versions + # of dependencies, so we'll have to update this manually. + additional_dependencies: + - cmakelang==0.6.13 + verbose: true + require_serial: true default_language_version: python: python3 diff --git a/ci/check_style.sh b/ci/check_style.sh index cbc369dc0..cdaee40a8 100755 --- a/ci/check_style.sh +++ b/ci/check_style.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) 2020-2024, NVIDIA CORPORATION. +# Copyright (c) 2020-2025, NVIDIA CORPORATION. set -euo pipefail @@ -14,7 +14,9 @@ rapids-dependency-file-generator \ rapids-mamba-retry env create --yes -f env.yaml -n checks conda activate checks -FORMAT_FILE_URL=https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-23.02/cmake-format-rapids-cmake.json +# get config for cmake-format checks +RAPIDS_VERSION_MAJOR_MINOR="$(rapids-version-major-minor)" +FORMAT_FILE_URL="https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-${RAPIDS_VERSION_MAJOR_MINOR}/cmake-format-rapids-cmake.json" export RAPIDS_CMAKE_FORMAT_FILE=/tmp/rapids_cmake_ci/cmake-formats-rapids-cmake.json mkdir -p $(dirname ${RAPIDS_CMAKE_FORMAT_FILE}) wget -O ${RAPIDS_CMAKE_FORMAT_FILE} ${FORMAT_FILE_URL} diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 8908617b1..b6ea271ed 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -1,5 +1,5 @@ #============================================================================= -# Copyright (c) 2019-2024, NVIDIA CORPORATION. +# Copyright (c) 2019-2025, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -25,7 +25,10 @@ include(rapids-find) rapids_cuda_init_architectures(CUSPATIAL) -project(CUSPATIAL VERSION "${RAPIDS_VERSION}" LANGUAGES C CXX CUDA) +project( + CUSPATIAL + VERSION "${RAPIDS_VERSION}" + LANGUAGES C CXX CUDA) # Needed because GoogleBenchmark changes the state of FindThreads.cmake, # causing subsequent runs to have different values for the `Threads::Threads` target. @@ -47,7 +50,8 @@ option(BUILD_BENCHMARKS "Configure CMake to build (google) benchmarks" OFF) option(PER_THREAD_DEFAULT_STREAM "Build with per-thread default stream" OFF) option(DISABLE_DEPRECATION_WARNING "Disable warnings generated from deprecated declarations." OFF) # Option to enable line info in CUDA device compilation to allow introspection when profiling / memchecking -option(CUDA_ENABLE_LINEINFO "Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler" OFF) +option(CUDA_ENABLE_LINEINFO + "Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler" OFF) # cudart can be statically linked or dynamically linked. The python ecosystem wants dynamic linking option(CUDA_STATIC_RUNTIME "Statically link the CUDA toolkit runtime and libraries" OFF) @@ -58,9 +62,17 @@ message(STATUS "CUSPATIAL: Build with NVTX support: ${USE_NVTX}") message(STATUS "CUSPATIAL: Configure CMake to build tests: ${BUILD_TESTS}") message(STATUS "CUSPATIAL: Configure CMake to build (google) benchmarks: ${BUILD_BENCHMARKS}") message(STATUS "CUSPATIAL: Build with per-thread default stream: ${PER_THREAD_DEFAULT_STREAM}") -message(STATUS "CUSPATIAL: Disable warnings generated from deprecated declarations: ${DISABLE_DEPRECATION_WARNING}") -message(STATUS "CUSPATIAL: Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler: ${CUDA_ENABLE_LINEINFO}") -message(STATUS "CUSPATIAL: Statically link the CUDA toolkit runtime and libraries: ${CUDA_STATIC_RUNTIME}") +message( + STATUS + "CUSPATIAL: Disable warnings generated from deprecated declarations: ${DISABLE_DEPRECATION_WARNING}" +) +message( + STATUS + "CUSPATIAL: Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler: ${CUDA_ENABLE_LINEINFO}" +) +message( + STATUS "CUSPATIAL: Statically link the CUDA toolkit runtime and libraries: ${CUDA_STATIC_RUNTIME}" +) # Set a default build type if none was specified rapids_cmake_build_type("Release") @@ -73,8 +85,11 @@ set(CUSPATIAL_CXX_DEFINITIONS "") set(CUSPATIAL_CUDA_DEFINITIONS "") # Set RMM logging level -set(RMM_LOGGING_LEVEL "INFO" CACHE STRING "Choose the logging level.") -set_property(CACHE RMM_LOGGING_LEVEL PROPERTY STRINGS "TRACE" "DEBUG" "INFO" "WARN" "ERROR" "CRITICAL" "OFF") +set(RMM_LOGGING_LEVEL + "INFO" + CACHE STRING "Choose the logging level.") +set_property(CACHE RMM_LOGGING_LEVEL PROPERTY STRINGS "TRACE" "DEBUG" "INFO" "WARN" "ERROR" + "CRITICAL" "OFF") message(STATUS "CUSPATIAL: RMM_LOGGING_LEVEL = '${RMM_LOGGING_LEVEL}'.") ################################################################################################### @@ -87,11 +102,8 @@ rapids_cmake_support_conda_env(conda_env MODIFY_PREFIX_PATH) rapids_cuda_init_runtime(USE_STATIC ${CUDA_STATIC_RUNTIME}) -rapids_find_package( - CUDAToolkit REQUIRED - BUILD_EXPORT_SET cuspatial-exports - INSTALL_EXPORT_SET cuspatial-exports -) +rapids_find_package(CUDAToolkit REQUIRED BUILD_EXPORT_SET cuspatial-exports INSTALL_EXPORT_SET + cuspatial-exports) # * find CUDAToolkit package # * determine GPU architectures # * enable the CMake CUDA language @@ -106,12 +118,12 @@ rapids_cpm_init() # find or add cuDF include(cmake/thirdparty/get_cudf.cmake) # find or install GoogleTest -if (CUSPATIAL_BUILD_TESTS) +if(CUSPATIAL_BUILD_TESTS) include(${rapids-cmake-dir}/cpm/gtest.cmake) rapids_cpm_gtest(BUILD_STATIC) endif() # find or add ranger -include (cmake/thirdparty/get_ranger.cmake) +include(cmake/thirdparty/get_ranger.cmake) ################################################################################################### # - library targets ------------------------------------------------------------------------------- @@ -119,63 +131,61 @@ include (cmake/thirdparty/get_ranger.cmake) # cuProj add_subdirectory(cuproj) -add_library(cuspatial - src/bounding_boxes/linestring_bounding_boxes.cu - src/bounding_boxes/polygon_bounding_boxes.cu - src/column/geometry_column_view.cpp - src/distance/hausdorff.cu - src/distance/haversine.cu - src/distance/linestring_distance.cu - src/distance/linestring_polygon_distance.cu - src/distance/point_distance.cu - src/distance/point_linestring_distance.cu - src/distance/point_polygon_distance.cu - src/distance/polygon_distance.cu - src/equality/pairwise_multipoint_equals_count.cu - src/indexing/point_quadtree.cu - src/intersection/linestring_intersection.cu - src/join/quadtree_point_in_polygon.cu - src/join/quadtree_point_to_nearest_linestring.cu - src/join/quadtree_bbox_filtering.cu - src/nearest_points/point_linestring_nearest_points.cu - src/point_in_polygon/point_in_polygon.cu - src/points_in_range/points_in_range.cu - src/projection/sinusoidal_projection.cu - src/trajectory/derive_trajectories.cu - src/trajectory/trajectory_bounding_boxes.cu - src/trajectory/trajectory_distances_and_speeds.cu -) - -set_target_properties(cuspatial - 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 - POSITION_INDEPENDENT_CODE ON - INTERFACE_POSITION_INDEPENDENT_CODE ON -) - -target_compile_options(cuspatial - PRIVATE "$<$:${CUSPATIAL_CXX_FLAGS}>" - "$<$:${CUSPATIAL_CUDA_FLAGS}>" -) - -target_compile_definitions(cuspatial - PUBLIC "$<$:${CUSPATIAL_CXX_DEFINITIONS}>" - "$:${CUSPATIAL_CUDA_DEFINITIONS}>>" -) +add_library( + cuspatial + src/bounding_boxes/linestring_bounding_boxes.cu + src/bounding_boxes/polygon_bounding_boxes.cu + src/column/geometry_column_view.cpp + src/distance/hausdorff.cu + src/distance/haversine.cu + src/distance/linestring_distance.cu + src/distance/linestring_polygon_distance.cu + src/distance/point_distance.cu + src/distance/point_linestring_distance.cu + src/distance/point_polygon_distance.cu + src/distance/polygon_distance.cu + src/equality/pairwise_multipoint_equals_count.cu + src/indexing/point_quadtree.cu + src/intersection/linestring_intersection.cu + src/join/quadtree_point_in_polygon.cu + src/join/quadtree_point_to_nearest_linestring.cu + src/join/quadtree_bbox_filtering.cu + src/nearest_points/point_linestring_nearest_points.cu + src/point_in_polygon/point_in_polygon.cu + src/points_in_range/points_in_range.cu + src/projection/sinusoidal_projection.cu + src/trajectory/derive_trajectories.cu + src/trajectory/trajectory_bounding_boxes.cu + src/trajectory/trajectory_distances_and_speeds.cu) + +set_target_properties( + cuspatial + 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 + POSITION_INDEPENDENT_CODE ON + INTERFACE_POSITION_INDEPENDENT_CODE ON) + +target_compile_options(cuspatial PRIVATE "$<$:${CUSPATIAL_CXX_FLAGS}>" + "$<$:${CUSPATIAL_CUDA_FLAGS}>") + +target_compile_definitions( + cuspatial PUBLIC "$<$:${CUSPATIAL_CXX_DEFINITIONS}>" + "$:${CUSPATIAL_CUDA_DEFINITIONS}>>") # Disable Jitify log printing. See https://github.com/NVIDIA/jitify/issues/79 target_compile_definitions(cuspatial PRIVATE "JITIFY_PRINT_LOG=0") # Specify include paths for the current target and dependents -target_include_directories(cuspatial - PUBLIC "$" - PRIVATE "$" - INTERFACE "$") +target_include_directories( + cuspatial + PUBLIC "$" + PRIVATE "$" + INTERFACE "$") # Add Conda library, and include paths if specified if(TARGET conda_env) @@ -191,12 +201,12 @@ endif() # Per-thread default stream if(PER_THREAD_DEFAULT_STREAM) - target_compile_definitions(cuspatial PUBLIC CUDA_API_PER_THREAD_DEFAULT_STREAM) + target_compile_definitions(cuspatial PUBLIC CUDA_API_PER_THREAD_DEFAULT_STREAM) endif() # Disable NVTX if necessary if(NOT USE_NVTX) - target_compile_definitions(cuspatial PUBLIC NVTX_DISABLE) + target_compile_definitions(cuspatial PUBLIC NVTX_DISABLE) endif() # Define spdlog level @@ -212,26 +222,26 @@ add_library(cuspatial::cuspatial ALIAS cuspatial) # - add tests ------------------------------------------------------------------------------------- if(CUSPATIAL_BUILD_TESTS) - # include CTest module -- automatically calls enable_testing() - include(CTest) - add_subdirectory(tests) + # include CTest module -- automatically calls enable_testing() + include(CTest) + add_subdirectory(tests) endif() ################################################################################################### # - add benchmarks -------------------------------------------------------------------------------- if(CUSPATIAL_BUILD_BENCHMARKS) - # Find or install GoogleBench - include(${rapids-cmake-dir}/cpm/gbench.cmake) - rapids_cpm_gbench(BUILD_STATIC) - - # Find or install NVBench Temporarily force downloading of fmt because current versions of nvbench - # do not support the latest version of fmt, which is automatically pulled into our conda - # environments by mamba. - set(CPM_DOWNLOAD_fmt TRUE) - include(${rapids-cmake-dir}/cpm/nvbench.cmake) - rapids_cpm_nvbench() - add_subdirectory(benchmarks) + # Find or install GoogleBench + include(${rapids-cmake-dir}/cpm/gbench.cmake) + rapids_cpm_gbench(BUILD_STATIC) + + # Find or install NVBench Temporarily force downloading of fmt because current versions of nvbench + # do not support the latest version of fmt, which is automatically pulled into our conda + # environments by mamba. + set(CPM_DOWNLOAD_fmt TRUE) + include(${rapids-cmake-dir}/cpm/nvbench.cmake) + rapids_cpm_nvbench() + add_subdirectory(benchmarks) endif() ################################################################################################### @@ -242,12 +252,12 @@ include(CPack) set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME cuspatial) -install(TARGETS cuspatial - DESTINATION ${lib_dir} - EXPORT cuspatial-exports) +install( + TARGETS cuspatial + DESTINATION ${lib_dir} + EXPORT cuspatial-exports) -install(DIRECTORY ${CUSPATIAL_SOURCE_DIR}/include/cuspatial - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install(DIRECTORY ${CUSPATIAL_SOURCE_DIR}/include/cuspatial DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) set(doc_string [=[ @@ -262,29 +272,16 @@ If cuspatial is found, this module defines the following IMPORTED GLOBAL targets: cuspatial::cuspatial - The main cuspatial library. - ]=] -) - -rapids_export( - INSTALL cuspatial - EXPORT_SET cuspatial-exports - GLOBAL_TARGETS cuspatial - NAMESPACE cuspatial:: - DOCUMENTATION doc_string -) + ]=]) +rapids_export(INSTALL cuspatial EXPORT_SET cuspatial-exports GLOBAL_TARGETS cuspatial NAMESPACE + cuspatial:: DOCUMENTATION doc_string) ################################################################################################ # - build export ------------------------------------------------------------------------------- -rapids_export( - BUILD cuspatial - EXPORT_SET cuspatial-exports - GLOBAL_TARGETS cuspatial - NAMESPACE cuspatial:: - DOCUMENTATION doc_string -) - +rapids_export(BUILD cuspatial EXPORT_SET cuspatial-exports GLOBAL_TARGETS cuspatial NAMESPACE + cuspatial:: DOCUMENTATION doc_string) # ################################################################################################## # * build documentation ---------------------------------------------------------------------------- @@ -293,19 +290,19 @@ find_package(Doxygen) if(DOXYGEN_FOUND) -# doc targets for cuSpatial -add_custom_command( - OUTPUT CUSPATIAL_DOXYGEN - WORKING_DIRECTORY ${CUSPATIAL_SOURCE_DIR}/doxygen - COMMAND ${CMAKE_COMMAND} -E env "RAPIDS_VERSION=${RAPIDS_VERSION}" "RAPIDS_VERSION_MAJOR_MINOR=${RAPIDS_VERSION_MAJOR_MINOR}" ${DOXYGEN_EXECUTABLE} Doxyfile - VERBATIM - COMMENT "Custom command for building cuspatial doxygen docs." -) - -add_custom_target( - docs_cuspatial - DEPENDS CUSPATIAL_DOXYGEN - COMMENT "Custom command for building cuspatial doxygen docs." -) + # doc targets for cuSpatial + add_custom_command( + OUTPUT CUSPATIAL_DOXYGEN + WORKING_DIRECTORY ${CUSPATIAL_SOURCE_DIR}/doxygen + COMMAND + ${CMAKE_COMMAND} -E env "RAPIDS_VERSION=${RAPIDS_VERSION}" + "RAPIDS_VERSION_MAJOR_MINOR=${RAPIDS_VERSION_MAJOR_MINOR}" ${DOXYGEN_EXECUTABLE} Doxyfile + VERBATIM + COMMENT "Custom command for building cuspatial doxygen docs.") + + add_custom_target( + docs_cuspatial + DEPENDS CUSPATIAL_DOXYGEN + COMMENT "Custom command for building cuspatial doxygen docs.") endif() diff --git a/cpp/benchmarks/CMakeLists.txt b/cpp/benchmarks/CMakeLists.txt index 98506d9a4..62e3c2aed 100644 --- a/cpp/benchmarks/CMakeLists.txt +++ b/cpp/benchmarks/CMakeLists.txt @@ -1,5 +1,5 @@ #============================================================================= -# Copyright (c) 2019-2024, NVIDIA CORPORATION. +# Copyright (c) 2019-2025, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,58 +18,57 @@ # - compiler function ----------------------------------------------------------------------------- # Use an OBJECT library so we only compile common source files only once -add_library(cuspatial_benchmark_common OBJECT - synchronization/synchronization.cpp) +add_library(cuspatial_benchmark_common OBJECT synchronization/synchronization.cpp) target_compile_features(cuspatial_benchmark_common PUBLIC cxx_std_17 cuda_std_17) -target_compile_options(cuspatial_benchmark_common PUBLIC "$<$:${CUSPATIAL_CXX_FLAGS}>" - "$<$:${CUSPATIAL_CUDA_FLAGS}>") +target_compile_options( + cuspatial_benchmark_common PUBLIC "$<$:${CUSPATIAL_CXX_FLAGS}>" + "$<$:${CUSPATIAL_CUDA_FLAGS}>") + +set_target_properties( + cuspatial_benchmark_common + PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$" + INSTALL_RPATH "\$ORIGIN/../../../lib" + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED ON + CUDA_STANDARD 17 + CUDA_STANDARD_REQUIRED ON + POSITION_INDEPENDENT_CODE ON + INTERFACE_POSITION_INDEPENDENT_CODE ON) + +target_link_libraries( + cuspatial_benchmark_common + PUBLIC benchmark::benchmark cudf::cudftestutil ranger::ranger cuspatial GTest::gtest GTest::gmock + PRIVATE cudf::cudftestutil_impl) + +target_compile_options( + cuspatial_benchmark_common PUBLIC "$<$:${CUSPATIAL_CXX_FLAGS}>" + "$<$:${CUSPATIAL_CUDA_FLAGS}>") + +target_include_directories( + cuspatial_benchmark_common + PUBLIC "$" + "$" + "$") -set_target_properties(cuspatial_benchmark_common +function(ConfigureBench CMAKE_BENCH_NAME) + add_executable(${CMAKE_BENCH_NAME} ${ARGN}) + set_target_properties( + ${CMAKE_BENCH_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$" INSTALL_RPATH "\$ORIGIN/../../../lib" - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED ON - CUDA_STANDARD 17 - CUDA_STANDARD_REQUIRED ON - POSITION_INDEPENDENT_CODE ON - INTERFACE_POSITION_INDEPENDENT_CODE ON -) - -target_link_libraries(cuspatial_benchmark_common - PUBLIC benchmark::benchmark - cudf::cudftestutil - ranger::ranger - cuspatial GTest::gtest GTest::gmock - PRIVATE cudf::cudftestutil_impl) - -target_compile_options(cuspatial_benchmark_common - PUBLIC "$<$:${CUSPATIAL_CXX_FLAGS}>" - "$<$:${CUSPATIAL_CUDA_FLAGS}>") - -target_include_directories(cuspatial_benchmark_common - PUBLIC "$" - "$" - "$") - -function(ConfigureBench CMAKE_BENCH_NAME) - add_executable(${CMAKE_BENCH_NAME} ${ARGN}) - set_target_properties(${CMAKE_BENCH_NAME} - PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$" - INSTALL_RPATH "\$ORIGIN/../../../lib" - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED ON - CUDA_STANDARD 17 - CUDA_STANDARD_REQUIRED ON - ) - target_link_libraries(${CMAKE_BENCH_NAME} PRIVATE benchmark::benchmark_main cuspatial_benchmark_common) - install( - TARGETS ${CMAKE_BENCH_NAME} - COMPONENT benchmark - DESTINATION bin/benchmarks/libcuspatial - EXCLUDE_FROM_ALL - ) + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED ON + CUDA_STANDARD 17 + CUDA_STANDARD_REQUIRED ON) + target_link_libraries(${CMAKE_BENCH_NAME} PRIVATE benchmark::benchmark_main + cuspatial_benchmark_common) + install( + TARGETS ${CMAKE_BENCH_NAME} + COMPONENT benchmark + DESTINATION bin/benchmarks/libcuspatial + EXCLUDE_FROM_ALL) endfunction() # This function takes in a benchmark name and benchmark source for nvbench benchmarks and handles @@ -83,43 +82,32 @@ function(ConfigureNVBench CMAKE_BENCH_NAME) CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON CUDA_STANDARD 17 - CUDA_STANDARD_REQUIRED ON -) - target_link_libraries( - ${CMAKE_BENCH_NAME} PRIVATE cuspatial_benchmark_common nvbench::main - ) + CUDA_STANDARD_REQUIRED ON) + target_link_libraries(${CMAKE_BENCH_NAME} PRIVATE cuspatial_benchmark_common nvbench::main) install( TARGETS ${CMAKE_BENCH_NAME} COMPONENT benchmark DESTINATION bin/benchmarks/libcuspatial - EXCLUDE_FROM_ALL - ) + EXCLUDE_FROM_ALL) endfunction() ################################################################################################### ### benchmark sources ############################################################################# ################################################################################################### -ConfigureBench(HAUSDORFF_BENCH - distance/hausdorff_benchmark.cpp) +ConfigureBench(HAUSDORFF_BENCH distance/hausdorff_benchmark.cpp) -ConfigureNVBench(POINT_POLYGON_DISTANCES_BENCH - distance/pairwise_point_polygon_distance.cu) +ConfigureNVBench(POINT_POLYGON_DISTANCES_BENCH distance/pairwise_point_polygon_distance.cu) -ConfigureNVBench(LINESTRING_DISTANCES_BENCH - distance/pairwise_linestring_distance.cu) +ConfigureNVBench(LINESTRING_DISTANCES_BENCH distance/pairwise_linestring_distance.cu) ConfigureNVBench(LINESTRING_POLYGON_DISTANCES_BENCH - distance/pairwise_linestring_polygon_distance.cu) + distance/pairwise_linestring_polygon_distance.cu) -ConfigureNVBench(QUADTREE_ON_POINTS_BENCH - indexing/quadtree_on_points.cu) +ConfigureNVBench(QUADTREE_ON_POINTS_BENCH indexing/quadtree_on_points.cu) -ConfigureNVBench(POINT_IN_POLYGON_BENCH - point_in_polygon/point_in_polygon.cu) +ConfigureNVBench(POINT_IN_POLYGON_BENCH point_in_polygon/point_in_polygon.cu) -ConfigureNVBench(POINTS_IN_RANGE_BENCH - points_in_range/points_in_range.cu) +ConfigureNVBench(POINTS_IN_RANGE_BENCH points_in_range/points_in_range.cu) -ConfigureNVBench(FLOATING_POINT_EQUALITY_BENCH - utility/floating_point_equality.cu) +ConfigureNVBench(FLOATING_POINT_EQUALITY_BENCH utility/floating_point_equality.cu) diff --git a/cpp/cmake/Modules/ConfigureCUDA.cmake b/cpp/cmake/Modules/ConfigureCUDA.cmake index 6fc9e8372..ada820628 100644 --- a/cpp/cmake/Modules/ConfigureCUDA.cmake +++ b/cpp/cmake/Modules/ConfigureCUDA.cmake @@ -1,5 +1,5 @@ #============================================================================= -# Copyright (c) 2021-2024, NVIDIA CORPORATION. +# Copyright (c) 2021-2025, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,18 +15,19 @@ #============================================================================= if(CMAKE_COMPILER_IS_GNUCXX) - list(APPEND CUSPATIAL_CXX_FLAGS -Wall -Werror -Wno-unknown-pragmas -Wno-error=deprecated-declarations) - if(CUSPATIAL_BUILD_TESTS OR CUSPATIAL_BUILD_BENCHMARKS) - # Suppress parentheses warning which causes gmock to fail - list(APPEND CUSPATIAL_CUDA_FLAGS -Xcompiler=-Wno-parentheses) - endif() + list(APPEND CUSPATIAL_CXX_FLAGS -Wall -Werror -Wno-unknown-pragmas + -Wno-error=deprecated-declarations) + if(CUSPATIAL_BUILD_TESTS OR CUSPATIAL_BUILD_BENCHMARKS) + # Suppress parentheses warning which causes gmock to fail + list(APPEND CUSPATIAL_CUDA_FLAGS -Xcompiler=-Wno-parentheses) + endif() endif(CMAKE_COMPILER_IS_GNUCXX) list(APPEND CUSPATIAL_CUDA_FLAGS --expt-extended-lambda --expt-relaxed-constexpr) # set warnings as errors if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 11.2.0) - list(APPEND CUSPATIAL_CUDA_FLAGS -Werror=all-warnings) + list(APPEND CUSPATIAL_CUDA_FLAGS -Werror=all-warnings) endif() list(APPEND CUSPATIAL_CUDA_FLAGS -Xcompiler=-Wall,-Werror,-Wno-error=deprecated-declarations) @@ -34,17 +35,17 @@ list(APPEND CUSPATIAL_CUDA_FLAGS -Xcompiler=-Wall,-Werror,-Wno-error=deprecated- list(APPEND CUSPATIAL_CUDA_FLAGS -Xfatbin=-compress-all) if(DISABLE_DEPRECATION_WARNING) - list(APPEND CUSPATIAL_CXX_FLAGS -Wno-deprecated-declarations) - list(APPEND CUSPATIAL_CUDA_FLAGS -Xcompiler=-Wno-deprecated-declarations) + list(APPEND CUSPATIAL_CXX_FLAGS -Wno-deprecated-declarations) + list(APPEND CUSPATIAL_CUDA_FLAGS -Xcompiler=-Wno-deprecated-declarations) endif() # Option to enable line info in CUDA device compilation to allow introspection when profiling / memchecking if(CUDA_ENABLE_LINEINFO) - list(APPEND CUSPATIAL_CUDA_FLAGS -lineinfo) + list(APPEND CUSPATIAL_CUDA_FLAGS -lineinfo) endif() # Debug options if(CMAKE_BUILD_TYPE MATCHES Debug) - message(STATUS "CUSPATIAL: Building with debugging flags") - list(APPEND CUSPATIAL_CUDA_FLAGS -G -Xcompiler=-rdynamic) + message(STATUS "CUSPATIAL: Building with debugging flags") + list(APPEND CUSPATIAL_CUDA_FLAGS -G -Xcompiler=-rdynamic) endif() diff --git a/cpp/cmake/config.json b/cpp/cmake/config.json index fa3f769cc..647de6a5d 100644 --- a/cpp/cmake/config.json +++ b/cpp/cmake/config.json @@ -12,6 +12,14 @@ "FIND_PACKAGE_ARGUMENTS": "*" } }, + "rapids_cython_create_modules": { + "kwargs": { + "SOURCE_FILES": "?", + "LINKED_LIBRARIES": "?", + "MODULE_PREFIX": "?", + "ASSOCIATED_TARGETS": "?" + } + }, "ConfigureTest": { "flags": ["TEST_NAME", "TEST_SRC"] }, @@ -28,7 +36,7 @@ "max_pargs_hwrap": 999 }, "lint": { - "disabled_codes": ["C0301"], + "disabled_codes": ["C0111", "C0301"], "function_pattern": "[0-9A-z_]+", "macro_pattern": "[0-9A-z_]+", "global_var_pattern": "[A-z][0-9A-z_]+", @@ -38,5 +46,8 @@ "public_var_pattern": "[A-z][0-9A-z_]+", "argument_var_pattern": "[A-z][A-z0-9_]+", "keyword_pattern": "[A-z][0-9A-z_]+" + }, + "markup": { + "enable_markup": false } } diff --git a/cpp/cuproj/CMakeLists.txt b/cpp/cuproj/CMakeLists.txt index 061a627ca..e463a4568 100644 --- a/cpp/cuproj/CMakeLists.txt +++ b/cpp/cuproj/CMakeLists.txt @@ -1,5 +1,5 @@ #============================================================================= -# Copyright (c) 2023-2024, NVIDIA CORPORATION. +# Copyright (c) 2023-2025, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -25,7 +25,10 @@ include(rapids-find) rapids_cuda_init_architectures(CUPROJ) -project(CUPROJ VERSION "${RAPIDS_VERSION}" LANGUAGES C CXX CUDA) +project( + CUPROJ + VERSION "${RAPIDS_VERSION}" + LANGUAGES C CXX CUDA) # Needed because GoogleBenchmark changes the state of FindThreads.cmake, # causing subsequent runs to have different values for the `Threads::Threads` target. @@ -47,7 +50,8 @@ option(BUILD_BENCHMARKS "Configure CMake to build (google) benchmarks" OFF) option(PER_THREAD_DEFAULT_STREAM "Build with per-thread default stream" OFF) option(DISABLE_DEPRECATION_WARNING "Disable warnings generated from deprecated declarations." OFF) # Option to enable line info in CUDA device compilation to allow introspection when profiling / memchecking -option(CUDA_ENABLE_LINEINFO "Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler" OFF) +option(CUDA_ENABLE_LINEINFO + "Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler" OFF) # cudart can be statically linked or dynamically linked. The python ecosystem wants dynamic linking option(CUDA_STATIC_RUNTIME "Statically link the CUDA toolkit runtime and libraries" OFF) @@ -55,9 +59,16 @@ message(STATUS "CUPROJ: Build with NVTX support: ${USE_NVTX}") message(STATUS "CUPROJ: Configure CMake to build tests: ${BUILD_TESTS}") message(STATUS "CUPROJ: Configure CMake to build (google) benchmarks: ${BUILD_BENCHMARKS}") message(STATUS "CUPROJ: Build with per-thread default stream: ${PER_THREAD_DEFAULT_STREAM}") -message(STATUS "CUPROJ: Disable warnings generated from deprecated declarations: ${DISABLE_DEPRECATION_WARNING}") -message(STATUS "CUPROJ: Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler: ${CUDA_ENABLE_LINEINFO}") -message(STATUS "CUPROJ: Statically link the CUDA toolkit runtime and libraries: ${CUDA_STATIC_RUNTIME}") +message( + STATUS + "CUPROJ: Disable warnings generated from deprecated declarations: ${DISABLE_DEPRECATION_WARNING}" +) +message( + STATUS + "CUPROJ: Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler: ${CUDA_ENABLE_LINEINFO}" +) +message( + STATUS "CUPROJ: Statically link the CUDA toolkit runtime and libraries: ${CUDA_STATIC_RUNTIME}") # Set a default build type if none was specified rapids_cmake_build_type("Release") @@ -70,8 +81,11 @@ set(CUPROJ_CXX_DEFINITIONS "") set(CUPROJ_CUDA_DEFINITIONS "") # Set RMM logging level -set(RMM_LOGGING_LEVEL "INFO" CACHE STRING "Choose the logging level.") -set_property(CACHE RMM_LOGGING_LEVEL PROPERTY STRINGS "TRACE" "DEBUG" "INFO" "WARN" "ERROR" "CRITICAL" "OFF") +set(RMM_LOGGING_LEVEL + "INFO" + CACHE STRING "Choose the logging level.") +set_property(CACHE RMM_LOGGING_LEVEL PROPERTY STRINGS "TRACE" "DEBUG" "INFO" "WARN" "ERROR" + "CRITICAL" "OFF") message(STATUS "CUPROJ: RMM_LOGGING_LEVEL = '${RMM_LOGGING_LEVEL}'.") ################################################################################################### @@ -94,7 +108,7 @@ rapids_cpm_init() include(cmake/thirdparty/get_rmm.cmake) # find or install GoogleTest and Proj -if (CUPROJ_BUILD_TESTS) +if(CUPROJ_BUILD_TESTS) include(${rapids-cmake-dir}/cpm/gtest.cmake) rapids_cpm_gtest(BUILD_STATIC) include(cmake/thirdparty/get_proj.cmake) @@ -108,41 +122,37 @@ add_library(cuproj::cuproj ALIAS cuproj) target_link_libraries(cuproj INTERFACE rmm::rmm) -set_target_properties(cuproj - 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 - POSITION_INDEPENDENT_CODE ON - INTERFACE_POSITION_INDEPENDENT_CODE ON -) - -target_compile_options(cuproj - INTERFACE "$<$:${CUPROJ_CXX_FLAGS}>" - "$<$:${CUPROJ_CUDA_FLAGS}>" -) - -target_compile_definitions(cuproj - INTERFACE "$<$:${CUPROJ_CXX_DEFINITIONS}>" - "$<$:${CUPROJ_CUDA_DEFINITIONS}>" -) +set_target_properties( + cuproj + 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 + POSITION_INDEPENDENT_CODE ON + INTERFACE_POSITION_INDEPENDENT_CODE ON) + +target_compile_options(cuproj INTERFACE "$<$:${CUPROJ_CXX_FLAGS}>" + "$<$:${CUPROJ_CUDA_FLAGS}>") + +target_compile_definitions( + cuproj INTERFACE "$<$:${CUPROJ_CXX_DEFINITIONS}>" + "$<$:${CUPROJ_CUDA_DEFINITIONS}>") # Specify include paths for the current target and dependents -target_include_directories(cuproj - INTERFACE "$" - "$") +target_include_directories(cuproj INTERFACE "$" + "$") # Per-thread default stream if(PER_THREAD_DEFAULT_STREAM) - target_compile_definitions(cuproj INTERFACE CUDA_API_PER_THREAD_DEFAULT_STREAM) + target_compile_definitions(cuproj INTERFACE CUDA_API_PER_THREAD_DEFAULT_STREAM) endif() # Disable NVTX if necessary if(NOT USE_NVTX) - target_compile_definitions(cuproj INTERFACE NVTX_DISABLE) + target_compile_definitions(cuproj INTERFACE NVTX_DISABLE) endif() # Define spdlog level @@ -152,26 +162,26 @@ target_compile_definitions(cuproj INTERFACE "SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_${ # - add tests ------------------------------------------------------------------------------------- if(CUPROJ_BUILD_TESTS) - # include CTest module -- automatically calls enable_testing() - include(CTest) - add_subdirectory(tests) + # include CTest module -- automatically calls enable_testing() + include(CTest) + add_subdirectory(tests) endif() ################################################################################################### # - add benchmarks -------------------------------------------------------------------------------- if(CUPROJ_BUILD_BENCHMARKS) - # Find or install GoogleBench - include(${rapids-cmake-dir}/cpm/gbench.cmake) - rapids_cpm_gbench(BUILD_STATIC) - - # Find or install NVBench Temporarily force downloading of fmt because current versions of nvbench - # do not support the latest version of fmt, which is automatically pulled into our conda - # environments by mamba. - set(CPM_DOWNLOAD_fmt TRUE) - include(${rapids-cmake-dir}/cpm/nvbench.cmake) - rapids_cpm_nvbench() - add_subdirectory(benchmarks) + # Find or install GoogleBench + include(${rapids-cmake-dir}/cpm/gbench.cmake) + rapids_cpm_gbench(BUILD_STATIC) + + # Find or install NVBench Temporarily force downloading of fmt because current versions of nvbench + # do not support the latest version of fmt, which is automatically pulled into our conda + # environments by mamba. + set(CPM_DOWNLOAD_fmt TRUE) + include(${rapids-cmake-dir}/cpm/nvbench.cmake) + rapids_cpm_nvbench() + add_subdirectory(benchmarks) endif() ################################################################################################### @@ -182,12 +192,12 @@ include(CPack) set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME cuproj) -install(TARGETS cuproj - DESTINATION ${lib_dir} - EXPORT cuproj-exports) +install( + TARGETS cuproj + DESTINATION ${lib_dir} + EXPORT cuproj-exports) -install(DIRECTORY ${CUPROJ_SOURCE_DIR}/include/cuproj - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install(DIRECTORY ${CUPROJ_SOURCE_DIR}/include/cuproj DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) set(doc_string [=[ @@ -203,29 +213,16 @@ If cuproj is found, this module defines the following IMPORTED GLOBAL targets: cuproj::cuproj - The main cuproj library. - ]=] -) - -rapids_export( - INSTALL cuproj - EXPORT_SET cuproj-exports - GLOBAL_TARGETS cuproj - NAMESPACE cuproj:: - DOCUMENTATION doc_string -) + ]=]) +rapids_export(INSTALL cuproj EXPORT_SET cuproj-exports GLOBAL_TARGETS cuproj NAMESPACE cuproj:: + DOCUMENTATION doc_string) ################################################################################################ # - build export ------------------------------------------------------------------------------- -rapids_export( - BUILD cuproj - EXPORT_SET cuproj-exports - GLOBAL_TARGETS cuproj - NAMESPACE cuproj:: - DOCUMENTATION doc_string -) - +rapids_export(BUILD cuproj EXPORT_SET cuproj-exports GLOBAL_TARGETS cuproj NAMESPACE cuproj:: + DOCUMENTATION doc_string) # ################################################################################################## # * build documentation ---------------------------------------------------------------------------- @@ -234,19 +231,19 @@ find_package(Doxygen) if(DOXYGEN_FOUND) -# doc targets for cuproj -add_custom_command( - OUTPUT CUPROJ_DOXYGEN - WORKING_DIRECTORY ${CUPROJ_SOURCE_DIR}/doxygen - COMMAND ${CMAKE_COMMAND} -E env "RAPIDS_VERSION=${RAPIDS_VERSION}" "RAPIDS_VERSION_MAJOR_MINOR=${RAPIDS_VERSION_MAJOR_MINOR}" ${DOXYGEN_EXECUTABLE} Doxyfile - VERBATIM - COMMENT "Custom command for building cuproj doxygen docs." -) - -add_custom_target( - docs_cuproj - DEPENDS CUPROJ_DOXYGEN - COMMENT "Custom command for building cuproj doxygen docs." -) + # doc targets for cuproj + add_custom_command( + OUTPUT CUPROJ_DOXYGEN + WORKING_DIRECTORY ${CUPROJ_SOURCE_DIR}/doxygen + COMMAND + ${CMAKE_COMMAND} -E env "RAPIDS_VERSION=${RAPIDS_VERSION}" + "RAPIDS_VERSION_MAJOR_MINOR=${RAPIDS_VERSION_MAJOR_MINOR}" ${DOXYGEN_EXECUTABLE} Doxyfile + VERBATIM + COMMENT "Custom command for building cuproj doxygen docs.") + + add_custom_target( + docs_cuproj + DEPENDS CUPROJ_DOXYGEN + COMMENT "Custom command for building cuproj doxygen docs.") endif() diff --git a/cpp/cuproj/benchmarks/CMakeLists.txt b/cpp/cuproj/benchmarks/CMakeLists.txt index b2450b1c4..5848b2b49 100644 --- a/cpp/cuproj/benchmarks/CMakeLists.txt +++ b/cpp/cuproj/benchmarks/CMakeLists.txt @@ -1,5 +1,5 @@ #============================================================================= -# Copyright (c) 2023-2024, NVIDIA CORPORATION. +# Copyright (c) 2023-2025, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,20 +18,21 @@ # - compiler function ----------------------------------------------------------------------------- # Use an OBJECT library so we only compile common source files only once -add_library(cuproj_benchmark_common OBJECT - synchronization/synchronization.cpp) +add_library(cuproj_benchmark_common OBJECT synchronization/synchronization.cpp) target_compile_features(cuproj_benchmark_common PUBLIC cxx_std_17 cuda_std_17) -target_link_libraries(cuproj_benchmark_common +target_link_libraries( + cuproj_benchmark_common PUBLIC benchmark::benchmark rmm::rmm cuproj PRIVATE rmm::rmm_logger_impl) -target_compile_options(cuproj_benchmark_common - PUBLIC "$<$:${CUPROJ_CXX_FLAGS}>" - "$<$:${CUPROJ_CUDA_FLAGS}>") +target_compile_options( + cuproj_benchmark_common PUBLIC "$<$:${CUPROJ_CXX_FLAGS}>" + "$<$:${CUPROJ_CUDA_FLAGS}>") -target_include_directories(cuproj_benchmark_common +target_include_directories( + cuproj_benchmark_common PUBLIC "$" "$" "$" @@ -39,17 +40,17 @@ target_include_directories(cuproj_benchmark_common function(ConfigureBench CMAKE_BENCH_NAME) add_executable(${CMAKE_BENCH_NAME} ${ARGN}) - set_target_properties(${CMAKE_BENCH_NAME} + set_target_properties( + ${CMAKE_BENCH_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$" - INSTALL_RPATH "\$ORIGIN/../../../lib" - ) - target_link_libraries(${CMAKE_BENCH_NAME} PRIVATE benchmark::benchmark_main cuproj_benchmark_common PROJ::proj) + INSTALL_RPATH "\$ORIGIN/../../../lib") + target_link_libraries(${CMAKE_BENCH_NAME} PRIVATE benchmark::benchmark_main + cuproj_benchmark_common PROJ::proj) install( TARGETS ${CMAKE_BENCH_NAME} COMPONENT benchmark DESTINATION bin/benchmarks/libcuproj - EXCLUDE_FROM_ALL - ) + EXCLUDE_FROM_ALL) endfunction() # This function takes in a benchmark name and benchmark source for nvbench benchmarks and handles @@ -59,29 +60,26 @@ function(ConfigureNVBench CMAKE_BENCH_NAME) set_target_properties( ${CMAKE_BENCH_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$" - INSTALL_RPATH "\$ORIGIN/../../../lib" - ) + INSTALL_RPATH "\$ORIGIN/../../../lib") target_compile_features(${CMAKE_BENCH_NAME} PUBLIC cxx_std_17 cuda_std_17) - target_compile_options(${CMAKE_BENCH_NAME} - PUBLIC "$<$:${CUPROJ_CXX_FLAGS}>" - "$<$:${CUPROJ_CUDA_FLAGS}>") + target_compile_options( + ${CMAKE_BENCH_NAME} PUBLIC "$<$:${CUPROJ_CXX_FLAGS}>" + "$<$:${CUPROJ_CUDA_FLAGS}>") - target_include_directories(${CMAKE_BENCH_NAME} + target_include_directories( + ${CMAKE_BENCH_NAME} PUBLIC "$" "$" "$" "$") - target_link_libraries( - ${CMAKE_BENCH_NAME} PRIVATE cuproj nvbench::main - ) + target_link_libraries(${CMAKE_BENCH_NAME} PRIVATE cuproj nvbench::main) install( TARGETS ${CMAKE_BENCH_NAME} COMPONENT benchmark DESTINATION bin/benchmarks/libcuproj - EXCLUDE_FROM_ALL - ) + EXCLUDE_FROM_ALL) endfunction() ################################################################################################### diff --git a/cpp/cuproj/cmake/modules/ConfigureCUDA.cmake b/cpp/cuproj/cmake/modules/ConfigureCUDA.cmake index e41fd419a..c98117a74 100644 --- a/cpp/cuproj/cmake/modules/ConfigureCUDA.cmake +++ b/cpp/cuproj/cmake/modules/ConfigureCUDA.cmake @@ -1,5 +1,5 @@ #============================================================================= -# Copyright (c) 2023-2024, NVIDIA CORPORATION. +# Copyright (c) 2023-2025, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,18 +15,19 @@ #============================================================================= if(CMAKE_COMPILER_IS_GNUCXX) - list(APPEND CUPROJ_CXX_FLAGS -Wall -Werror -Wno-unknown-pragmas -Wno-error=deprecated-declarations) - if(CUPROJ_BUILD_TESTS OR CUPROJ_BUILD_BENCHMARKS) - # Suppress parentheses warning which causes gmock to fail - list(APPEND CUPROJ_CUDA_FLAGS -Xcompiler=-Wno-parentheses) - endif() + list(APPEND CUPROJ_CXX_FLAGS -Wall -Werror -Wno-unknown-pragmas + -Wno-error=deprecated-declarations) + if(CUPROJ_BUILD_TESTS OR CUPROJ_BUILD_BENCHMARKS) + # Suppress parentheses warning which causes gmock to fail + list(APPEND CUPROJ_CUDA_FLAGS -Xcompiler=-Wno-parentheses) + endif() endif(CMAKE_COMPILER_IS_GNUCXX) list(APPEND CUPROJ_CUDA_FLAGS --expt-extended-lambda) # set warnings as errors if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 11.2.0) - list(APPEND CUPROJ_CUDA_FLAGS -Werror=all-warnings) + list(APPEND CUPROJ_CUDA_FLAGS -Werror=all-warnings) endif() list(APPEND CUPROJ_CUDA_FLAGS -Xcompiler=-Wall,-Werror,-Wno-error=deprecated-declarations) @@ -34,17 +35,17 @@ list(APPEND CUPROJ_CUDA_FLAGS -Xcompiler=-Wall,-Werror,-Wno-error=deprecated-dec list(APPEND CUPROJ_CUDA_FLAGS -Xfatbin=-compress-all) if(DISABLE_DEPRECATION_WARNING) - list(APPEND CUPROJ_CXX_FLAGS -Wno-deprecated-declarations) - list(APPEND CUPROJ_CUDA_FLAGS -Xcompiler=-Wno-deprecated-declarations) + list(APPEND CUPROJ_CXX_FLAGS -Wno-deprecated-declarations) + list(APPEND CUPROJ_CUDA_FLAGS -Xcompiler=-Wno-deprecated-declarations) endif() # Option to enable line info in CUDA device compilation to allow introspection when profiling / memchecking if(CUDA_ENABLE_LINEINFO) - list(APPEND CUPROJ_CUDA_FLAGS -lineinfo) + list(APPEND CUPROJ_CUDA_FLAGS -lineinfo) endif() # Debug options if(CMAKE_BUILD_TYPE MATCHES Debug) - message(STATUS "CUSPATIAL: Building with debugging flags") - list(APPEND CUPROJ_CUDA_FLAGS -G -Xcompiler=-rdynamic) + message(STATUS "CUSPATIAL: Building with debugging flags") + list(APPEND CUPROJ_CUDA_FLAGS -G -Xcompiler=-rdynamic) endif() diff --git a/cpp/cuproj/tests/CMakeLists.txt b/cpp/cuproj/tests/CMakeLists.txt index 1329416cc..63e7a7a07 100644 --- a/cpp/cuproj/tests/CMakeLists.txt +++ b/cpp/cuproj/tests/CMakeLists.txt @@ -1,5 +1,5 @@ -#============================================================================= -# Copyright (c) 2023-2024, NVIDIA CORPORATION. +#============================================================================= +# Copyright (c) 2023-2025, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,31 +18,29 @@ # - compiler function ----------------------------------------------------------------------------- function(ConfigureTest CMAKE_TEST_NAME) - add_executable(${CMAKE_TEST_NAME} ${ARGN}) - target_compile_options(${CMAKE_TEST_NAME} - PRIVATE "$<$:${CUPROJ_CXX_FLAGS}>" - "$<$:${CUPROJ_CUDA_FLAGS}>") - target_include_directories(${CMAKE_TEST_NAME} - PRIVATE "$" - "$" - ../../../cpp/include) - set_target_properties( - ${CMAKE_TEST_NAME} - PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$" - INSTALL_RPATH "\$ORIGIN/../../../lib" - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED ON - CUDA_STANDARD 17 - CUDA_STANDARD_REQUIRED ON - ) - target_link_libraries(${CMAKE_TEST_NAME} GTest::gtest_main GTest::gmock_main PROJ::proj rmm::rmm cuproj) - add_test(NAME ${CMAKE_TEST_NAME} COMMAND ${CMAKE_TEST_NAME}) - install( - TARGETS ${CMAKE_TEST_NAME} - COMPONENT testing - DESTINATION bin/gtests/libcuspatial # add to libcuspatial CI testing - EXCLUDE_FROM_ALL - ) + add_executable(${CMAKE_TEST_NAME} ${ARGN}) + target_compile_options( + ${CMAKE_TEST_NAME} PRIVATE "$<$:${CUPROJ_CXX_FLAGS}>" + "$<$:${CUPROJ_CUDA_FLAGS}>") + target_include_directories( + ${CMAKE_TEST_NAME} PRIVATE "$" + "$" ../../../cpp/include) + set_target_properties( + ${CMAKE_TEST_NAME} + PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$" + INSTALL_RPATH "\$ORIGIN/../../../lib" + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED ON + CUDA_STANDARD 17 + CUDA_STANDARD_REQUIRED ON) + target_link_libraries(${CMAKE_TEST_NAME} GTest::gtest_main GTest::gmock_main PROJ::proj rmm::rmm + cuproj) + add_test(NAME ${CMAKE_TEST_NAME} COMMAND ${CMAKE_TEST_NAME}) + install( + TARGETS ${CMAKE_TEST_NAME} + COMPONENT testing + DESTINATION bin/gtests/libcuspatial # add to libcuspatial CI testing + EXCLUDE_FROM_ALL) endfunction(ConfigureTest) ################################################################################################### @@ -50,5 +48,4 @@ endfunction(ConfigureTest) ################################################################################################### # index -ConfigureTest(WGS_TO_UTM_TEST - wgs_to_utm_test.cu) +ConfigureTest(WGS_TO_UTM_TEST wgs_to_utm_test.cu) diff --git a/cpp/scripts/run-cmake-format.sh b/cpp/scripts/run-cmake-format.sh new file mode 100755 index 000000000..676718c8a --- /dev/null +++ b/cpp/scripts/run-cmake-format.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +# Copyright (c) 2022-2025, NVIDIA CORPORATION. + +# copied from: https://github.com/rapidsai/rapids-cmake/blob/branch-25.02/ci/checks/run-cmake-format.sh +# +# This script is a wrapper for cmakelang that may be used with pre-commit. The +# wrapping is necessary because RAPIDS libraries split configuration for +# cmakelang linters between a local config file and a second config file that's +# shared across all of RAPIDS via rapids-cmake. We need a way to invoke CMake linting commands +# without causing pre-commit failures (which could block local commits or CI), +# while also being sufficiently flexible to allow users to maintain the config +# file independently of a build directory. +# +# This script provides the minimal functionality to enable those use cases. It +# searches in a number of predefined locations for the rapids-cmake config file +# and exits gracefully if the file is not found. If a user wishes to specify a +# config file at a nonstandard location, they may do so by setting the +# environment variable RAPIDS_CMAKE_FORMAT_FILE. +# +# This script can be invoked directly anywhere within the project repository. +# Alternatively, it may be invoked as a pre-commit hook via +# `pre-commit run (cmake-format)|(cmake-lint)`. +# +# Usage: +# bash run-cmake-format.sh {cmake-format,cmake-lint} infile [infile ...] + +status=0 +if [ -z ${CUSPATIAL_ROOT:+PLACEHOLDER} ]; then + CUSPATIAL_BUILD_DIR=$(git rev-parse --show-toplevel 2>&1)/cpp/build + status=$? +else + CUSPATIAL_BUILD_DIR=${CUSPATIAL_ROOT} +fi + +if ! [ ${status} -eq 0 ]; then + if [[ ${CUSPATIAL_BUILD_DIR} == *"not a git repository"* ]]; then + echo "This script must be run inside the cuspatial repository, or the CUSPATIAL_ROOT environment variable must be set." + else + echo "Script failed with unknown error attempting to determine project root:" + echo ${CUSPATIAL_BUILD_DIR} + fi + exit 1 +fi + +DEFAULT_FORMAT_FILE_LOCATIONS=( + "${CUSPATIAL_BUILD_DIR:-${HOME}}/_deps/rapids-cmake-src/cmake-format-rapids-cmake.json" +) + +if [ -z ${RAPIDS_CMAKE_FORMAT_FILE:+PLACEHOLDER} ]; then + for file_path in ${DEFAULT_FORMAT_FILE_LOCATIONS[@]}; do + if [ -f ${file_path} ]; then + RAPIDS_CMAKE_FORMAT_FILE=${file_path} + break + fi + done +fi + +if [ -z ${RAPIDS_CMAKE_FORMAT_FILE:+PLACEHOLDER} ]; then + echo "The rapids-cmake cmake-format configuration file was not found at any of the default search locations: " + echo "" + ( IFS=$'\n'; echo "${DEFAULT_FORMAT_FILE_LOCATIONS[*]}" ) + echo "" + echo "Try setting the environment variable RAPIDS_CMAKE_FORMAT_FILE to the path to the config file." + exit 0 +else + echo "Using format file ${RAPIDS_CMAKE_FORMAT_FILE}" +fi + +if [[ $1 == "cmake-format" ]]; then + cmake-format -i --config-files cpp/cmake/config.json ${RAPIDS_CMAKE_FORMAT_FILE} -- ${@:2} +elif [[ $1 == "cmake-lint" ]]; then + # Since the pre-commit hook is verbose, we have to be careful to only + # present cmake-lint's output (which is quite verbose) if we actually + # observe a failure. + OUTPUT=$(cmake-lint --config-files cpp/cmake/config.json ${RAPIDS_CMAKE_FORMAT_FILE} -- ${@:2}) + status=$? + + if ! [ ${status} -eq 0 ]; then + echo "${OUTPUT}" + fi + exit ${status} +fi diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index 7bca36a41..7bdaaf685 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -1,5 +1,5 @@ -#============================================================================= -# Copyright (c) 2019-2024, NVIDIA CORPORATION. +#============================================================================= +# Copyright (c) 2019-2025, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,57 +17,58 @@ ################################################################################################### # - compiler function ----------------------------------------------------------------------------- -# cudftestutil_impl is an interface source library, this empty object -# library is used to speed-up compilation and linking against it, +# cudftestutil_impl is an interface source library, this empty object +# library is used to speed-up compilation and linking against it, # otherwise we pay the non-trivial compilation cost repeatedly for each # test executable add_library(cuspatial_test_common OBJECT test_common.cpp) target_compile_features(cuspatial_test_common PUBLIC cxx_std_17 cuda_std_17) -set_target_properties(cuspatial_test_common - PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$" - INSTALL_RPATH "\$ORIGIN/../../../lib" - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED ON - CUDA_STANDARD 17 - CUDA_STANDARD_REQUIRED ON - POSITION_INDEPENDENT_CODE ON - INTERFACE_POSITION_INDEPENDENT_CODE ON -) - -target_link_libraries(cuspatial_test_common - PUBLIC cudf::cudftestutil GTest::gtest GTest::gmock - PRIVATE cudf::cudftestutil_impl) - -target_compile_options(cuspatial_test_common PUBLIC "$<$:${CUSPATIAL_CXX_FLAGS}>" -"$<$:${CUSPATIAL_CUDA_FLAGS}>") +set_target_properties( + cuspatial_test_common + PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$" + INSTALL_RPATH "\$ORIGIN/../../../lib" + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED ON + CUDA_STANDARD 17 + CUDA_STANDARD_REQUIRED ON + POSITION_INDEPENDENT_CODE ON + INTERFACE_POSITION_INDEPENDENT_CODE ON) + +target_link_libraries( + cuspatial_test_common + PUBLIC cudf::cudftestutil GTest::gtest GTest::gmock + PRIVATE cudf::cudftestutil_impl) + +target_compile_options( + cuspatial_test_common PUBLIC "$<$:${CUSPATIAL_CXX_FLAGS}>" + "$<$:${CUSPATIAL_CUDA_FLAGS}>") function(ConfigureTest CMAKE_TEST_NAME) - add_executable(${CMAKE_TEST_NAME} ${ARGN}) - target_compile_options(${CMAKE_TEST_NAME} - PRIVATE "$<$:${CUSPATIAL_CXX_FLAGS}>" - "$<$:${CUSPATIAL_CUDA_FLAGS}>") - target_include_directories(${CMAKE_TEST_NAME} - PRIVATE "$" - "$") - set_target_properties( - ${CMAKE_TEST_NAME} - PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$" - INSTALL_RPATH "\$ORIGIN/../../../lib" - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED ON - CUDA_STANDARD 17 - CUDA_STANDARD_REQUIRED ON - ) - target_link_libraries(${CMAKE_TEST_NAME} GTest::gtest_main GTest::gmock_main ranger::ranger cudf::cudftestutil cuspatial cuspatial_test_common) - add_test(NAME ${CMAKE_TEST_NAME} COMMAND ${CMAKE_TEST_NAME}) - install( - TARGETS ${CMAKE_TEST_NAME} - COMPONENT testing - DESTINATION bin/gtests/libcuspatial - EXCLUDE_FROM_ALL - ) + add_executable(${CMAKE_TEST_NAME} ${ARGN}) + target_compile_options( + ${CMAKE_TEST_NAME} PRIVATE "$<$:${CUSPATIAL_CXX_FLAGS}>" + "$<$:${CUSPATIAL_CUDA_FLAGS}>") + target_include_directories( + ${CMAKE_TEST_NAME} PRIVATE "$" + "$") + set_target_properties( + ${CMAKE_TEST_NAME} + PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$" + INSTALL_RPATH "\$ORIGIN/../../../lib" + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED ON + CUDA_STANDARD 17 + CUDA_STANDARD_REQUIRED ON) + target_link_libraries(${CMAKE_TEST_NAME} GTest::gtest_main GTest::gmock_main ranger::ranger + cudf::cudftestutil cuspatial cuspatial_test_common) + add_test(NAME ${CMAKE_TEST_NAME} COMMAND ${CMAKE_TEST_NAME}) + install( + TARGETS ${CMAKE_TEST_NAME} + COMPONENT testing + DESTINATION bin/gtests/libcuspatial + EXCLUDE_FROM_ALL) endfunction(ConfigureTest) ################################################################################################### @@ -75,201 +76,154 @@ endfunction(ConfigureTest) ################################################################################################### # index -ConfigureTest(POINT_QUADTREE_TEST - index/point_quadtree_test.cpp) +ConfigureTest(POINT_QUADTREE_TEST index/point_quadtree_test.cpp) # join -ConfigureTest(JOIN_QUADTREE_AND_BOUNDING_BOXES_TEST - join/join_quadtree_and_bounding_boxes_test.cpp) +ConfigureTest(JOIN_QUADTREE_AND_BOUNDING_BOXES_TEST join/join_quadtree_and_bounding_boxes_test.cpp) ConfigureTest(JOIN_POINT_TO_NEAREST_LINESTRING_TEST - join/quadtree_point_to_nearest_linestring_test.cpp) + join/quadtree_point_to_nearest_linestring_test.cpp) -ConfigureTest(JOIN_POINT_IN_POLYGON_TEST - join/quadtree_point_in_polygon_test.cpp) +ConfigureTest(JOIN_POINT_IN_POLYGON_TEST join/quadtree_point_in_polygon_test.cpp) # projection -ConfigureTest(SINUSOIDAL_PROJECTION_TEST - projection/sinusoidal_projection_test.cpp) +ConfigureTest(SINUSOIDAL_PROJECTION_TEST projection/sinusoidal_projection_test.cpp) # bounding boxes -ConfigureTest(LINESTRING_BOUNDING_BOXES_TEST - bounding_boxes/linestring_bounding_boxes_test.cpp) +ConfigureTest(LINESTRING_BOUNDING_BOXES_TEST bounding_boxes/linestring_bounding_boxes_test.cpp) -ConfigureTest(POLYGON_BOUNDING_BOXES_TEST - bounding_boxes/polygon_bounding_boxes_test.cpp) +ConfigureTest(POLYGON_BOUNDING_BOXES_TEST bounding_boxes/polygon_bounding_boxes_test.cpp) # distance -ConfigureTest(HAVERSINE_TEST - distance/haversine_test.cpp) +ConfigureTest(HAVERSINE_TEST distance/haversine_test.cpp) -ConfigureTest(HAUSDORFF_TEST - distance/hausdorff_test.cpp) +ConfigureTest(HAUSDORFF_TEST distance/hausdorff_test.cpp) -ConfigureTest(POINT_DISTANCE_TEST - distance/point_distance_test.cpp) +ConfigureTest(POINT_DISTANCE_TEST distance/point_distance_test.cpp) -ConfigureTest(POINT_LINESTRING_DISTANCE_TEST - distance/point_linestring_distance_test.cpp) +ConfigureTest(POINT_LINESTRING_DISTANCE_TEST distance/point_linestring_distance_test.cpp) -ConfigureTest(LINESTRING_DISTANCE_TEST - distance/linestring_distance_test.cpp) +ConfigureTest(LINESTRING_DISTANCE_TEST distance/linestring_distance_test.cpp) -ConfigureTest(POINT_POLYGON_DISTANCE_TEST - distance/point_polygon_distance_test.cpp) +ConfigureTest(POINT_POLYGON_DISTANCE_TEST distance/point_polygon_distance_test.cpp) -ConfigureTest(LINESTRING_POLYGON_DISTANCE_TEST - distance/linestring_polygon_distance_test.cpp) +ConfigureTest(LINESTRING_POLYGON_DISTANCE_TEST distance/linestring_polygon_distance_test.cpp) -ConfigureTest(POLYGON_DISTANCE_TEST - distance/polygon_distance_test.cpp) +ConfigureTest(POLYGON_DISTANCE_TEST distance/polygon_distance_test.cpp) # equality ConfigureTest(PAIRWISE_MULTIPOINT_EQUALS_COUNT_TEST - equality/pairwise_multipoint_equals_count_test.cpp) + equality/pairwise_multipoint_equals_count_test.cpp) # intersection -ConfigureTest(LINESTRING_INTERSECTION_TEST - intersection/linestring_intersection_test.cpp) +ConfigureTest(LINESTRING_INTERSECTION_TEST intersection/linestring_intersection_test.cpp) # nearest points ConfigureTest(POINT_LINESTRING_NEAREST_POINT_TEST - nearest_points/point_linestring_nearest_points_test.cpp) + nearest_points/point_linestring_nearest_points_test.cpp) # point in polygon -ConfigureTest(POINT_IN_POLYGON_TEST - point_in_polygon/point_in_polygon_test.cpp) +ConfigureTest(POINT_IN_POLYGON_TEST point_in_polygon/point_in_polygon_test.cpp) -ConfigureTest(PAIRWISE_POINT_IN_POLYGON_TEST - point_in_polygon/pairwise_point_in_polygon_test.cpp) +ConfigureTest(PAIRWISE_POINT_IN_POLYGON_TEST point_in_polygon/pairwise_point_in_polygon_test.cpp) # points in range -ConfigureTest(POINTS_IN_RANGE_TEST - points_in_range/points_in_range_test.cpp) +ConfigureTest(POINTS_IN_RANGE_TEST points_in_range/points_in_range_test.cpp) # trajectory ConfigureTest(TRAJECTORY_DISTANCES_AND_SPEEDS_TEST - trajectory/test_trajectory_distances_and_speeds.cu) + trajectory/test_trajectory_distances_and_speeds.cu) -ConfigureTest(DERIVE_TRAJECTORIES_TEST - trajectory/test_derive_trajectories.cpp) +ConfigureTest(DERIVE_TRAJECTORIES_TEST trajectory/test_derive_trajectories.cpp) -ConfigureTest(TRAJECTORY_BOUNDING_BOXES_TEST - trajectory/test_trajectory_bounding_boxes.cu) +ConfigureTest(TRAJECTORY_BOUNDING_BOXES_TEST trajectory/test_trajectory_bounding_boxes.cu) # utility -ConfigureTest(UTILITY_TEST - utility_test/test_float_equivalent.cu - utility_test/test_multipoint_factory.cu - utility_test/test_geometry_generators.cu -) +ConfigureTest(UTILITY_TEST utility_test/test_float_equivalent.cu + utility_test/test_multipoint_factory.cu utility_test/test_geometry_generators.cu) # find / intersection util -ConfigureTest(FIND_TEST_EXP - find/find_and_combine_segments_test.cu - find/find_points_on_segments_test.cu - find/find_duplicate_points_test.cu) +ConfigureTest(FIND_TEST_EXP find/find_and_combine_segments_test.cu + find/find_points_on_segments_test.cu find/find_duplicate_points_test.cu) # index -ConfigureTest(POINT_QUADTREE_TEST_EXP - index/point_quadtree_test.cu) +ConfigureTest(POINT_QUADTREE_TEST_EXP index/point_quadtree_test.cu) # join ConfigureTest(JOIN_QUADTREE_AND_BOUNDING_BOXES_TEST_EXP - join/join_quadtree_and_bounding_boxes_test.cu) + join/join_quadtree_and_bounding_boxes_test.cu) -ConfigureTest(JOIN_POINT_IN_POLYGON_SMALL_TEST_EXP - join/quadtree_point_in_polygon_test_small.cu) +ConfigureTest(JOIN_POINT_IN_POLYGON_SMALL_TEST_EXP join/quadtree_point_in_polygon_test_small.cu) -ConfigureTest(JOIN_POINT_IN_POLYGON_LARGE_TEST_EXP - join/quadtree_point_in_polygon_test_large.cu) +ConfigureTest(JOIN_POINT_IN_POLYGON_LARGE_TEST_EXP join/quadtree_point_in_polygon_test_large.cu) -ConfigureTest(JOIN_POINT_IN_POLYGON_OOM_TEST_EXP - join/quadtree_point_in_polygon_test_oom.cu) +ConfigureTest(JOIN_POINT_IN_POLYGON_OOM_TEST_EXP join/quadtree_point_in_polygon_test_oom.cu) ConfigureTest(JOIN_POINT_TO_LINESTRING_SMALL_TEST_EXP - join/quadtree_point_to_nearest_linestring_test_small.cu) + join/quadtree_point_to_nearest_linestring_test_small.cu) # operators -ConfigureTest(OPERATOR_TEST_EXP - operators/linestrings_test.cu) +ConfigureTest(OPERATOR_TEST_EXP operators/linestrings_test.cu) # projection -ConfigureTest(SINUSOIDAL_PROJECTION_TEST_EXP - projection/sinusoidal_projection_test.cu) +ConfigureTest(SINUSOIDAL_PROJECTION_TEST_EXP projection/sinusoidal_projection_test.cu) # range -ConfigureTest(RANGE_TEST_EXP - range/multipoint_range_test.cu - range/multilinestring_range_test.cu - range/multipolygon_range_test.cu) +ConfigureTest(RANGE_TEST_EXP range/multipoint_range_test.cu range/multilinestring_range_test.cu + range/multipolygon_range_test.cu) # bounding boxes -ConfigureTest(POINT_BOUNDING_BOXES_TEST_EXP - bounding_boxes/point_bounding_boxes_test.cu) +ConfigureTest(POINT_BOUNDING_BOXES_TEST_EXP bounding_boxes/point_bounding_boxes_test.cu) -ConfigureTest(POLYGON_BOUNDING_BOXES_TEST_EXP - bounding_boxes/polygon_bounding_boxes_test.cu) +ConfigureTest(POLYGON_BOUNDING_BOXES_TEST_EXP bounding_boxes/polygon_bounding_boxes_test.cu) -ConfigureTest(LINESTRING_BOUNDING_BOXES_TEST_EXP - bounding_boxes/linestring_bounding_boxes_test.cu) +ConfigureTest(LINESTRING_BOUNDING_BOXES_TEST_EXP bounding_boxes/linestring_bounding_boxes_test.cu) # distance -ConfigureTest(HAUSDORFF_TEST_EXP - distance/hausdorff_test.cu) +ConfigureTest(HAUSDORFF_TEST_EXP distance/hausdorff_test.cu) -ConfigureTest(HAVERSINE_TEST_EXP - distance/haversine_test.cu) +ConfigureTest(HAVERSINE_TEST_EXP distance/haversine_test.cu) -ConfigureTest(POINT_DISTANCE_TEST_EXP - distance/point_distance_test.cu) +ConfigureTest(POINT_DISTANCE_TEST_EXP distance/point_distance_test.cu) -ConfigureTest(POINT_LINESTRING_DISTANCE_TEST_EXP - distance/point_linestring_distance_test.cu) +ConfigureTest(POINT_LINESTRING_DISTANCE_TEST_EXP distance/point_linestring_distance_test.cu) -ConfigureTest(POINT_POLYGON_DISTANCE_TEST_EXP - distance/point_polygon_distance_test.cu) +ConfigureTest(POINT_POLYGON_DISTANCE_TEST_EXP distance/point_polygon_distance_test.cu) -ConfigureTest(LINESTRING_POLYGON_DISTANCE_TEST_EXP - distance/linestring_polygon_distance_test.cu) +ConfigureTest(LINESTRING_POLYGON_DISTANCE_TEST_EXP distance/linestring_polygon_distance_test.cu) -ConfigureTest(LINESTRING_DISTANCE_TEST_EXP - distance/linestring_distance_test.cu - distance/linestring_distance_test_medium.cu) +ConfigureTest(LINESTRING_DISTANCE_TEST_EXP distance/linestring_distance_test.cu + distance/linestring_distance_test_medium.cu) -ConfigureTest(POLYGON_DISTANCE_TEST_EXP - distance/polygon_distance_test.cu) +ConfigureTest(POLYGON_DISTANCE_TEST_EXP distance/polygon_distance_test.cu) # equality ConfigureTest(PAIRWISE_MULTIPOINT_EQUALS_COUNT_TEST_EXP - equality/pairwise_multipoint_equals_count_test.cu) + equality/pairwise_multipoint_equals_count_test.cu) # intersection -ConfigureTest(LINESTRING_INTERSECTION_TEST_EXP - intersection/linestring_intersection_count_test.cu - intersection/linestring_intersection_intermediates_remove_if_test.cu - intersection/linestring_intersection_with_duplicates_test.cu - intersection/linestring_intersection_test.cu - intersection/linestring_intersection_large_test.cu) +ConfigureTest( + LINESTRING_INTERSECTION_TEST_EXP + intersection/linestring_intersection_count_test.cu + intersection/linestring_intersection_intermediates_remove_if_test.cu + intersection/linestring_intersection_with_duplicates_test.cu + intersection/linestring_intersection_test.cu + intersection/linestring_intersection_large_test.cu) # nearest points ConfigureTest(POINT_LINESTRING_NEAREST_POINT_TEST_EXP - nearest_points/point_linestring_nearest_points_test.cu) + nearest_points/point_linestring_nearest_points_test.cu) # point in polygon -ConfigureTest(POINT_IN_POLYGON_TEST_EXP - point_in_polygon/point_in_polygon_test.cu) +ConfigureTest(POINT_IN_POLYGON_TEST_EXP point_in_polygon/point_in_polygon_test.cu) -ConfigureTest(PAIRWISE_POINT_IN_POLYGON_TEST_EXP - point_in_polygon/pairwise_point_in_polygon_test.cu) +ConfigureTest(PAIRWISE_POINT_IN_POLYGON_TEST_EXP point_in_polygon/pairwise_point_in_polygon_test.cu) # points in range -ConfigureTest(POINTS_IN_RANGE_TEST_EXP - points_in_range/points_in_range_test.cu) +ConfigureTest(POINTS_IN_RANGE_TEST_EXP points_in_range/points_in_range_test.cu) # trajectory -ConfigureTest(DERIVE_TRAJECTORIES_TEST_EXP - trajectory/derive_trajectories_test.cu) +ConfigureTest(DERIVE_TRAJECTORIES_TEST_EXP trajectory/derive_trajectories_test.cu) ConfigureTest(TRAJECTORY_DISTANCES_AND_SPEEDS_TEST_EXP - trajectory/trajectory_distances_and_speeds_test.cu) + trajectory/trajectory_distances_and_speeds_test.cu) diff --git a/java/src/main/native/CMakeLists.txt b/java/src/main/native/CMakeLists.txt index 1fe48b8ab..5afbd5c46 100755 --- a/java/src/main/native/CMakeLists.txt +++ b/java/src/main/native/CMakeLists.txt @@ -1,5 +1,5 @@ #============================================================================= -# Copyright (c) 2019-2024, NVIDIA CORPORATION. +# Copyright (c) 2019-2025, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -21,7 +21,10 @@ include(../../../../rapids_config.cmake) # that just an oversight, or is there a reason not to include this here? rapids_cuda_init_architectures(CUSPATIAL_JNI) -project(CUDF_JNI VERSION 0.7.0 LANGUAGES C CXX CUDA) +project( + CUDF_JNI + VERSION 0.7.0 + LANGUAGES C CXX CUDA) ################################################################################################### # - build type ------------------------------------------------------------------------------------ @@ -41,41 +44,45 @@ set(CMAKE_CUDA_STANDARD 17) set(CMAKE_CUDA_STANDARD_REQUIRED ON) if(CMAKE_COMPILER_IS_GNUCXX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=deprecated-declarations") - - option(CMAKE_CXX11_ABI "Enable the GLIBCXX11 ABI" ON) - if(CMAKE_CXX11_ABI) - message(STATUS "CUDF: Enabling the GLIBCXX11 ABI") - else() - message(STATUS "CUDF: Disabling the GLIBCXX11 ABI") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0") - set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler -D_GLIBCXX_USE_CXX11_ABI=0") - endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=deprecated-declarations") + + option(CMAKE_CXX11_ABI "Enable the GLIBCXX11 ABI" ON) + if(CMAKE_CXX11_ABI) + message(STATUS "CUDF: Enabling the GLIBCXX11 ABI") + else() + message(STATUS "CUDF: Disabling the GLIBCXX11 ABI") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0") + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler -D_GLIBCXX_USE_CXX11_ABI=0") + endif() endif() #set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_61,code=sm_61") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -gencode=arch=compute_60,code=sm_60") -set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_70,code=compute_70") +set(CMAKE_CUDA_FLAGS + "${CMAKE_CUDA_FLAGS} -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_70,code=compute_70" +) # set warnings as errors # TODO: remove `no-maybe-uninitialized` used to suppress warnings in rmm::exec_policy -set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Werror cross-execution-space-call -Xcompiler -Wall,-Werror,-Wno-error=deprecated-declarations") +set(CMAKE_CUDA_FLAGS + "${CMAKE_CUDA_FLAGS} -Werror cross-execution-space-call -Xcompiler -Wall,-Werror,-Wno-error=deprecated-declarations" +) # 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") +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() # Debug options if(CMAKE_BUILD_TYPE MATCHES Debug) - message(STATUS "Building with debugging flags") - set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G -Xcompiler -rdynamic") + message(STATUS "Building with debugging flags") + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G -Xcompiler -rdynamic") endif() -option(BUILD_TESTS "Configure CMake to build tests" - ON) +option(BUILD_TESTS "Configure CMake to build tests" ON) ################################################################################################### # - cudart options -------------------------------------------------------------------------------- @@ -84,10 +91,10 @@ option(BUILD_TESTS "Configure CMake to build tests" option(CUDA_STATIC_RUNTIME "Statically link the CUDA runtime" OFF) if(CUDA_STATIC_RUNTIME) - message(STATUS "Enabling static linking of cudart") - set(CUDART_LIBRARY "cudart_static") + message(STATUS "Enabling static linking of cudart") + set(CUDART_LIBRARY "cudart_static") else() - set(CUDART_LIBRARY "cudart") + set(CUDART_LIBRARY "cudart") endif() ################################################################################################### @@ -102,98 +109,82 @@ include(CheckLibraryExists) ################################################################################################### # - Thrust/CUB/libcudacxx ------------------------------------------------------------------------------------ -find_path(LIBCUDACXX_INCLUDE "simt" - HINTS "$ENV{CONDA_PREFIX}/include/libcudf/libcudacxx" - "$ENV{CUDF_HOME}/cpp/build/_deps/libcudacxx-src/include") +find_path(LIBCUDACXX_INCLUDE "simt" HINTS "$ENV{CONDA_PREFIX}/include/libcudf/libcudacxx" + "$ENV{CUDF_HOME}/cpp/build/_deps/libcudacxx-src/include") message(STATUS "CUDACXX: LIBCUDACXX_INCLUDE set to ${LIBCUDACXX_INCLUDE}") ################################################################################################### # - RMM ------------------------------------------------------------------------------------------- -find_path(RMM_INCLUDE "rmm" - HINTS "$ENV{CONDA_PREFIX}/include" - "$ENV{CONDA_PREFIX}/include/rmm" - "$ENV{RMM_HOME}/include") +find_path(RMM_INCLUDE "rmm" HINTS "$ENV{CONDA_PREFIX}/include" "$ENV{CONDA_PREFIX}/include/rmm" + "$ENV{RMM_HOME}/include") -find_library(RMM_LIBRARY "rmm" - HINTS "$ENV{CONDA_PREFIX}/lib" - "$ENV{RMM_HOME}/build") +find_library(RMM_LIBRARY "rmm" HINTS "$ENV{CONDA_PREFIX}/lib" "$ENV{RMM_HOME}/build") message(STATUS "RMM: RMM_INCLUDE set to ${RMM_INCLUDE}") message(STATUS "RMM: RMM_LIBRARY set to ${RMM_LIBRARY}") add_library(rmm SHARED IMPORTED ${RMM_LIBRARY}) -if (RMM_INCLUDE AND RMM_LIBRARY) - set_target_properties(rmm PROPERTIES IMPORTED_LOCATION ${RMM_LIBRARY}) -endif (RMM_INCLUDE AND RMM_LIBRARY) +if(RMM_INCLUDE AND RMM_LIBRARY) + set_target_properties(rmm PROPERTIES IMPORTED_LOCATION ${RMM_LIBRARY}) +endif(RMM_INCLUDE AND RMM_LIBRARY) ################################################################################################### # - CUDF ------------------------------------------------------------------------------------------ -set(CUDF_INCLUDE "$ENV{CONDA_PREFIX}/include" - "$ENV{CUDF_HOME}/java/src/main/native/include") +set(CUDF_INCLUDE "$ENV{CONDA_PREFIX}/include" "$ENV{CUDF_HOME}/java/src/main/native/include") -find_library(CUDF_LIBRARY "cudf" - HINTS "$ENV{CONDA_PREFIX}/lib" - "$ENV{CUDF_HOME}/cpp/build") +find_library(CUDF_LIBRARY "cudf" HINTS "$ENV{CONDA_PREFIX}/lib" "$ENV{CUDF_HOME}/cpp/build") message(STATUS "CUDF: CUDF_INCLUDE set to ${CUDF_INCLUDE}") message(STATUS "CUDF: CUDF_LIBRARY set to ${CUDF_LIBRARY}") add_library(cudf SHARED IMPORTED ${CUDF_LIBRARY}) -if (CUDF_INCLUDE AND CUDF_LIBRARY) - set_target_properties(cudf PROPERTIES IMPORTED_LOCATION ${CUDF_LIBRARY}) -endif (CUDF_INCLUDE AND CUDF_LIBRARY) +if(CUDF_INCLUDE AND CUDF_LIBRARY) + set_target_properties(cudf PROPERTIES IMPORTED_LOCATION ${CUDF_LIBRARY}) +endif(CUDF_INCLUDE AND CUDF_LIBRARY) ################################################################################################### # - CUSPATIAL ------------------------------------------------------------------------------------------ set(CUSPATIAL_INCLUDE "$ENV{CUSPATIAL_HOME}/cpp/include") -find_library(CUSPATIAL_LIBRARY "cuspatial" - HINTS "$ENV{CUSPATIAL_HOME}/cpp/build") +find_library(CUSPATIAL_LIBRARY "cuspatial" HINTS "$ENV{CUSPATIAL_HOME}/cpp/build") message(STATUS "CUSPATIAL: CUSPATIAL_INCLUDE set to ${CUSPATIAL_INCLUDE}") message(STATUS "CUSPATIAL: CUSPATIAL_LIBRARY set to ${CUSPATIAL_LIBRARY}") add_library(cuspatial SHARED IMPORTED ${CUSPATIAL_LIBRARY}) -if (CUSPATIAL_INCLUDE AND CUSPATIAL_LIBRARY) - set_target_properties(cuspatial PROPERTIES IMPORTED_LOCATION ${CUSPATIAL_LIBRARY}) -endif (CUSPATIAL_INCLUDE AND CUSPATIAL_LIBRARY) +if(CUSPATIAL_INCLUDE AND CUSPATIAL_LIBRARY) + set_target_properties(cuspatial PROPERTIES IMPORTED_LOCATION ${CUSPATIAL_LIBRARY}) +endif(CUSPATIAL_INCLUDE AND CUSPATIAL_LIBRARY) ################################################################################################### # - find JNI ------------------------------------------------------------------------------------- find_package(JNI REQUIRED) if(JNI_FOUND) - message(STATUS "JDK with JNI in ${JNI_INCLUDE_DIRS}") + message(STATUS "JDK with JNI in ${JNI_INCLUDE_DIRS}") else() - message(FATAL_ERROR "JDK with JNI not found, please check your settings.") + message(FATAL_ERROR "JDK with JNI not found, please check your settings.") endif() ################################################################################################### # - include paths --------------------------------------------------------------------------------- -include_directories("${CMAKE_SOURCE_DIR}/include" - "${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}" - "${LIBCUDACXX_INCLUDE}" - "${RMM_INCLUDE}" - "${CUDF_INCLUDE}" - "${CUSPATIAL_INCLUDE}" - "${JNI_INCLUDE_DIRS}") +include_directories( + "${CMAKE_SOURCE_DIR}/include" "${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}" "${LIBCUDACXX_INCLUDE}" + "${RMM_INCLUDE}" "${CUDF_INCLUDE}" "${CUSPATIAL_INCLUDE}" "${JNI_INCLUDE_DIRS}") ################################################################################################### # - library paths --------------------------------------------------------------------------------- -link_directories("${CMAKE_BINARY_DIR}/lib" - "${CUSPATIAL_LIBRARY}") - +link_directories("${CMAKE_BINARY_DIR}/lib" "${CUSPATIAL_LIBRARY}") ################################################################################################### # - library targets ------------------------------------------------------------------------------- -set(SOURCE_FILES - "src/cuSpatialJni.cpp") +set(SOURCE_FILES "src/cuSpatialJni.cpp") add_library(cuspatialjni SHARED ${SOURCE_FILES}) #Override RPATH for cuspatialjni @@ -204,16 +195,16 @@ SET_TARGET_PROPERTIES(cuspatialjni PROPERTIES BUILD_RPATH "\$ORIGIN") option(USE_NVTX "Build with NVTX support" ON) if(USE_NVTX) - message(STATUS "Using Nvidia Tools Extension") - find_library(NVTX_LIBRARY nvToolsExt PATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) - target_link_libraries(cuspatialjni ${NVTX_LIBRARY}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_NVTX") + message(STATUS "Using Nvidia Tools Extension") + find_library(NVTX_LIBRARY nvToolsExt PATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) + target_link_libraries(cuspatialjni ${NVTX_LIBRARY}) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_NVTX") endif() option(PER_THREAD_DEFAULT_STREAM "Build with per-thread default stream" OFF) if(PER_THREAD_DEFAULT_STREAM) - message(STATUS "Using per-thread default stream") - add_compile_definitions(CUDA_API_PER_THREAD_DEFAULT_STREAM) + message(STATUS "Using per-thread default stream") + add_compile_definitions(CUDA_API_PER_THREAD_DEFAULT_STREAM) endif() ################################################################################################### diff --git a/python/cuproj/CMakeLists.txt b/python/cuproj/CMakeLists.txt index 2f7b743b0..bde4a1e00 100644 --- a/python/cuproj/CMakeLists.txt +++ b/python/cuproj/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================= -# Copyright (c) 2023-2024, NVIDIA CORPORATION. +# Copyright (c) 2023-2025, 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 @@ -23,8 +23,8 @@ project( VERSION "${RAPIDS_VERSION}" LANGUAGES CXX CUDA) -option(FIND_CUPROJ_CPP "Search for existing cuproj C++ installations before defaulting to local files" - OFF) +option(FIND_CUPROJ_CPP + "Search for existing cuproj C++ installations before defaulting to local files" OFF) # If the user requested it we attempt to find cuproj. if(FIND_CUPROJ_CPP) diff --git a/python/cuproj/cuproj/_lib/CMakeLists.txt b/python/cuproj/cuproj/_lib/CMakeLists.txt index 8302f303f..fe232e96d 100644 --- a/python/cuproj/cuproj/_lib/CMakeLists.txt +++ b/python/cuproj/cuproj/_lib/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================= -# Copyright (c) 2023, NVIDIA CORPORATION. +# Copyright (c) 2023-2025, 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 @@ -12,8 +12,7 @@ # the License. # ============================================================================= -set(cython_sources - transform.pyx) +set(cython_sources transform.pyx) set(linked_libraries cuprojshim) @@ -21,5 +20,4 @@ rapids_cython_create_modules( CXX ASSOCIATED_TARGETS cuproj SOURCE_FILES "${cython_sources}" - LINKED_LIBRARIES "${linked_libraries}" -) + LINKED_LIBRARIES "${linked_libraries}") diff --git a/python/cuproj/cuproj/cuprojshim/CMakeLists.txt b/python/cuproj/cuproj/cuprojshim/CMakeLists.txt index 00769965f..c5ca1a038 100644 --- a/python/cuproj/cuproj/cuprojshim/CMakeLists.txt +++ b/python/cuproj/cuproj/cuprojshim/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================= -# Copyright (c) 2023-2024, NVIDIA CORPORATION. +# Copyright (c) 2023-2025, 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 @@ -27,7 +27,6 @@ project( VERSION "${RAPIDS_VERSION}" LANGUAGES CXX CUDA) - ################################################################################################### # - build options --------------------------------------------------------------------------------- @@ -35,16 +34,24 @@ option(USE_NVTX "Build with NVTX support" ON) option(PER_THREAD_DEFAULT_STREAM "Build with per-thread default stream" OFF) option(DISABLE_DEPRECATION_WARNING "Disable warnings generated from deprecated declarations." OFF) # Option to enable line info in CUDA device compilation to allow introspection when profiling / memchecking -option(CUDA_ENABLE_LINEINFO "Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler" OFF) +option(CUDA_ENABLE_LINEINFO + "Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler" OFF) # cudart can be statically linked or dynamically linked. The python ecosystem wants dynamic linking option(CUDA_STATIC_RUNTIME "Statically link the CUDA toolkit runtime and libraries" OFF) message(STATUS "CUPROJSHIM: Build with NVTX support: ${USE_NVTX}") message(STATUS "CUPROJSHIM: Build with per-thread default stream: ${PER_THREAD_DEFAULT_STREAM}") -message(STATUS "CUPROJSHIM: Disable warnings generated from deprecated declarations: ${DISABLE_DEPRECATION_WARNING}") -message(STATUS "CUPROJSHIM: Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler: ${CUDA_ENABLE_LINEINFO}") -message(STATUS "CUPROJSHIM: Statically link the CUDA toolkit runtime and libraries: ${CUDA_STATIC_RUNTIME}") - +message( + STATUS + "CUPROJSHIM: Disable warnings generated from deprecated declarations: ${DISABLE_DEPRECATION_WARNING}" +) +message( + STATUS + "CUPROJSHIM: Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler: ${CUDA_ENABLE_LINEINFO}" +) +message( + STATUS + "CUPROJSHIM: Statically link the CUDA toolkit runtime and libraries: ${CUDA_STATIC_RUNTIME}") rapids_cmake_build_type("Release") @@ -54,8 +61,11 @@ set(CUPROJSHIM_CXX_DEFINITIONS "") set(CUPROJSHIM_CUDA_DEFINITIONS "") # Set RMM logging level -set(RMM_LOGGING_LEVEL "INFO" CACHE STRING "Choose the logging level.") -set_property(CACHE RMM_LOGGING_LEVEL PROPERTY STRINGS "TRACE" "DEBUG" "INFO" "WARN" "ERROR" "CRITICAL" "OFF") +set(RMM_LOGGING_LEVEL + "INFO" + CACHE STRING "Choose the logging level.") +set_property(CACHE RMM_LOGGING_LEVEL PROPERTY STRINGS "TRACE" "DEBUG" "INFO" "WARN" "ERROR" + "CRITICAL" "OFF") message(STATUS "CUPROJSHIM: RMM_LOGGING_LEVEL = '${RMM_LOGGING_LEVEL}'.") ################################################################################################### @@ -68,11 +78,8 @@ rapids_cmake_support_conda_env(conda_env MODIFY_PREFIX_PATH) rapids_cuda_init_runtime(USE_STATIC ${CUDA_STATIC_RUNTIME}) -rapids_find_package( - CUDAToolkit REQUIRED - BUILD_EXPORT_SET cuprojshim-exports - INSTALL_EXPORT_SET cuprojshim-exports -) +rapids_find_package(CUDAToolkit REQUIRED BUILD_EXPORT_SET cuprojshim-exports INSTALL_EXPORT_SET + cuprojshim-exports) # * find CUDAToolkit package # * determine GPU architectures @@ -94,36 +101,34 @@ include(../../../../cpp/cuproj/cmake/thirdparty/get_rmm.cmake) add_library(cuprojshim STATIC src/cuprojshim.cu) -set_target_properties(cuprojshim - 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 - POSITION_INDEPENDENT_CODE ON - INTERFACE_POSITION_INDEPENDENT_CODE ON -) +set_target_properties( + cuprojshim + 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 + POSITION_INDEPENDENT_CODE ON + INTERFACE_POSITION_INDEPENDENT_CODE ON) # Use `CUPROJ_*_FLAGS` here because we reuse the cuProj's ConfigureCUDA.cmake above -target_compile_options(cuprojshim - PRIVATE "$<$:${CUPROJ_CXX_FLAGS}>" - "$<$:${CUPROJ_CUDA_FLAGS}>" -) +target_compile_options(cuprojshim PRIVATE "$<$:${CUPROJ_CXX_FLAGS}>" + "$<$:${CUPROJ_CUDA_FLAGS}>") # Use `CUPROJ_*_DEFINITIONS` here because we reuse the cuProj's ConfigureCUDA.cmake above -target_compile_definitions(cuprojshim - PUBLIC "$<$:${CUPROJ_CXX_DEFINITIONS}>" - "$<$:${CUPROJ_CUDA_DEFINITIONS}>" -) +target_compile_definitions( + cuprojshim PUBLIC "$<$:${CUPROJ_CXX_DEFINITIONS}>" + "$<$:${CUPROJ_CUDA_DEFINITIONS}>") # Specify include paths for the current target and dependents -target_include_directories(cuprojshim - PUBLIC "$" - PUBLIC "$" - PRIVATE "$" - INTERFACE "$") +target_include_directories( + cuprojshim + PUBLIC "$" + "$" + PRIVATE "$" + INTERFACE "$") # Add Conda library, and include paths if specified if(TARGET conda_env) @@ -139,16 +144,17 @@ endif() # Per-thread default stream if(PER_THREAD_DEFAULT_STREAM) - target_compile_definitions(cuprojshim PUBLIC CUDA_API_PER_THREAD_DEFAULT_STREAM) + target_compile_definitions(cuprojshim PUBLIC CUDA_API_PER_THREAD_DEFAULT_STREAM) endif() # Disable NVTX if necessary if(NOT USE_NVTX) - target_compile_definitions(cuprojshim PUBLIC NVTX_DISABLE) + target_compile_definitions(cuprojshim PUBLIC NVTX_DISABLE) endif() # Define spdlog level -target_compile_definitions(cuprojshim PUBLIC "SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_${RMM_LOGGING_LEVEL}") +target_compile_definitions(cuprojshim + PUBLIC "SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_${RMM_LOGGING_LEVEL}") target_link_libraries(cuprojshim PUBLIC cuproj::cuproj rmm::rmm) diff --git a/python/cuspatial/cuspatial/_lib/CMakeLists.txt b/python/cuspatial/cuspatial/_lib/CMakeLists.txt index d3730c940..5a38a0b93 100644 --- a/python/cuspatial/cuspatial/_lib/CMakeLists.txt +++ b/python/cuspatial/cuspatial/_lib/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================= -# Copyright (c) 2022-2023, NVIDIA CORPORATION. +# Copyright (c) 2022-2025, 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 @@ -27,13 +27,11 @@ set(cython_sources spatial_join.pyx trajectory.pyx types.pyx - utils.pyx - ) + utils.pyx) set(linked_libraries cuspatial::cuspatial) rapids_cython_create_modules( CXX ASSOCIATED_TARGETS cuspatial SOURCE_FILES "${cython_sources}" - LINKED_LIBRARIES "${linked_libraries}" -) + LINKED_LIBRARIES "${linked_libraries}") diff --git a/python/libcuspatial/CMakeLists.txt b/python/libcuspatial/CMakeLists.txt index 86c3cd1ef..9ece72e7e 100644 --- a/python/libcuspatial/CMakeLists.txt +++ b/python/libcuspatial/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================= -# Copyright (c) 2024, NVIDIA CORPORATION. +# Copyright (c) 2024-2025, 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 @@ -19,8 +19,7 @@ include(../../rapids_config.cmake) project( libcuspatial-python VERSION "${RAPIDS_VERSION}" - LANGUAGES CXX -) + LANGUAGES CXX) # Check if cuspatial is already available. If so, it is the user's responsibility to ensure that the # CMake package is also available at build time of the Python cuspatial package. diff --git a/rapids_config.cmake b/rapids_config.cmake index 40207b870..ee0e68dd5 100644 --- a/rapids_config.cmake +++ b/rapids_config.cmake @@ -1,5 +1,5 @@ # ============================================================================= -# Copyright (c) 2018-2024, NVIDIA CORPORATION. +# Copyright (c) 2018-2025, 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 @@ -22,15 +22,13 @@ else() string(REPLACE "\n" "\n " _rapids_version_formatted " ${_rapids_version}") message( FATAL_ERROR - "Could not determine RAPIDS version. Contents of VERSION file:\n${_rapids_version_formatted}" - ) + "Could not determine RAPIDS version. Contents of VERSION file:\n${_rapids_version_formatted}") endif() if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/CUSPATIAL_RAPIDS-${RAPIDS_VERSION_MAJOR_MINOR}.cmake") file( DOWNLOAD "https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-${RAPIDS_VERSION_MAJOR_MINOR}/RAPIDS.cmake" - "${CMAKE_CURRENT_BINARY_DIR}/CUSPATIAL_RAPIDS-${RAPIDS_VERSION_MAJOR_MINOR}.cmake" - ) + "${CMAKE_CURRENT_BINARY_DIR}/CUSPATIAL_RAPIDS-${RAPIDS_VERSION_MAJOR_MINOR}.cmake") endif() include("${CMAKE_CURRENT_BINARY_DIR}/CUSPATIAL_RAPIDS-${RAPIDS_VERSION_MAJOR_MINOR}.cmake") From 17be32ffd7ce93ccb2e603e464864c1a7b26b65d Mon Sep 17 00:00:00 2001 From: James Lamb Date: Thu, 23 Jan 2025 17:04:41 -0600 Subject: [PATCH 2/5] few more formatting changes --- cpp/CMakeLists.txt | 22 ++++++++++++++----- cpp/cuproj/CMakeLists.txt | 16 ++++++++++---- .../cuproj/cuproj/cuprojshim/CMakeLists.txt | 6 +++-- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index b6ea271ed..15588ad73 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -102,8 +102,10 @@ rapids_cmake_support_conda_env(conda_env MODIFY_PREFIX_PATH) rapids_cuda_init_runtime(USE_STATIC ${CUDA_STATIC_RUNTIME}) -rapids_find_package(CUDAToolkit REQUIRED BUILD_EXPORT_SET cuspatial-exports INSTALL_EXPORT_SET - cuspatial-exports) +rapids_find_package( + CUDAToolkit REQUIRED + BUILD_EXPORT_SET cuspatial-exports + INSTALL_EXPORT_SET cuspatial-exports) # * find CUDAToolkit package # * determine GPU architectures # * enable the CMake CUDA language @@ -274,14 +276,22 @@ targets: cuspatial::cuspatial - The main cuspatial library. ]=]) -rapids_export(INSTALL cuspatial EXPORT_SET cuspatial-exports GLOBAL_TARGETS cuspatial NAMESPACE - cuspatial:: DOCUMENTATION doc_string) +rapids_export( + INSTALL cuspatial + EXPORT_SET cuspatial-exports + GLOBAL_TARGETS cuspatial + NAMESPACE cuspatial:: + DOCUMENTATION doc_string) ################################################################################################ # - build export ------------------------------------------------------------------------------- -rapids_export(BUILD cuspatial EXPORT_SET cuspatial-exports GLOBAL_TARGETS cuspatial NAMESPACE - cuspatial:: DOCUMENTATION doc_string) +rapids_export( + BUILD cuspatial + EXPORT_SET cuspatial-exports + GLOBAL_TARGETS cuspatial + NAMESPACE cuspatial:: + DOCUMENTATION doc_string) # ################################################################################################## # * build documentation ---------------------------------------------------------------------------- diff --git a/cpp/cuproj/CMakeLists.txt b/cpp/cuproj/CMakeLists.txt index e463a4568..37f3666a1 100644 --- a/cpp/cuproj/CMakeLists.txt +++ b/cpp/cuproj/CMakeLists.txt @@ -215,14 +215,22 @@ targets: cuproj::cuproj - The main cuproj library. ]=]) -rapids_export(INSTALL cuproj EXPORT_SET cuproj-exports GLOBAL_TARGETS cuproj NAMESPACE cuproj:: - DOCUMENTATION doc_string) +rapids_export( + INSTALL cuproj + EXPORT_SET cuproj-exports + GLOBAL_TARGETS cuproj + NAMESPACE cuproj:: + DOCUMENTATION doc_string) ################################################################################################ # - build export ------------------------------------------------------------------------------- -rapids_export(BUILD cuproj EXPORT_SET cuproj-exports GLOBAL_TARGETS cuproj NAMESPACE cuproj:: - DOCUMENTATION doc_string) +rapids_export( + BUILD cuproj + EXPORT_SET cuproj-exports + GLOBAL_TARGETS cuproj + NAMESPACE cuproj:: + DOCUMENTATION doc_string) # ################################################################################################## # * build documentation ---------------------------------------------------------------------------- diff --git a/python/cuproj/cuproj/cuprojshim/CMakeLists.txt b/python/cuproj/cuproj/cuprojshim/CMakeLists.txt index c5ca1a038..c003546da 100644 --- a/python/cuproj/cuproj/cuprojshim/CMakeLists.txt +++ b/python/cuproj/cuproj/cuprojshim/CMakeLists.txt @@ -78,8 +78,10 @@ rapids_cmake_support_conda_env(conda_env MODIFY_PREFIX_PATH) rapids_cuda_init_runtime(USE_STATIC ${CUDA_STATIC_RUNTIME}) -rapids_find_package(CUDAToolkit REQUIRED BUILD_EXPORT_SET cuprojshim-exports INSTALL_EXPORT_SET - cuprojshim-exports) +rapids_find_package( + CUDAToolkit REQUIRED + BUILD_EXPORT_SET cuprojshim-exports + INSTALL_EXPORT_SET cuprojshim-exports) # * find CUDAToolkit package # * determine GPU architectures From e7865f32a06d7543ea0f0101480795a7b8bae93e Mon Sep 17 00:00:00 2001 From: James Lamb Date: Fri, 24 Jan 2025 14:44:16 -0600 Subject: [PATCH 3/5] revert all the style-related changes --- .pre-commit-config.yaml | 27 +- ci/check_style.sh | 6 +- cpp/CMakeLists.txt | 221 +++++++-------- cpp/benchmarks/CMakeLists.txt | 126 +++++---- cpp/cmake/Modules/ConfigureCUDA.cmake | 25 +- cpp/cmake/config.json | 13 +- cpp/cuproj/CMakeLists.txt | 157 +++++------ cpp/cuproj/benchmarks/CMakeLists.txt | 48 ++-- cpp/cuproj/cmake/modules/ConfigureCUDA.cmake | 25 +- cpp/cuproj/tests/CMakeLists.txt | 55 ++-- cpp/tests/CMakeLists.txt | 266 ++++++++++-------- python/cuproj/CMakeLists.txt | 6 +- python/cuproj/cuproj/_lib/CMakeLists.txt | 8 +- .../cuproj/cuproj/cuprojshim/CMakeLists.txt | 84 +++--- .../cuspatial/cuspatial/_lib/CMakeLists.txt | 8 +- python/libcuspatial/CMakeLists.txt | 5 +- rapids_config.cmake | 8 +- 17 files changed, 549 insertions(+), 539 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8af1cfaf9..77a98437e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -52,32 +52,7 @@ repos: hooks: - id: rapids-dependency-file-generator args: ["--clean"] - - repo: local - hooks: - - id: cmake-format - name: cmake-format - entry: ./cpp/scripts/run-cmake-format.sh cmake-format - language: python - types: [cmake] - exclude: .*/thirdparty/.* - # Note that pre-commit autoupdate does not update the versions - # of dependencies, so we'll have to update this manually. - additional_dependencies: - - cmakelang==0.6.13 - verbose: true - require_serial: true - - id: cmake-lint - name: cmake-lint - entry: ./cpp/scripts/run-cmake-format.sh cmake-lint - language: python - types: [cmake] - exclude: .*/thirdparty/.* - # Note that pre-commit autoupdate does not update the versions - # of dependencies, so we'll have to update this manually. - additional_dependencies: - - cmakelang==0.6.13 - verbose: true - require_serial: true + default_language_version: python: python3 diff --git a/ci/check_style.sh b/ci/check_style.sh index cdaee40a8..cbc369dc0 100755 --- a/ci/check_style.sh +++ b/ci/check_style.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) 2020-2025, NVIDIA CORPORATION. +# Copyright (c) 2020-2024, NVIDIA CORPORATION. set -euo pipefail @@ -14,9 +14,7 @@ rapids-dependency-file-generator \ rapids-mamba-retry env create --yes -f env.yaml -n checks conda activate checks -# get config for cmake-format checks -RAPIDS_VERSION_MAJOR_MINOR="$(rapids-version-major-minor)" -FORMAT_FILE_URL="https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-${RAPIDS_VERSION_MAJOR_MINOR}/cmake-format-rapids-cmake.json" +FORMAT_FILE_URL=https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-23.02/cmake-format-rapids-cmake.json export RAPIDS_CMAKE_FORMAT_FILE=/tmp/rapids_cmake_ci/cmake-formats-rapids-cmake.json mkdir -p $(dirname ${RAPIDS_CMAKE_FORMAT_FILE}) wget -O ${RAPIDS_CMAKE_FORMAT_FILE} ${FORMAT_FILE_URL} diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 15588ad73..8908617b1 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -1,5 +1,5 @@ #============================================================================= -# Copyright (c) 2019-2025, NVIDIA CORPORATION. +# Copyright (c) 2019-2024, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -25,10 +25,7 @@ include(rapids-find) rapids_cuda_init_architectures(CUSPATIAL) -project( - CUSPATIAL - VERSION "${RAPIDS_VERSION}" - LANGUAGES C CXX CUDA) +project(CUSPATIAL VERSION "${RAPIDS_VERSION}" LANGUAGES C CXX CUDA) # Needed because GoogleBenchmark changes the state of FindThreads.cmake, # causing subsequent runs to have different values for the `Threads::Threads` target. @@ -50,8 +47,7 @@ option(BUILD_BENCHMARKS "Configure CMake to build (google) benchmarks" OFF) option(PER_THREAD_DEFAULT_STREAM "Build with per-thread default stream" OFF) option(DISABLE_DEPRECATION_WARNING "Disable warnings generated from deprecated declarations." OFF) # Option to enable line info in CUDA device compilation to allow introspection when profiling / memchecking -option(CUDA_ENABLE_LINEINFO - "Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler" OFF) +option(CUDA_ENABLE_LINEINFO "Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler" OFF) # cudart can be statically linked or dynamically linked. The python ecosystem wants dynamic linking option(CUDA_STATIC_RUNTIME "Statically link the CUDA toolkit runtime and libraries" OFF) @@ -62,17 +58,9 @@ message(STATUS "CUSPATIAL: Build with NVTX support: ${USE_NVTX}") message(STATUS "CUSPATIAL: Configure CMake to build tests: ${BUILD_TESTS}") message(STATUS "CUSPATIAL: Configure CMake to build (google) benchmarks: ${BUILD_BENCHMARKS}") message(STATUS "CUSPATIAL: Build with per-thread default stream: ${PER_THREAD_DEFAULT_STREAM}") -message( - STATUS - "CUSPATIAL: Disable warnings generated from deprecated declarations: ${DISABLE_DEPRECATION_WARNING}" -) -message( - STATUS - "CUSPATIAL: Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler: ${CUDA_ENABLE_LINEINFO}" -) -message( - STATUS "CUSPATIAL: Statically link the CUDA toolkit runtime and libraries: ${CUDA_STATIC_RUNTIME}" -) +message(STATUS "CUSPATIAL: Disable warnings generated from deprecated declarations: ${DISABLE_DEPRECATION_WARNING}") +message(STATUS "CUSPATIAL: Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler: ${CUDA_ENABLE_LINEINFO}") +message(STATUS "CUSPATIAL: Statically link the CUDA toolkit runtime and libraries: ${CUDA_STATIC_RUNTIME}") # Set a default build type if none was specified rapids_cmake_build_type("Release") @@ -85,11 +73,8 @@ set(CUSPATIAL_CXX_DEFINITIONS "") set(CUSPATIAL_CUDA_DEFINITIONS "") # Set RMM logging level -set(RMM_LOGGING_LEVEL - "INFO" - CACHE STRING "Choose the logging level.") -set_property(CACHE RMM_LOGGING_LEVEL PROPERTY STRINGS "TRACE" "DEBUG" "INFO" "WARN" "ERROR" - "CRITICAL" "OFF") +set(RMM_LOGGING_LEVEL "INFO" CACHE STRING "Choose the logging level.") +set_property(CACHE RMM_LOGGING_LEVEL PROPERTY STRINGS "TRACE" "DEBUG" "INFO" "WARN" "ERROR" "CRITICAL" "OFF") message(STATUS "CUSPATIAL: RMM_LOGGING_LEVEL = '${RMM_LOGGING_LEVEL}'.") ################################################################################################### @@ -105,7 +90,8 @@ rapids_cuda_init_runtime(USE_STATIC ${CUDA_STATIC_RUNTIME}) rapids_find_package( CUDAToolkit REQUIRED BUILD_EXPORT_SET cuspatial-exports - INSTALL_EXPORT_SET cuspatial-exports) + INSTALL_EXPORT_SET cuspatial-exports +) # * find CUDAToolkit package # * determine GPU architectures # * enable the CMake CUDA language @@ -120,12 +106,12 @@ rapids_cpm_init() # find or add cuDF include(cmake/thirdparty/get_cudf.cmake) # find or install GoogleTest -if(CUSPATIAL_BUILD_TESTS) +if (CUSPATIAL_BUILD_TESTS) include(${rapids-cmake-dir}/cpm/gtest.cmake) rapids_cpm_gtest(BUILD_STATIC) endif() # find or add ranger -include(cmake/thirdparty/get_ranger.cmake) +include (cmake/thirdparty/get_ranger.cmake) ################################################################################################### # - library targets ------------------------------------------------------------------------------- @@ -133,61 +119,63 @@ include(cmake/thirdparty/get_ranger.cmake) # cuProj add_subdirectory(cuproj) -add_library( - cuspatial - src/bounding_boxes/linestring_bounding_boxes.cu - src/bounding_boxes/polygon_bounding_boxes.cu - src/column/geometry_column_view.cpp - src/distance/hausdorff.cu - src/distance/haversine.cu - src/distance/linestring_distance.cu - src/distance/linestring_polygon_distance.cu - src/distance/point_distance.cu - src/distance/point_linestring_distance.cu - src/distance/point_polygon_distance.cu - src/distance/polygon_distance.cu - src/equality/pairwise_multipoint_equals_count.cu - src/indexing/point_quadtree.cu - src/intersection/linestring_intersection.cu - src/join/quadtree_point_in_polygon.cu - src/join/quadtree_point_to_nearest_linestring.cu - src/join/quadtree_bbox_filtering.cu - src/nearest_points/point_linestring_nearest_points.cu - src/point_in_polygon/point_in_polygon.cu - src/points_in_range/points_in_range.cu - src/projection/sinusoidal_projection.cu - src/trajectory/derive_trajectories.cu - src/trajectory/trajectory_bounding_boxes.cu - src/trajectory/trajectory_distances_and_speeds.cu) - -set_target_properties( - cuspatial - 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 - POSITION_INDEPENDENT_CODE ON - INTERFACE_POSITION_INDEPENDENT_CODE ON) - -target_compile_options(cuspatial PRIVATE "$<$:${CUSPATIAL_CXX_FLAGS}>" - "$<$:${CUSPATIAL_CUDA_FLAGS}>") - -target_compile_definitions( - cuspatial PUBLIC "$<$:${CUSPATIAL_CXX_DEFINITIONS}>" - "$:${CUSPATIAL_CUDA_DEFINITIONS}>>") +add_library(cuspatial + src/bounding_boxes/linestring_bounding_boxes.cu + src/bounding_boxes/polygon_bounding_boxes.cu + src/column/geometry_column_view.cpp + src/distance/hausdorff.cu + src/distance/haversine.cu + src/distance/linestring_distance.cu + src/distance/linestring_polygon_distance.cu + src/distance/point_distance.cu + src/distance/point_linestring_distance.cu + src/distance/point_polygon_distance.cu + src/distance/polygon_distance.cu + src/equality/pairwise_multipoint_equals_count.cu + src/indexing/point_quadtree.cu + src/intersection/linestring_intersection.cu + src/join/quadtree_point_in_polygon.cu + src/join/quadtree_point_to_nearest_linestring.cu + src/join/quadtree_bbox_filtering.cu + src/nearest_points/point_linestring_nearest_points.cu + src/point_in_polygon/point_in_polygon.cu + src/points_in_range/points_in_range.cu + src/projection/sinusoidal_projection.cu + src/trajectory/derive_trajectories.cu + src/trajectory/trajectory_bounding_boxes.cu + src/trajectory/trajectory_distances_and_speeds.cu +) + +set_target_properties(cuspatial + 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 + POSITION_INDEPENDENT_CODE ON + INTERFACE_POSITION_INDEPENDENT_CODE ON +) + +target_compile_options(cuspatial + PRIVATE "$<$:${CUSPATIAL_CXX_FLAGS}>" + "$<$:${CUSPATIAL_CUDA_FLAGS}>" +) + +target_compile_definitions(cuspatial + PUBLIC "$<$:${CUSPATIAL_CXX_DEFINITIONS}>" + "$:${CUSPATIAL_CUDA_DEFINITIONS}>>" +) # Disable Jitify log printing. See https://github.com/NVIDIA/jitify/issues/79 target_compile_definitions(cuspatial PRIVATE "JITIFY_PRINT_LOG=0") # Specify include paths for the current target and dependents -target_include_directories( - cuspatial - PUBLIC "$" - PRIVATE "$" - INTERFACE "$") +target_include_directories(cuspatial + PUBLIC "$" + PRIVATE "$" + INTERFACE "$") # Add Conda library, and include paths if specified if(TARGET conda_env) @@ -203,12 +191,12 @@ endif() # Per-thread default stream if(PER_THREAD_DEFAULT_STREAM) - target_compile_definitions(cuspatial PUBLIC CUDA_API_PER_THREAD_DEFAULT_STREAM) + target_compile_definitions(cuspatial PUBLIC CUDA_API_PER_THREAD_DEFAULT_STREAM) endif() # Disable NVTX if necessary if(NOT USE_NVTX) - target_compile_definitions(cuspatial PUBLIC NVTX_DISABLE) + target_compile_definitions(cuspatial PUBLIC NVTX_DISABLE) endif() # Define spdlog level @@ -224,26 +212,26 @@ add_library(cuspatial::cuspatial ALIAS cuspatial) # - add tests ------------------------------------------------------------------------------------- if(CUSPATIAL_BUILD_TESTS) - # include CTest module -- automatically calls enable_testing() - include(CTest) - add_subdirectory(tests) + # include CTest module -- automatically calls enable_testing() + include(CTest) + add_subdirectory(tests) endif() ################################################################################################### # - add benchmarks -------------------------------------------------------------------------------- if(CUSPATIAL_BUILD_BENCHMARKS) - # Find or install GoogleBench - include(${rapids-cmake-dir}/cpm/gbench.cmake) - rapids_cpm_gbench(BUILD_STATIC) - - # Find or install NVBench Temporarily force downloading of fmt because current versions of nvbench - # do not support the latest version of fmt, which is automatically pulled into our conda - # environments by mamba. - set(CPM_DOWNLOAD_fmt TRUE) - include(${rapids-cmake-dir}/cpm/nvbench.cmake) - rapids_cpm_nvbench() - add_subdirectory(benchmarks) + # Find or install GoogleBench + include(${rapids-cmake-dir}/cpm/gbench.cmake) + rapids_cpm_gbench(BUILD_STATIC) + + # Find or install NVBench Temporarily force downloading of fmt because current versions of nvbench + # do not support the latest version of fmt, which is automatically pulled into our conda + # environments by mamba. + set(CPM_DOWNLOAD_fmt TRUE) + include(${rapids-cmake-dir}/cpm/nvbench.cmake) + rapids_cpm_nvbench() + add_subdirectory(benchmarks) endif() ################################################################################################### @@ -254,12 +242,12 @@ include(CPack) set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME cuspatial) -install( - TARGETS cuspatial - DESTINATION ${lib_dir} - EXPORT cuspatial-exports) +install(TARGETS cuspatial + DESTINATION ${lib_dir} + EXPORT cuspatial-exports) -install(DIRECTORY ${CUSPATIAL_SOURCE_DIR}/include/cuspatial DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install(DIRECTORY ${CUSPATIAL_SOURCE_DIR}/include/cuspatial + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) set(doc_string [=[ @@ -274,14 +262,17 @@ If cuspatial is found, this module defines the following IMPORTED GLOBAL targets: cuspatial::cuspatial - The main cuspatial library. - ]=]) + ]=] +) rapids_export( INSTALL cuspatial EXPORT_SET cuspatial-exports GLOBAL_TARGETS cuspatial NAMESPACE cuspatial:: - DOCUMENTATION doc_string) + DOCUMENTATION doc_string +) + ################################################################################################ # - build export ------------------------------------------------------------------------------- @@ -291,7 +282,9 @@ rapids_export( EXPORT_SET cuspatial-exports GLOBAL_TARGETS cuspatial NAMESPACE cuspatial:: - DOCUMENTATION doc_string) + DOCUMENTATION doc_string +) + # ################################################################################################## # * build documentation ---------------------------------------------------------------------------- @@ -300,19 +293,19 @@ find_package(Doxygen) if(DOXYGEN_FOUND) - # doc targets for cuSpatial - add_custom_command( - OUTPUT CUSPATIAL_DOXYGEN - WORKING_DIRECTORY ${CUSPATIAL_SOURCE_DIR}/doxygen - COMMAND - ${CMAKE_COMMAND} -E env "RAPIDS_VERSION=${RAPIDS_VERSION}" - "RAPIDS_VERSION_MAJOR_MINOR=${RAPIDS_VERSION_MAJOR_MINOR}" ${DOXYGEN_EXECUTABLE} Doxyfile - VERBATIM - COMMENT "Custom command for building cuspatial doxygen docs.") - - add_custom_target( - docs_cuspatial - DEPENDS CUSPATIAL_DOXYGEN - COMMENT "Custom command for building cuspatial doxygen docs.") +# doc targets for cuSpatial +add_custom_command( + OUTPUT CUSPATIAL_DOXYGEN + WORKING_DIRECTORY ${CUSPATIAL_SOURCE_DIR}/doxygen + COMMAND ${CMAKE_COMMAND} -E env "RAPIDS_VERSION=${RAPIDS_VERSION}" "RAPIDS_VERSION_MAJOR_MINOR=${RAPIDS_VERSION_MAJOR_MINOR}" ${DOXYGEN_EXECUTABLE} Doxyfile + VERBATIM + COMMENT "Custom command for building cuspatial doxygen docs." +) + +add_custom_target( + docs_cuspatial + DEPENDS CUSPATIAL_DOXYGEN + COMMENT "Custom command for building cuspatial doxygen docs." +) endif() diff --git a/cpp/benchmarks/CMakeLists.txt b/cpp/benchmarks/CMakeLists.txt index 62e3c2aed..98506d9a4 100644 --- a/cpp/benchmarks/CMakeLists.txt +++ b/cpp/benchmarks/CMakeLists.txt @@ -1,5 +1,5 @@ #============================================================================= -# Copyright (c) 2019-2025, NVIDIA CORPORATION. +# Copyright (c) 2019-2024, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,57 +18,58 @@ # - compiler function ----------------------------------------------------------------------------- # Use an OBJECT library so we only compile common source files only once -add_library(cuspatial_benchmark_common OBJECT synchronization/synchronization.cpp) +add_library(cuspatial_benchmark_common OBJECT + synchronization/synchronization.cpp) target_compile_features(cuspatial_benchmark_common PUBLIC cxx_std_17 cuda_std_17) -target_compile_options( - cuspatial_benchmark_common PUBLIC "$<$:${CUSPATIAL_CXX_FLAGS}>" - "$<$:${CUSPATIAL_CUDA_FLAGS}>") - -set_target_properties( - cuspatial_benchmark_common - PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$" - INSTALL_RPATH "\$ORIGIN/../../../lib" - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED ON - CUDA_STANDARD 17 - CUDA_STANDARD_REQUIRED ON - POSITION_INDEPENDENT_CODE ON - INTERFACE_POSITION_INDEPENDENT_CODE ON) - -target_link_libraries( - cuspatial_benchmark_common - PUBLIC benchmark::benchmark cudf::cudftestutil ranger::ranger cuspatial GTest::gtest GTest::gmock - PRIVATE cudf::cudftestutil_impl) - -target_compile_options( - cuspatial_benchmark_common PUBLIC "$<$:${CUSPATIAL_CXX_FLAGS}>" - "$<$:${CUSPATIAL_CUDA_FLAGS}>") - -target_include_directories( - cuspatial_benchmark_common - PUBLIC "$" - "$" - "$") +target_compile_options(cuspatial_benchmark_common PUBLIC "$<$:${CUSPATIAL_CXX_FLAGS}>" + "$<$:${CUSPATIAL_CUDA_FLAGS}>") -function(ConfigureBench CMAKE_BENCH_NAME) - add_executable(${CMAKE_BENCH_NAME} ${ARGN}) - set_target_properties( - ${CMAKE_BENCH_NAME} +set_target_properties(cuspatial_benchmark_common PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$" INSTALL_RPATH "\$ORIGIN/../../../lib" - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED ON - CUDA_STANDARD 17 - CUDA_STANDARD_REQUIRED ON) - target_link_libraries(${CMAKE_BENCH_NAME} PRIVATE benchmark::benchmark_main - cuspatial_benchmark_common) - install( - TARGETS ${CMAKE_BENCH_NAME} - COMPONENT benchmark - DESTINATION bin/benchmarks/libcuspatial - EXCLUDE_FROM_ALL) + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED ON + CUDA_STANDARD 17 + CUDA_STANDARD_REQUIRED ON + POSITION_INDEPENDENT_CODE ON + INTERFACE_POSITION_INDEPENDENT_CODE ON +) + +target_link_libraries(cuspatial_benchmark_common + PUBLIC benchmark::benchmark + cudf::cudftestutil + ranger::ranger + cuspatial GTest::gtest GTest::gmock + PRIVATE cudf::cudftestutil_impl) + +target_compile_options(cuspatial_benchmark_common + PUBLIC "$<$:${CUSPATIAL_CXX_FLAGS}>" + "$<$:${CUSPATIAL_CUDA_FLAGS}>") + +target_include_directories(cuspatial_benchmark_common + PUBLIC "$" + "$" + "$") + +function(ConfigureBench CMAKE_BENCH_NAME) + add_executable(${CMAKE_BENCH_NAME} ${ARGN}) + set_target_properties(${CMAKE_BENCH_NAME} + PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$" + INSTALL_RPATH "\$ORIGIN/../../../lib" + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED ON + CUDA_STANDARD 17 + CUDA_STANDARD_REQUIRED ON + ) + target_link_libraries(${CMAKE_BENCH_NAME} PRIVATE benchmark::benchmark_main cuspatial_benchmark_common) + install( + TARGETS ${CMAKE_BENCH_NAME} + COMPONENT benchmark + DESTINATION bin/benchmarks/libcuspatial + EXCLUDE_FROM_ALL + ) endfunction() # This function takes in a benchmark name and benchmark source for nvbench benchmarks and handles @@ -82,32 +83,43 @@ function(ConfigureNVBench CMAKE_BENCH_NAME) CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON CUDA_STANDARD 17 - CUDA_STANDARD_REQUIRED ON) - target_link_libraries(${CMAKE_BENCH_NAME} PRIVATE cuspatial_benchmark_common nvbench::main) + CUDA_STANDARD_REQUIRED ON +) + target_link_libraries( + ${CMAKE_BENCH_NAME} PRIVATE cuspatial_benchmark_common nvbench::main + ) install( TARGETS ${CMAKE_BENCH_NAME} COMPONENT benchmark DESTINATION bin/benchmarks/libcuspatial - EXCLUDE_FROM_ALL) + EXCLUDE_FROM_ALL + ) endfunction() ################################################################################################### ### benchmark sources ############################################################################# ################################################################################################### -ConfigureBench(HAUSDORFF_BENCH distance/hausdorff_benchmark.cpp) +ConfigureBench(HAUSDORFF_BENCH + distance/hausdorff_benchmark.cpp) -ConfigureNVBench(POINT_POLYGON_DISTANCES_BENCH distance/pairwise_point_polygon_distance.cu) +ConfigureNVBench(POINT_POLYGON_DISTANCES_BENCH + distance/pairwise_point_polygon_distance.cu) -ConfigureNVBench(LINESTRING_DISTANCES_BENCH distance/pairwise_linestring_distance.cu) +ConfigureNVBench(LINESTRING_DISTANCES_BENCH + distance/pairwise_linestring_distance.cu) ConfigureNVBench(LINESTRING_POLYGON_DISTANCES_BENCH - distance/pairwise_linestring_polygon_distance.cu) + distance/pairwise_linestring_polygon_distance.cu) -ConfigureNVBench(QUADTREE_ON_POINTS_BENCH indexing/quadtree_on_points.cu) +ConfigureNVBench(QUADTREE_ON_POINTS_BENCH + indexing/quadtree_on_points.cu) -ConfigureNVBench(POINT_IN_POLYGON_BENCH point_in_polygon/point_in_polygon.cu) +ConfigureNVBench(POINT_IN_POLYGON_BENCH + point_in_polygon/point_in_polygon.cu) -ConfigureNVBench(POINTS_IN_RANGE_BENCH points_in_range/points_in_range.cu) +ConfigureNVBench(POINTS_IN_RANGE_BENCH + points_in_range/points_in_range.cu) -ConfigureNVBench(FLOATING_POINT_EQUALITY_BENCH utility/floating_point_equality.cu) +ConfigureNVBench(FLOATING_POINT_EQUALITY_BENCH + utility/floating_point_equality.cu) diff --git a/cpp/cmake/Modules/ConfigureCUDA.cmake b/cpp/cmake/Modules/ConfigureCUDA.cmake index ada820628..6fc9e8372 100644 --- a/cpp/cmake/Modules/ConfigureCUDA.cmake +++ b/cpp/cmake/Modules/ConfigureCUDA.cmake @@ -1,5 +1,5 @@ #============================================================================= -# Copyright (c) 2021-2025, NVIDIA CORPORATION. +# Copyright (c) 2021-2024, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,19 +15,18 @@ #============================================================================= if(CMAKE_COMPILER_IS_GNUCXX) - list(APPEND CUSPATIAL_CXX_FLAGS -Wall -Werror -Wno-unknown-pragmas - -Wno-error=deprecated-declarations) - if(CUSPATIAL_BUILD_TESTS OR CUSPATIAL_BUILD_BENCHMARKS) - # Suppress parentheses warning which causes gmock to fail - list(APPEND CUSPATIAL_CUDA_FLAGS -Xcompiler=-Wno-parentheses) - endif() + list(APPEND CUSPATIAL_CXX_FLAGS -Wall -Werror -Wno-unknown-pragmas -Wno-error=deprecated-declarations) + if(CUSPATIAL_BUILD_TESTS OR CUSPATIAL_BUILD_BENCHMARKS) + # Suppress parentheses warning which causes gmock to fail + list(APPEND CUSPATIAL_CUDA_FLAGS -Xcompiler=-Wno-parentheses) + endif() endif(CMAKE_COMPILER_IS_GNUCXX) list(APPEND CUSPATIAL_CUDA_FLAGS --expt-extended-lambda --expt-relaxed-constexpr) # set warnings as errors if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 11.2.0) - list(APPEND CUSPATIAL_CUDA_FLAGS -Werror=all-warnings) + list(APPEND CUSPATIAL_CUDA_FLAGS -Werror=all-warnings) endif() list(APPEND CUSPATIAL_CUDA_FLAGS -Xcompiler=-Wall,-Werror,-Wno-error=deprecated-declarations) @@ -35,17 +34,17 @@ list(APPEND CUSPATIAL_CUDA_FLAGS -Xcompiler=-Wall,-Werror,-Wno-error=deprecated- list(APPEND CUSPATIAL_CUDA_FLAGS -Xfatbin=-compress-all) if(DISABLE_DEPRECATION_WARNING) - list(APPEND CUSPATIAL_CXX_FLAGS -Wno-deprecated-declarations) - list(APPEND CUSPATIAL_CUDA_FLAGS -Xcompiler=-Wno-deprecated-declarations) + list(APPEND CUSPATIAL_CXX_FLAGS -Wno-deprecated-declarations) + list(APPEND CUSPATIAL_CUDA_FLAGS -Xcompiler=-Wno-deprecated-declarations) endif() # Option to enable line info in CUDA device compilation to allow introspection when profiling / memchecking if(CUDA_ENABLE_LINEINFO) - list(APPEND CUSPATIAL_CUDA_FLAGS -lineinfo) + list(APPEND CUSPATIAL_CUDA_FLAGS -lineinfo) endif() # Debug options if(CMAKE_BUILD_TYPE MATCHES Debug) - message(STATUS "CUSPATIAL: Building with debugging flags") - list(APPEND CUSPATIAL_CUDA_FLAGS -G -Xcompiler=-rdynamic) + message(STATUS "CUSPATIAL: Building with debugging flags") + list(APPEND CUSPATIAL_CUDA_FLAGS -G -Xcompiler=-rdynamic) endif() diff --git a/cpp/cmake/config.json b/cpp/cmake/config.json index 647de6a5d..fa3f769cc 100644 --- a/cpp/cmake/config.json +++ b/cpp/cmake/config.json @@ -12,14 +12,6 @@ "FIND_PACKAGE_ARGUMENTS": "*" } }, - "rapids_cython_create_modules": { - "kwargs": { - "SOURCE_FILES": "?", - "LINKED_LIBRARIES": "?", - "MODULE_PREFIX": "?", - "ASSOCIATED_TARGETS": "?" - } - }, "ConfigureTest": { "flags": ["TEST_NAME", "TEST_SRC"] }, @@ -36,7 +28,7 @@ "max_pargs_hwrap": 999 }, "lint": { - "disabled_codes": ["C0111", "C0301"], + "disabled_codes": ["C0301"], "function_pattern": "[0-9A-z_]+", "macro_pattern": "[0-9A-z_]+", "global_var_pattern": "[A-z][0-9A-z_]+", @@ -46,8 +38,5 @@ "public_var_pattern": "[A-z][0-9A-z_]+", "argument_var_pattern": "[A-z][A-z0-9_]+", "keyword_pattern": "[A-z][0-9A-z_]+" - }, - "markup": { - "enable_markup": false } } diff --git a/cpp/cuproj/CMakeLists.txt b/cpp/cuproj/CMakeLists.txt index 37f3666a1..061a627ca 100644 --- a/cpp/cuproj/CMakeLists.txt +++ b/cpp/cuproj/CMakeLists.txt @@ -1,5 +1,5 @@ #============================================================================= -# Copyright (c) 2023-2025, NVIDIA CORPORATION. +# Copyright (c) 2023-2024, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -25,10 +25,7 @@ include(rapids-find) rapids_cuda_init_architectures(CUPROJ) -project( - CUPROJ - VERSION "${RAPIDS_VERSION}" - LANGUAGES C CXX CUDA) +project(CUPROJ VERSION "${RAPIDS_VERSION}" LANGUAGES C CXX CUDA) # Needed because GoogleBenchmark changes the state of FindThreads.cmake, # causing subsequent runs to have different values for the `Threads::Threads` target. @@ -50,8 +47,7 @@ option(BUILD_BENCHMARKS "Configure CMake to build (google) benchmarks" OFF) option(PER_THREAD_DEFAULT_STREAM "Build with per-thread default stream" OFF) option(DISABLE_DEPRECATION_WARNING "Disable warnings generated from deprecated declarations." OFF) # Option to enable line info in CUDA device compilation to allow introspection when profiling / memchecking -option(CUDA_ENABLE_LINEINFO - "Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler" OFF) +option(CUDA_ENABLE_LINEINFO "Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler" OFF) # cudart can be statically linked or dynamically linked. The python ecosystem wants dynamic linking option(CUDA_STATIC_RUNTIME "Statically link the CUDA toolkit runtime and libraries" OFF) @@ -59,16 +55,9 @@ message(STATUS "CUPROJ: Build with NVTX support: ${USE_NVTX}") message(STATUS "CUPROJ: Configure CMake to build tests: ${BUILD_TESTS}") message(STATUS "CUPROJ: Configure CMake to build (google) benchmarks: ${BUILD_BENCHMARKS}") message(STATUS "CUPROJ: Build with per-thread default stream: ${PER_THREAD_DEFAULT_STREAM}") -message( - STATUS - "CUPROJ: Disable warnings generated from deprecated declarations: ${DISABLE_DEPRECATION_WARNING}" -) -message( - STATUS - "CUPROJ: Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler: ${CUDA_ENABLE_LINEINFO}" -) -message( - STATUS "CUPROJ: Statically link the CUDA toolkit runtime and libraries: ${CUDA_STATIC_RUNTIME}") +message(STATUS "CUPROJ: Disable warnings generated from deprecated declarations: ${DISABLE_DEPRECATION_WARNING}") +message(STATUS "CUPROJ: Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler: ${CUDA_ENABLE_LINEINFO}") +message(STATUS "CUPROJ: Statically link the CUDA toolkit runtime and libraries: ${CUDA_STATIC_RUNTIME}") # Set a default build type if none was specified rapids_cmake_build_type("Release") @@ -81,11 +70,8 @@ set(CUPROJ_CXX_DEFINITIONS "") set(CUPROJ_CUDA_DEFINITIONS "") # Set RMM logging level -set(RMM_LOGGING_LEVEL - "INFO" - CACHE STRING "Choose the logging level.") -set_property(CACHE RMM_LOGGING_LEVEL PROPERTY STRINGS "TRACE" "DEBUG" "INFO" "WARN" "ERROR" - "CRITICAL" "OFF") +set(RMM_LOGGING_LEVEL "INFO" CACHE STRING "Choose the logging level.") +set_property(CACHE RMM_LOGGING_LEVEL PROPERTY STRINGS "TRACE" "DEBUG" "INFO" "WARN" "ERROR" "CRITICAL" "OFF") message(STATUS "CUPROJ: RMM_LOGGING_LEVEL = '${RMM_LOGGING_LEVEL}'.") ################################################################################################### @@ -108,7 +94,7 @@ rapids_cpm_init() include(cmake/thirdparty/get_rmm.cmake) # find or install GoogleTest and Proj -if(CUPROJ_BUILD_TESTS) +if (CUPROJ_BUILD_TESTS) include(${rapids-cmake-dir}/cpm/gtest.cmake) rapids_cpm_gtest(BUILD_STATIC) include(cmake/thirdparty/get_proj.cmake) @@ -122,37 +108,41 @@ add_library(cuproj::cuproj ALIAS cuproj) target_link_libraries(cuproj INTERFACE rmm::rmm) -set_target_properties( - cuproj - 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 - POSITION_INDEPENDENT_CODE ON - INTERFACE_POSITION_INDEPENDENT_CODE ON) - -target_compile_options(cuproj INTERFACE "$<$:${CUPROJ_CXX_FLAGS}>" - "$<$:${CUPROJ_CUDA_FLAGS}>") - -target_compile_definitions( - cuproj INTERFACE "$<$:${CUPROJ_CXX_DEFINITIONS}>" - "$<$:${CUPROJ_CUDA_DEFINITIONS}>") +set_target_properties(cuproj + 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 + POSITION_INDEPENDENT_CODE ON + INTERFACE_POSITION_INDEPENDENT_CODE ON +) + +target_compile_options(cuproj + INTERFACE "$<$:${CUPROJ_CXX_FLAGS}>" + "$<$:${CUPROJ_CUDA_FLAGS}>" +) + +target_compile_definitions(cuproj + INTERFACE "$<$:${CUPROJ_CXX_DEFINITIONS}>" + "$<$:${CUPROJ_CUDA_DEFINITIONS}>" +) # Specify include paths for the current target and dependents -target_include_directories(cuproj INTERFACE "$" - "$") +target_include_directories(cuproj + INTERFACE "$" + "$") # Per-thread default stream if(PER_THREAD_DEFAULT_STREAM) - target_compile_definitions(cuproj INTERFACE CUDA_API_PER_THREAD_DEFAULT_STREAM) + target_compile_definitions(cuproj INTERFACE CUDA_API_PER_THREAD_DEFAULT_STREAM) endif() # Disable NVTX if necessary if(NOT USE_NVTX) - target_compile_definitions(cuproj INTERFACE NVTX_DISABLE) + target_compile_definitions(cuproj INTERFACE NVTX_DISABLE) endif() # Define spdlog level @@ -162,26 +152,26 @@ target_compile_definitions(cuproj INTERFACE "SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_${ # - add tests ------------------------------------------------------------------------------------- if(CUPROJ_BUILD_TESTS) - # include CTest module -- automatically calls enable_testing() - include(CTest) - add_subdirectory(tests) + # include CTest module -- automatically calls enable_testing() + include(CTest) + add_subdirectory(tests) endif() ################################################################################################### # - add benchmarks -------------------------------------------------------------------------------- if(CUPROJ_BUILD_BENCHMARKS) - # Find or install GoogleBench - include(${rapids-cmake-dir}/cpm/gbench.cmake) - rapids_cpm_gbench(BUILD_STATIC) - - # Find or install NVBench Temporarily force downloading of fmt because current versions of nvbench - # do not support the latest version of fmt, which is automatically pulled into our conda - # environments by mamba. - set(CPM_DOWNLOAD_fmt TRUE) - include(${rapids-cmake-dir}/cpm/nvbench.cmake) - rapids_cpm_nvbench() - add_subdirectory(benchmarks) + # Find or install GoogleBench + include(${rapids-cmake-dir}/cpm/gbench.cmake) + rapids_cpm_gbench(BUILD_STATIC) + + # Find or install NVBench Temporarily force downloading of fmt because current versions of nvbench + # do not support the latest version of fmt, which is automatically pulled into our conda + # environments by mamba. + set(CPM_DOWNLOAD_fmt TRUE) + include(${rapids-cmake-dir}/cpm/nvbench.cmake) + rapids_cpm_nvbench() + add_subdirectory(benchmarks) endif() ################################################################################################### @@ -192,12 +182,12 @@ include(CPack) set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME cuproj) -install( - TARGETS cuproj - DESTINATION ${lib_dir} - EXPORT cuproj-exports) +install(TARGETS cuproj + DESTINATION ${lib_dir} + EXPORT cuproj-exports) -install(DIRECTORY ${CUPROJ_SOURCE_DIR}/include/cuproj DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install(DIRECTORY ${CUPROJ_SOURCE_DIR}/include/cuproj + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) set(doc_string [=[ @@ -213,14 +203,17 @@ If cuproj is found, this module defines the following IMPORTED GLOBAL targets: cuproj::cuproj - The main cuproj library. - ]=]) + ]=] +) rapids_export( INSTALL cuproj EXPORT_SET cuproj-exports GLOBAL_TARGETS cuproj NAMESPACE cuproj:: - DOCUMENTATION doc_string) + DOCUMENTATION doc_string +) + ################################################################################################ # - build export ------------------------------------------------------------------------------- @@ -230,7 +223,9 @@ rapids_export( EXPORT_SET cuproj-exports GLOBAL_TARGETS cuproj NAMESPACE cuproj:: - DOCUMENTATION doc_string) + DOCUMENTATION doc_string +) + # ################################################################################################## # * build documentation ---------------------------------------------------------------------------- @@ -239,19 +234,19 @@ find_package(Doxygen) if(DOXYGEN_FOUND) - # doc targets for cuproj - add_custom_command( - OUTPUT CUPROJ_DOXYGEN - WORKING_DIRECTORY ${CUPROJ_SOURCE_DIR}/doxygen - COMMAND - ${CMAKE_COMMAND} -E env "RAPIDS_VERSION=${RAPIDS_VERSION}" - "RAPIDS_VERSION_MAJOR_MINOR=${RAPIDS_VERSION_MAJOR_MINOR}" ${DOXYGEN_EXECUTABLE} Doxyfile - VERBATIM - COMMENT "Custom command for building cuproj doxygen docs.") - - add_custom_target( - docs_cuproj - DEPENDS CUPROJ_DOXYGEN - COMMENT "Custom command for building cuproj doxygen docs.") +# doc targets for cuproj +add_custom_command( + OUTPUT CUPROJ_DOXYGEN + WORKING_DIRECTORY ${CUPROJ_SOURCE_DIR}/doxygen + COMMAND ${CMAKE_COMMAND} -E env "RAPIDS_VERSION=${RAPIDS_VERSION}" "RAPIDS_VERSION_MAJOR_MINOR=${RAPIDS_VERSION_MAJOR_MINOR}" ${DOXYGEN_EXECUTABLE} Doxyfile + VERBATIM + COMMENT "Custom command for building cuproj doxygen docs." +) + +add_custom_target( + docs_cuproj + DEPENDS CUPROJ_DOXYGEN + COMMENT "Custom command for building cuproj doxygen docs." +) endif() diff --git a/cpp/cuproj/benchmarks/CMakeLists.txt b/cpp/cuproj/benchmarks/CMakeLists.txt index 5848b2b49..b2450b1c4 100644 --- a/cpp/cuproj/benchmarks/CMakeLists.txt +++ b/cpp/cuproj/benchmarks/CMakeLists.txt @@ -1,5 +1,5 @@ #============================================================================= -# Copyright (c) 2023-2025, NVIDIA CORPORATION. +# Copyright (c) 2023-2024, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,21 +18,20 @@ # - compiler function ----------------------------------------------------------------------------- # Use an OBJECT library so we only compile common source files only once -add_library(cuproj_benchmark_common OBJECT synchronization/synchronization.cpp) +add_library(cuproj_benchmark_common OBJECT + synchronization/synchronization.cpp) target_compile_features(cuproj_benchmark_common PUBLIC cxx_std_17 cuda_std_17) -target_link_libraries( - cuproj_benchmark_common +target_link_libraries(cuproj_benchmark_common PUBLIC benchmark::benchmark rmm::rmm cuproj PRIVATE rmm::rmm_logger_impl) -target_compile_options( - cuproj_benchmark_common PUBLIC "$<$:${CUPROJ_CXX_FLAGS}>" - "$<$:${CUPROJ_CUDA_FLAGS}>") +target_compile_options(cuproj_benchmark_common + PUBLIC "$<$:${CUPROJ_CXX_FLAGS}>" + "$<$:${CUPROJ_CUDA_FLAGS}>") -target_include_directories( - cuproj_benchmark_common +target_include_directories(cuproj_benchmark_common PUBLIC "$" "$" "$" @@ -40,17 +39,17 @@ target_include_directories( function(ConfigureBench CMAKE_BENCH_NAME) add_executable(${CMAKE_BENCH_NAME} ${ARGN}) - set_target_properties( - ${CMAKE_BENCH_NAME} + set_target_properties(${CMAKE_BENCH_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$" - INSTALL_RPATH "\$ORIGIN/../../../lib") - target_link_libraries(${CMAKE_BENCH_NAME} PRIVATE benchmark::benchmark_main - cuproj_benchmark_common PROJ::proj) + INSTALL_RPATH "\$ORIGIN/../../../lib" + ) + target_link_libraries(${CMAKE_BENCH_NAME} PRIVATE benchmark::benchmark_main cuproj_benchmark_common PROJ::proj) install( TARGETS ${CMAKE_BENCH_NAME} COMPONENT benchmark DESTINATION bin/benchmarks/libcuproj - EXCLUDE_FROM_ALL) + EXCLUDE_FROM_ALL + ) endfunction() # This function takes in a benchmark name and benchmark source for nvbench benchmarks and handles @@ -60,26 +59,29 @@ function(ConfigureNVBench CMAKE_BENCH_NAME) set_target_properties( ${CMAKE_BENCH_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$" - INSTALL_RPATH "\$ORIGIN/../../../lib") + INSTALL_RPATH "\$ORIGIN/../../../lib" + ) target_compile_features(${CMAKE_BENCH_NAME} PUBLIC cxx_std_17 cuda_std_17) - target_compile_options( - ${CMAKE_BENCH_NAME} PUBLIC "$<$:${CUPROJ_CXX_FLAGS}>" - "$<$:${CUPROJ_CUDA_FLAGS}>") + target_compile_options(${CMAKE_BENCH_NAME} + PUBLIC "$<$:${CUPROJ_CXX_FLAGS}>" + "$<$:${CUPROJ_CUDA_FLAGS}>") - target_include_directories( - ${CMAKE_BENCH_NAME} + target_include_directories(${CMAKE_BENCH_NAME} PUBLIC "$" "$" "$" "$") - target_link_libraries(${CMAKE_BENCH_NAME} PRIVATE cuproj nvbench::main) + target_link_libraries( + ${CMAKE_BENCH_NAME} PRIVATE cuproj nvbench::main + ) install( TARGETS ${CMAKE_BENCH_NAME} COMPONENT benchmark DESTINATION bin/benchmarks/libcuproj - EXCLUDE_FROM_ALL) + EXCLUDE_FROM_ALL + ) endfunction() ################################################################################################### diff --git a/cpp/cuproj/cmake/modules/ConfigureCUDA.cmake b/cpp/cuproj/cmake/modules/ConfigureCUDA.cmake index c98117a74..e41fd419a 100644 --- a/cpp/cuproj/cmake/modules/ConfigureCUDA.cmake +++ b/cpp/cuproj/cmake/modules/ConfigureCUDA.cmake @@ -1,5 +1,5 @@ #============================================================================= -# Copyright (c) 2023-2025, NVIDIA CORPORATION. +# Copyright (c) 2023-2024, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,19 +15,18 @@ #============================================================================= if(CMAKE_COMPILER_IS_GNUCXX) - list(APPEND CUPROJ_CXX_FLAGS -Wall -Werror -Wno-unknown-pragmas - -Wno-error=deprecated-declarations) - if(CUPROJ_BUILD_TESTS OR CUPROJ_BUILD_BENCHMARKS) - # Suppress parentheses warning which causes gmock to fail - list(APPEND CUPROJ_CUDA_FLAGS -Xcompiler=-Wno-parentheses) - endif() + list(APPEND CUPROJ_CXX_FLAGS -Wall -Werror -Wno-unknown-pragmas -Wno-error=deprecated-declarations) + if(CUPROJ_BUILD_TESTS OR CUPROJ_BUILD_BENCHMARKS) + # Suppress parentheses warning which causes gmock to fail + list(APPEND CUPROJ_CUDA_FLAGS -Xcompiler=-Wno-parentheses) + endif() endif(CMAKE_COMPILER_IS_GNUCXX) list(APPEND CUPROJ_CUDA_FLAGS --expt-extended-lambda) # set warnings as errors if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 11.2.0) - list(APPEND CUPROJ_CUDA_FLAGS -Werror=all-warnings) + list(APPEND CUPROJ_CUDA_FLAGS -Werror=all-warnings) endif() list(APPEND CUPROJ_CUDA_FLAGS -Xcompiler=-Wall,-Werror,-Wno-error=deprecated-declarations) @@ -35,17 +34,17 @@ list(APPEND CUPROJ_CUDA_FLAGS -Xcompiler=-Wall,-Werror,-Wno-error=deprecated-dec list(APPEND CUPROJ_CUDA_FLAGS -Xfatbin=-compress-all) if(DISABLE_DEPRECATION_WARNING) - list(APPEND CUPROJ_CXX_FLAGS -Wno-deprecated-declarations) - list(APPEND CUPROJ_CUDA_FLAGS -Xcompiler=-Wno-deprecated-declarations) + list(APPEND CUPROJ_CXX_FLAGS -Wno-deprecated-declarations) + list(APPEND CUPROJ_CUDA_FLAGS -Xcompiler=-Wno-deprecated-declarations) endif() # Option to enable line info in CUDA device compilation to allow introspection when profiling / memchecking if(CUDA_ENABLE_LINEINFO) - list(APPEND CUPROJ_CUDA_FLAGS -lineinfo) + list(APPEND CUPROJ_CUDA_FLAGS -lineinfo) endif() # Debug options if(CMAKE_BUILD_TYPE MATCHES Debug) - message(STATUS "CUSPATIAL: Building with debugging flags") - list(APPEND CUPROJ_CUDA_FLAGS -G -Xcompiler=-rdynamic) + message(STATUS "CUSPATIAL: Building with debugging flags") + list(APPEND CUPROJ_CUDA_FLAGS -G -Xcompiler=-rdynamic) endif() diff --git a/cpp/cuproj/tests/CMakeLists.txt b/cpp/cuproj/tests/CMakeLists.txt index 63e7a7a07..1329416cc 100644 --- a/cpp/cuproj/tests/CMakeLists.txt +++ b/cpp/cuproj/tests/CMakeLists.txt @@ -1,5 +1,5 @@ -#============================================================================= -# Copyright (c) 2023-2025, NVIDIA CORPORATION. +#============================================================================= +# Copyright (c) 2023-2024, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,29 +18,31 @@ # - compiler function ----------------------------------------------------------------------------- function(ConfigureTest CMAKE_TEST_NAME) - add_executable(${CMAKE_TEST_NAME} ${ARGN}) - target_compile_options( - ${CMAKE_TEST_NAME} PRIVATE "$<$:${CUPROJ_CXX_FLAGS}>" - "$<$:${CUPROJ_CUDA_FLAGS}>") - target_include_directories( - ${CMAKE_TEST_NAME} PRIVATE "$" - "$" ../../../cpp/include) - set_target_properties( - ${CMAKE_TEST_NAME} - PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$" - INSTALL_RPATH "\$ORIGIN/../../../lib" - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED ON - CUDA_STANDARD 17 - CUDA_STANDARD_REQUIRED ON) - target_link_libraries(${CMAKE_TEST_NAME} GTest::gtest_main GTest::gmock_main PROJ::proj rmm::rmm - cuproj) - add_test(NAME ${CMAKE_TEST_NAME} COMMAND ${CMAKE_TEST_NAME}) - install( - TARGETS ${CMAKE_TEST_NAME} - COMPONENT testing - DESTINATION bin/gtests/libcuspatial # add to libcuspatial CI testing - EXCLUDE_FROM_ALL) + add_executable(${CMAKE_TEST_NAME} ${ARGN}) + target_compile_options(${CMAKE_TEST_NAME} + PRIVATE "$<$:${CUPROJ_CXX_FLAGS}>" + "$<$:${CUPROJ_CUDA_FLAGS}>") + target_include_directories(${CMAKE_TEST_NAME} + PRIVATE "$" + "$" + ../../../cpp/include) + set_target_properties( + ${CMAKE_TEST_NAME} + PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$" + INSTALL_RPATH "\$ORIGIN/../../../lib" + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED ON + CUDA_STANDARD 17 + CUDA_STANDARD_REQUIRED ON + ) + target_link_libraries(${CMAKE_TEST_NAME} GTest::gtest_main GTest::gmock_main PROJ::proj rmm::rmm cuproj) + add_test(NAME ${CMAKE_TEST_NAME} COMMAND ${CMAKE_TEST_NAME}) + install( + TARGETS ${CMAKE_TEST_NAME} + COMPONENT testing + DESTINATION bin/gtests/libcuspatial # add to libcuspatial CI testing + EXCLUDE_FROM_ALL + ) endfunction(ConfigureTest) ################################################################################################### @@ -48,4 +50,5 @@ endfunction(ConfigureTest) ################################################################################################### # index -ConfigureTest(WGS_TO_UTM_TEST wgs_to_utm_test.cu) +ConfigureTest(WGS_TO_UTM_TEST + wgs_to_utm_test.cu) diff --git a/cpp/tests/CMakeLists.txt b/cpp/tests/CMakeLists.txt index 7bdaaf685..7bca36a41 100644 --- a/cpp/tests/CMakeLists.txt +++ b/cpp/tests/CMakeLists.txt @@ -1,5 +1,5 @@ -#============================================================================= -# Copyright (c) 2019-2025, NVIDIA CORPORATION. +#============================================================================= +# Copyright (c) 2019-2024, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,58 +17,57 @@ ################################################################################################### # - compiler function ----------------------------------------------------------------------------- -# cudftestutil_impl is an interface source library, this empty object -# library is used to speed-up compilation and linking against it, +# cudftestutil_impl is an interface source library, this empty object +# library is used to speed-up compilation and linking against it, # otherwise we pay the non-trivial compilation cost repeatedly for each # test executable add_library(cuspatial_test_common OBJECT test_common.cpp) target_compile_features(cuspatial_test_common PUBLIC cxx_std_17 cuda_std_17) -set_target_properties( - cuspatial_test_common - PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$" - INSTALL_RPATH "\$ORIGIN/../../../lib" - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED ON - CUDA_STANDARD 17 - CUDA_STANDARD_REQUIRED ON - POSITION_INDEPENDENT_CODE ON - INTERFACE_POSITION_INDEPENDENT_CODE ON) - -target_link_libraries( - cuspatial_test_common - PUBLIC cudf::cudftestutil GTest::gtest GTest::gmock - PRIVATE cudf::cudftestutil_impl) - -target_compile_options( - cuspatial_test_common PUBLIC "$<$:${CUSPATIAL_CXX_FLAGS}>" - "$<$:${CUSPATIAL_CUDA_FLAGS}>") +set_target_properties(cuspatial_test_common + PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$" + INSTALL_RPATH "\$ORIGIN/../../../lib" + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED ON + CUDA_STANDARD 17 + CUDA_STANDARD_REQUIRED ON + POSITION_INDEPENDENT_CODE ON + INTERFACE_POSITION_INDEPENDENT_CODE ON +) + +target_link_libraries(cuspatial_test_common + PUBLIC cudf::cudftestutil GTest::gtest GTest::gmock + PRIVATE cudf::cudftestutil_impl) + +target_compile_options(cuspatial_test_common PUBLIC "$<$:${CUSPATIAL_CXX_FLAGS}>" +"$<$:${CUSPATIAL_CUDA_FLAGS}>") function(ConfigureTest CMAKE_TEST_NAME) - add_executable(${CMAKE_TEST_NAME} ${ARGN}) - target_compile_options( - ${CMAKE_TEST_NAME} PRIVATE "$<$:${CUSPATIAL_CXX_FLAGS}>" - "$<$:${CUSPATIAL_CUDA_FLAGS}>") - target_include_directories( - ${CMAKE_TEST_NAME} PRIVATE "$" - "$") - set_target_properties( - ${CMAKE_TEST_NAME} - PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$" - INSTALL_RPATH "\$ORIGIN/../../../lib" - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED ON - CUDA_STANDARD 17 - CUDA_STANDARD_REQUIRED ON) - target_link_libraries(${CMAKE_TEST_NAME} GTest::gtest_main GTest::gmock_main ranger::ranger - cudf::cudftestutil cuspatial cuspatial_test_common) - add_test(NAME ${CMAKE_TEST_NAME} COMMAND ${CMAKE_TEST_NAME}) - install( - TARGETS ${CMAKE_TEST_NAME} - COMPONENT testing - DESTINATION bin/gtests/libcuspatial - EXCLUDE_FROM_ALL) + add_executable(${CMAKE_TEST_NAME} ${ARGN}) + target_compile_options(${CMAKE_TEST_NAME} + PRIVATE "$<$:${CUSPATIAL_CXX_FLAGS}>" + "$<$:${CUSPATIAL_CUDA_FLAGS}>") + target_include_directories(${CMAKE_TEST_NAME} + PRIVATE "$" + "$") + set_target_properties( + ${CMAKE_TEST_NAME} + PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$" + INSTALL_RPATH "\$ORIGIN/../../../lib" + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED ON + CUDA_STANDARD 17 + CUDA_STANDARD_REQUIRED ON + ) + target_link_libraries(${CMAKE_TEST_NAME} GTest::gtest_main GTest::gmock_main ranger::ranger cudf::cudftestutil cuspatial cuspatial_test_common) + add_test(NAME ${CMAKE_TEST_NAME} COMMAND ${CMAKE_TEST_NAME}) + install( + TARGETS ${CMAKE_TEST_NAME} + COMPONENT testing + DESTINATION bin/gtests/libcuspatial + EXCLUDE_FROM_ALL + ) endfunction(ConfigureTest) ################################################################################################### @@ -76,154 +75,201 @@ endfunction(ConfigureTest) ################################################################################################### # index -ConfigureTest(POINT_QUADTREE_TEST index/point_quadtree_test.cpp) +ConfigureTest(POINT_QUADTREE_TEST + index/point_quadtree_test.cpp) # join -ConfigureTest(JOIN_QUADTREE_AND_BOUNDING_BOXES_TEST join/join_quadtree_and_bounding_boxes_test.cpp) +ConfigureTest(JOIN_QUADTREE_AND_BOUNDING_BOXES_TEST + join/join_quadtree_and_bounding_boxes_test.cpp) ConfigureTest(JOIN_POINT_TO_NEAREST_LINESTRING_TEST - join/quadtree_point_to_nearest_linestring_test.cpp) + join/quadtree_point_to_nearest_linestring_test.cpp) -ConfigureTest(JOIN_POINT_IN_POLYGON_TEST join/quadtree_point_in_polygon_test.cpp) +ConfigureTest(JOIN_POINT_IN_POLYGON_TEST + join/quadtree_point_in_polygon_test.cpp) # projection -ConfigureTest(SINUSOIDAL_PROJECTION_TEST projection/sinusoidal_projection_test.cpp) +ConfigureTest(SINUSOIDAL_PROJECTION_TEST + projection/sinusoidal_projection_test.cpp) # bounding boxes -ConfigureTest(LINESTRING_BOUNDING_BOXES_TEST bounding_boxes/linestring_bounding_boxes_test.cpp) +ConfigureTest(LINESTRING_BOUNDING_BOXES_TEST + bounding_boxes/linestring_bounding_boxes_test.cpp) -ConfigureTest(POLYGON_BOUNDING_BOXES_TEST bounding_boxes/polygon_bounding_boxes_test.cpp) +ConfigureTest(POLYGON_BOUNDING_BOXES_TEST + bounding_boxes/polygon_bounding_boxes_test.cpp) # distance -ConfigureTest(HAVERSINE_TEST distance/haversine_test.cpp) +ConfigureTest(HAVERSINE_TEST + distance/haversine_test.cpp) -ConfigureTest(HAUSDORFF_TEST distance/hausdorff_test.cpp) +ConfigureTest(HAUSDORFF_TEST + distance/hausdorff_test.cpp) -ConfigureTest(POINT_DISTANCE_TEST distance/point_distance_test.cpp) +ConfigureTest(POINT_DISTANCE_TEST + distance/point_distance_test.cpp) -ConfigureTest(POINT_LINESTRING_DISTANCE_TEST distance/point_linestring_distance_test.cpp) +ConfigureTest(POINT_LINESTRING_DISTANCE_TEST + distance/point_linestring_distance_test.cpp) -ConfigureTest(LINESTRING_DISTANCE_TEST distance/linestring_distance_test.cpp) +ConfigureTest(LINESTRING_DISTANCE_TEST + distance/linestring_distance_test.cpp) -ConfigureTest(POINT_POLYGON_DISTANCE_TEST distance/point_polygon_distance_test.cpp) +ConfigureTest(POINT_POLYGON_DISTANCE_TEST + distance/point_polygon_distance_test.cpp) -ConfigureTest(LINESTRING_POLYGON_DISTANCE_TEST distance/linestring_polygon_distance_test.cpp) +ConfigureTest(LINESTRING_POLYGON_DISTANCE_TEST + distance/linestring_polygon_distance_test.cpp) -ConfigureTest(POLYGON_DISTANCE_TEST distance/polygon_distance_test.cpp) +ConfigureTest(POLYGON_DISTANCE_TEST + distance/polygon_distance_test.cpp) # equality ConfigureTest(PAIRWISE_MULTIPOINT_EQUALS_COUNT_TEST - equality/pairwise_multipoint_equals_count_test.cpp) + equality/pairwise_multipoint_equals_count_test.cpp) # intersection -ConfigureTest(LINESTRING_INTERSECTION_TEST intersection/linestring_intersection_test.cpp) +ConfigureTest(LINESTRING_INTERSECTION_TEST + intersection/linestring_intersection_test.cpp) # nearest points ConfigureTest(POINT_LINESTRING_NEAREST_POINT_TEST - nearest_points/point_linestring_nearest_points_test.cpp) + nearest_points/point_linestring_nearest_points_test.cpp) # point in polygon -ConfigureTest(POINT_IN_POLYGON_TEST point_in_polygon/point_in_polygon_test.cpp) +ConfigureTest(POINT_IN_POLYGON_TEST + point_in_polygon/point_in_polygon_test.cpp) -ConfigureTest(PAIRWISE_POINT_IN_POLYGON_TEST point_in_polygon/pairwise_point_in_polygon_test.cpp) +ConfigureTest(PAIRWISE_POINT_IN_POLYGON_TEST + point_in_polygon/pairwise_point_in_polygon_test.cpp) # points in range -ConfigureTest(POINTS_IN_RANGE_TEST points_in_range/points_in_range_test.cpp) +ConfigureTest(POINTS_IN_RANGE_TEST + points_in_range/points_in_range_test.cpp) # trajectory ConfigureTest(TRAJECTORY_DISTANCES_AND_SPEEDS_TEST - trajectory/test_trajectory_distances_and_speeds.cu) + trajectory/test_trajectory_distances_and_speeds.cu) -ConfigureTest(DERIVE_TRAJECTORIES_TEST trajectory/test_derive_trajectories.cpp) +ConfigureTest(DERIVE_TRAJECTORIES_TEST + trajectory/test_derive_trajectories.cpp) -ConfigureTest(TRAJECTORY_BOUNDING_BOXES_TEST trajectory/test_trajectory_bounding_boxes.cu) +ConfigureTest(TRAJECTORY_BOUNDING_BOXES_TEST + trajectory/test_trajectory_bounding_boxes.cu) # utility -ConfigureTest(UTILITY_TEST utility_test/test_float_equivalent.cu - utility_test/test_multipoint_factory.cu utility_test/test_geometry_generators.cu) +ConfigureTest(UTILITY_TEST + utility_test/test_float_equivalent.cu + utility_test/test_multipoint_factory.cu + utility_test/test_geometry_generators.cu +) # find / intersection util -ConfigureTest(FIND_TEST_EXP find/find_and_combine_segments_test.cu - find/find_points_on_segments_test.cu find/find_duplicate_points_test.cu) +ConfigureTest(FIND_TEST_EXP + find/find_and_combine_segments_test.cu + find/find_points_on_segments_test.cu + find/find_duplicate_points_test.cu) # index -ConfigureTest(POINT_QUADTREE_TEST_EXP index/point_quadtree_test.cu) +ConfigureTest(POINT_QUADTREE_TEST_EXP + index/point_quadtree_test.cu) # join ConfigureTest(JOIN_QUADTREE_AND_BOUNDING_BOXES_TEST_EXP - join/join_quadtree_and_bounding_boxes_test.cu) + join/join_quadtree_and_bounding_boxes_test.cu) -ConfigureTest(JOIN_POINT_IN_POLYGON_SMALL_TEST_EXP join/quadtree_point_in_polygon_test_small.cu) +ConfigureTest(JOIN_POINT_IN_POLYGON_SMALL_TEST_EXP + join/quadtree_point_in_polygon_test_small.cu) -ConfigureTest(JOIN_POINT_IN_POLYGON_LARGE_TEST_EXP join/quadtree_point_in_polygon_test_large.cu) +ConfigureTest(JOIN_POINT_IN_POLYGON_LARGE_TEST_EXP + join/quadtree_point_in_polygon_test_large.cu) -ConfigureTest(JOIN_POINT_IN_POLYGON_OOM_TEST_EXP join/quadtree_point_in_polygon_test_oom.cu) +ConfigureTest(JOIN_POINT_IN_POLYGON_OOM_TEST_EXP + join/quadtree_point_in_polygon_test_oom.cu) ConfigureTest(JOIN_POINT_TO_LINESTRING_SMALL_TEST_EXP - join/quadtree_point_to_nearest_linestring_test_small.cu) + join/quadtree_point_to_nearest_linestring_test_small.cu) # operators -ConfigureTest(OPERATOR_TEST_EXP operators/linestrings_test.cu) +ConfigureTest(OPERATOR_TEST_EXP + operators/linestrings_test.cu) # projection -ConfigureTest(SINUSOIDAL_PROJECTION_TEST_EXP projection/sinusoidal_projection_test.cu) +ConfigureTest(SINUSOIDAL_PROJECTION_TEST_EXP + projection/sinusoidal_projection_test.cu) # range -ConfigureTest(RANGE_TEST_EXP range/multipoint_range_test.cu range/multilinestring_range_test.cu - range/multipolygon_range_test.cu) +ConfigureTest(RANGE_TEST_EXP + range/multipoint_range_test.cu + range/multilinestring_range_test.cu + range/multipolygon_range_test.cu) # bounding boxes -ConfigureTest(POINT_BOUNDING_BOXES_TEST_EXP bounding_boxes/point_bounding_boxes_test.cu) +ConfigureTest(POINT_BOUNDING_BOXES_TEST_EXP + bounding_boxes/point_bounding_boxes_test.cu) -ConfigureTest(POLYGON_BOUNDING_BOXES_TEST_EXP bounding_boxes/polygon_bounding_boxes_test.cu) +ConfigureTest(POLYGON_BOUNDING_BOXES_TEST_EXP + bounding_boxes/polygon_bounding_boxes_test.cu) -ConfigureTest(LINESTRING_BOUNDING_BOXES_TEST_EXP bounding_boxes/linestring_bounding_boxes_test.cu) +ConfigureTest(LINESTRING_BOUNDING_BOXES_TEST_EXP + bounding_boxes/linestring_bounding_boxes_test.cu) # distance -ConfigureTest(HAUSDORFF_TEST_EXP distance/hausdorff_test.cu) +ConfigureTest(HAUSDORFF_TEST_EXP + distance/hausdorff_test.cu) -ConfigureTest(HAVERSINE_TEST_EXP distance/haversine_test.cu) +ConfigureTest(HAVERSINE_TEST_EXP + distance/haversine_test.cu) -ConfigureTest(POINT_DISTANCE_TEST_EXP distance/point_distance_test.cu) +ConfigureTest(POINT_DISTANCE_TEST_EXP + distance/point_distance_test.cu) -ConfigureTest(POINT_LINESTRING_DISTANCE_TEST_EXP distance/point_linestring_distance_test.cu) +ConfigureTest(POINT_LINESTRING_DISTANCE_TEST_EXP + distance/point_linestring_distance_test.cu) -ConfigureTest(POINT_POLYGON_DISTANCE_TEST_EXP distance/point_polygon_distance_test.cu) +ConfigureTest(POINT_POLYGON_DISTANCE_TEST_EXP + distance/point_polygon_distance_test.cu) -ConfigureTest(LINESTRING_POLYGON_DISTANCE_TEST_EXP distance/linestring_polygon_distance_test.cu) +ConfigureTest(LINESTRING_POLYGON_DISTANCE_TEST_EXP + distance/linestring_polygon_distance_test.cu) -ConfigureTest(LINESTRING_DISTANCE_TEST_EXP distance/linestring_distance_test.cu - distance/linestring_distance_test_medium.cu) +ConfigureTest(LINESTRING_DISTANCE_TEST_EXP + distance/linestring_distance_test.cu + distance/linestring_distance_test_medium.cu) -ConfigureTest(POLYGON_DISTANCE_TEST_EXP distance/polygon_distance_test.cu) +ConfigureTest(POLYGON_DISTANCE_TEST_EXP + distance/polygon_distance_test.cu) # equality ConfigureTest(PAIRWISE_MULTIPOINT_EQUALS_COUNT_TEST_EXP - equality/pairwise_multipoint_equals_count_test.cu) + equality/pairwise_multipoint_equals_count_test.cu) # intersection -ConfigureTest( - LINESTRING_INTERSECTION_TEST_EXP - intersection/linestring_intersection_count_test.cu - intersection/linestring_intersection_intermediates_remove_if_test.cu - intersection/linestring_intersection_with_duplicates_test.cu - intersection/linestring_intersection_test.cu - intersection/linestring_intersection_large_test.cu) +ConfigureTest(LINESTRING_INTERSECTION_TEST_EXP + intersection/linestring_intersection_count_test.cu + intersection/linestring_intersection_intermediates_remove_if_test.cu + intersection/linestring_intersection_with_duplicates_test.cu + intersection/linestring_intersection_test.cu + intersection/linestring_intersection_large_test.cu) # nearest points ConfigureTest(POINT_LINESTRING_NEAREST_POINT_TEST_EXP - nearest_points/point_linestring_nearest_points_test.cu) + nearest_points/point_linestring_nearest_points_test.cu) # point in polygon -ConfigureTest(POINT_IN_POLYGON_TEST_EXP point_in_polygon/point_in_polygon_test.cu) +ConfigureTest(POINT_IN_POLYGON_TEST_EXP + point_in_polygon/point_in_polygon_test.cu) -ConfigureTest(PAIRWISE_POINT_IN_POLYGON_TEST_EXP point_in_polygon/pairwise_point_in_polygon_test.cu) +ConfigureTest(PAIRWISE_POINT_IN_POLYGON_TEST_EXP + point_in_polygon/pairwise_point_in_polygon_test.cu) # points in range -ConfigureTest(POINTS_IN_RANGE_TEST_EXP points_in_range/points_in_range_test.cu) +ConfigureTest(POINTS_IN_RANGE_TEST_EXP + points_in_range/points_in_range_test.cu) # trajectory -ConfigureTest(DERIVE_TRAJECTORIES_TEST_EXP trajectory/derive_trajectories_test.cu) +ConfigureTest(DERIVE_TRAJECTORIES_TEST_EXP + trajectory/derive_trajectories_test.cu) ConfigureTest(TRAJECTORY_DISTANCES_AND_SPEEDS_TEST_EXP - trajectory/trajectory_distances_and_speeds_test.cu) + trajectory/trajectory_distances_and_speeds_test.cu) diff --git a/python/cuproj/CMakeLists.txt b/python/cuproj/CMakeLists.txt index bde4a1e00..2f7b743b0 100644 --- a/python/cuproj/CMakeLists.txt +++ b/python/cuproj/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================= -# Copyright (c) 2023-2025, NVIDIA CORPORATION. +# Copyright (c) 2023-2024, 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 @@ -23,8 +23,8 @@ project( VERSION "${RAPIDS_VERSION}" LANGUAGES CXX CUDA) -option(FIND_CUPROJ_CPP - "Search for existing cuproj C++ installations before defaulting to local files" OFF) +option(FIND_CUPROJ_CPP "Search for existing cuproj C++ installations before defaulting to local files" + OFF) # If the user requested it we attempt to find cuproj. if(FIND_CUPROJ_CPP) diff --git a/python/cuproj/cuproj/_lib/CMakeLists.txt b/python/cuproj/cuproj/_lib/CMakeLists.txt index fe232e96d..8302f303f 100644 --- a/python/cuproj/cuproj/_lib/CMakeLists.txt +++ b/python/cuproj/cuproj/_lib/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================= -# Copyright (c) 2023-2025, NVIDIA CORPORATION. +# Copyright (c) 2023, 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 @@ -12,7 +12,8 @@ # the License. # ============================================================================= -set(cython_sources transform.pyx) +set(cython_sources + transform.pyx) set(linked_libraries cuprojshim) @@ -20,4 +21,5 @@ rapids_cython_create_modules( CXX ASSOCIATED_TARGETS cuproj SOURCE_FILES "${cython_sources}" - LINKED_LIBRARIES "${linked_libraries}") + LINKED_LIBRARIES "${linked_libraries}" +) diff --git a/python/cuproj/cuproj/cuprojshim/CMakeLists.txt b/python/cuproj/cuproj/cuprojshim/CMakeLists.txt index c003546da..00769965f 100644 --- a/python/cuproj/cuproj/cuprojshim/CMakeLists.txt +++ b/python/cuproj/cuproj/cuprojshim/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================= -# Copyright (c) 2023-2025, NVIDIA CORPORATION. +# Copyright (c) 2023-2024, 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 @@ -27,6 +27,7 @@ project( VERSION "${RAPIDS_VERSION}" LANGUAGES CXX CUDA) + ################################################################################################### # - build options --------------------------------------------------------------------------------- @@ -34,24 +35,16 @@ option(USE_NVTX "Build with NVTX support" ON) option(PER_THREAD_DEFAULT_STREAM "Build with per-thread default stream" OFF) option(DISABLE_DEPRECATION_WARNING "Disable warnings generated from deprecated declarations." OFF) # Option to enable line info in CUDA device compilation to allow introspection when profiling / memchecking -option(CUDA_ENABLE_LINEINFO - "Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler" OFF) +option(CUDA_ENABLE_LINEINFO "Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler" OFF) # cudart can be statically linked or dynamically linked. The python ecosystem wants dynamic linking option(CUDA_STATIC_RUNTIME "Statically link the CUDA toolkit runtime and libraries" OFF) message(STATUS "CUPROJSHIM: Build with NVTX support: ${USE_NVTX}") message(STATUS "CUPROJSHIM: Build with per-thread default stream: ${PER_THREAD_DEFAULT_STREAM}") -message( - STATUS - "CUPROJSHIM: Disable warnings generated from deprecated declarations: ${DISABLE_DEPRECATION_WARNING}" -) -message( - STATUS - "CUPROJSHIM: Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler: ${CUDA_ENABLE_LINEINFO}" -) -message( - STATUS - "CUPROJSHIM: Statically link the CUDA toolkit runtime and libraries: ${CUDA_STATIC_RUNTIME}") +message(STATUS "CUPROJSHIM: Disable warnings generated from deprecated declarations: ${DISABLE_DEPRECATION_WARNING}") +message(STATUS "CUPROJSHIM: Enable the -lineinfo option for nvcc (useful for cuda-memcheck / profiler: ${CUDA_ENABLE_LINEINFO}") +message(STATUS "CUPROJSHIM: Statically link the CUDA toolkit runtime and libraries: ${CUDA_STATIC_RUNTIME}") + rapids_cmake_build_type("Release") @@ -61,11 +54,8 @@ set(CUPROJSHIM_CXX_DEFINITIONS "") set(CUPROJSHIM_CUDA_DEFINITIONS "") # Set RMM logging level -set(RMM_LOGGING_LEVEL - "INFO" - CACHE STRING "Choose the logging level.") -set_property(CACHE RMM_LOGGING_LEVEL PROPERTY STRINGS "TRACE" "DEBUG" "INFO" "WARN" "ERROR" - "CRITICAL" "OFF") +set(RMM_LOGGING_LEVEL "INFO" CACHE STRING "Choose the logging level.") +set_property(CACHE RMM_LOGGING_LEVEL PROPERTY STRINGS "TRACE" "DEBUG" "INFO" "WARN" "ERROR" "CRITICAL" "OFF") message(STATUS "CUPROJSHIM: RMM_LOGGING_LEVEL = '${RMM_LOGGING_LEVEL}'.") ################################################################################################### @@ -81,7 +71,8 @@ rapids_cuda_init_runtime(USE_STATIC ${CUDA_STATIC_RUNTIME}) rapids_find_package( CUDAToolkit REQUIRED BUILD_EXPORT_SET cuprojshim-exports - INSTALL_EXPORT_SET cuprojshim-exports) + INSTALL_EXPORT_SET cuprojshim-exports +) # * find CUDAToolkit package # * determine GPU architectures @@ -103,34 +94,36 @@ include(../../../../cpp/cuproj/cmake/thirdparty/get_rmm.cmake) add_library(cuprojshim STATIC src/cuprojshim.cu) -set_target_properties( - cuprojshim - 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 - POSITION_INDEPENDENT_CODE ON - INTERFACE_POSITION_INDEPENDENT_CODE ON) +set_target_properties(cuprojshim + 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 + POSITION_INDEPENDENT_CODE ON + INTERFACE_POSITION_INDEPENDENT_CODE ON +) # Use `CUPROJ_*_FLAGS` here because we reuse the cuProj's ConfigureCUDA.cmake above -target_compile_options(cuprojshim PRIVATE "$<$:${CUPROJ_CXX_FLAGS}>" - "$<$:${CUPROJ_CUDA_FLAGS}>") +target_compile_options(cuprojshim + PRIVATE "$<$:${CUPROJ_CXX_FLAGS}>" + "$<$:${CUPROJ_CUDA_FLAGS}>" +) # Use `CUPROJ_*_DEFINITIONS` here because we reuse the cuProj's ConfigureCUDA.cmake above -target_compile_definitions( - cuprojshim PUBLIC "$<$:${CUPROJ_CXX_DEFINITIONS}>" - "$<$:${CUPROJ_CUDA_DEFINITIONS}>") +target_compile_definitions(cuprojshim + PUBLIC "$<$:${CUPROJ_CXX_DEFINITIONS}>" + "$<$:${CUPROJ_CUDA_DEFINITIONS}>" +) # Specify include paths for the current target and dependents -target_include_directories( - cuprojshim - PUBLIC "$" - "$" - PRIVATE "$" - INTERFACE "$") +target_include_directories(cuprojshim + PUBLIC "$" + PUBLIC "$" + PRIVATE "$" + INTERFACE "$") # Add Conda library, and include paths if specified if(TARGET conda_env) @@ -146,17 +139,16 @@ endif() # Per-thread default stream if(PER_THREAD_DEFAULT_STREAM) - target_compile_definitions(cuprojshim PUBLIC CUDA_API_PER_THREAD_DEFAULT_STREAM) + target_compile_definitions(cuprojshim PUBLIC CUDA_API_PER_THREAD_DEFAULT_STREAM) endif() # Disable NVTX if necessary if(NOT USE_NVTX) - target_compile_definitions(cuprojshim PUBLIC NVTX_DISABLE) + target_compile_definitions(cuprojshim PUBLIC NVTX_DISABLE) endif() # Define spdlog level -target_compile_definitions(cuprojshim - PUBLIC "SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_${RMM_LOGGING_LEVEL}") +target_compile_definitions(cuprojshim PUBLIC "SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_${RMM_LOGGING_LEVEL}") target_link_libraries(cuprojshim PUBLIC cuproj::cuproj rmm::rmm) diff --git a/python/cuspatial/cuspatial/_lib/CMakeLists.txt b/python/cuspatial/cuspatial/_lib/CMakeLists.txt index 5a38a0b93..d3730c940 100644 --- a/python/cuspatial/cuspatial/_lib/CMakeLists.txt +++ b/python/cuspatial/cuspatial/_lib/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================= -# Copyright (c) 2022-2025, NVIDIA CORPORATION. +# Copyright (c) 2022-2023, 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 @@ -27,11 +27,13 @@ set(cython_sources spatial_join.pyx trajectory.pyx types.pyx - utils.pyx) + utils.pyx + ) set(linked_libraries cuspatial::cuspatial) rapids_cython_create_modules( CXX ASSOCIATED_TARGETS cuspatial SOURCE_FILES "${cython_sources}" - LINKED_LIBRARIES "${linked_libraries}") + LINKED_LIBRARIES "${linked_libraries}" +) diff --git a/python/libcuspatial/CMakeLists.txt b/python/libcuspatial/CMakeLists.txt index 9ece72e7e..86c3cd1ef 100644 --- a/python/libcuspatial/CMakeLists.txt +++ b/python/libcuspatial/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================= -# Copyright (c) 2024-2025, NVIDIA CORPORATION. +# Copyright (c) 2024, 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 @@ -19,7 +19,8 @@ include(../../rapids_config.cmake) project( libcuspatial-python VERSION "${RAPIDS_VERSION}" - LANGUAGES CXX) + LANGUAGES CXX +) # Check if cuspatial is already available. If so, it is the user's responsibility to ensure that the # CMake package is also available at build time of the Python cuspatial package. diff --git a/rapids_config.cmake b/rapids_config.cmake index ee0e68dd5..40207b870 100644 --- a/rapids_config.cmake +++ b/rapids_config.cmake @@ -1,5 +1,5 @@ # ============================================================================= -# Copyright (c) 2018-2025, NVIDIA CORPORATION. +# Copyright (c) 2018-2024, 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 @@ -22,13 +22,15 @@ else() string(REPLACE "\n" "\n " _rapids_version_formatted " ${_rapids_version}") message( FATAL_ERROR - "Could not determine RAPIDS version. Contents of VERSION file:\n${_rapids_version_formatted}") + "Could not determine RAPIDS version. Contents of VERSION file:\n${_rapids_version_formatted}" + ) endif() if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/CUSPATIAL_RAPIDS-${RAPIDS_VERSION_MAJOR_MINOR}.cmake") file( DOWNLOAD "https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-${RAPIDS_VERSION_MAJOR_MINOR}/RAPIDS.cmake" - "${CMAKE_CURRENT_BINARY_DIR}/CUSPATIAL_RAPIDS-${RAPIDS_VERSION_MAJOR_MINOR}.cmake") + "${CMAKE_CURRENT_BINARY_DIR}/CUSPATIAL_RAPIDS-${RAPIDS_VERSION_MAJOR_MINOR}.cmake" + ) endif() include("${CMAKE_CURRENT_BINARY_DIR}/CUSPATIAL_RAPIDS-${RAPIDS_VERSION_MAJOR_MINOR}.cmake") From 53aca17c4c6da43d916fdceb2109b940aeb7c9a1 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Fri, 24 Jan 2025 14:45:12 -0600 Subject: [PATCH 4/5] cut more style stuff --- cpp/scripts/run-cmake-format.sh | 83 ----------------- java/src/main/native/CMakeLists.txt | 133 +++++++++++++++------------- 2 files changed, 71 insertions(+), 145 deletions(-) delete mode 100755 cpp/scripts/run-cmake-format.sh diff --git a/cpp/scripts/run-cmake-format.sh b/cpp/scripts/run-cmake-format.sh deleted file mode 100755 index 676718c8a..000000000 --- a/cpp/scripts/run-cmake-format.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2022-2025, NVIDIA CORPORATION. - -# copied from: https://github.com/rapidsai/rapids-cmake/blob/branch-25.02/ci/checks/run-cmake-format.sh -# -# This script is a wrapper for cmakelang that may be used with pre-commit. The -# wrapping is necessary because RAPIDS libraries split configuration for -# cmakelang linters between a local config file and a second config file that's -# shared across all of RAPIDS via rapids-cmake. We need a way to invoke CMake linting commands -# without causing pre-commit failures (which could block local commits or CI), -# while also being sufficiently flexible to allow users to maintain the config -# file independently of a build directory. -# -# This script provides the minimal functionality to enable those use cases. It -# searches in a number of predefined locations for the rapids-cmake config file -# and exits gracefully if the file is not found. If a user wishes to specify a -# config file at a nonstandard location, they may do so by setting the -# environment variable RAPIDS_CMAKE_FORMAT_FILE. -# -# This script can be invoked directly anywhere within the project repository. -# Alternatively, it may be invoked as a pre-commit hook via -# `pre-commit run (cmake-format)|(cmake-lint)`. -# -# Usage: -# bash run-cmake-format.sh {cmake-format,cmake-lint} infile [infile ...] - -status=0 -if [ -z ${CUSPATIAL_ROOT:+PLACEHOLDER} ]; then - CUSPATIAL_BUILD_DIR=$(git rev-parse --show-toplevel 2>&1)/cpp/build - status=$? -else - CUSPATIAL_BUILD_DIR=${CUSPATIAL_ROOT} -fi - -if ! [ ${status} -eq 0 ]; then - if [[ ${CUSPATIAL_BUILD_DIR} == *"not a git repository"* ]]; then - echo "This script must be run inside the cuspatial repository, or the CUSPATIAL_ROOT environment variable must be set." - else - echo "Script failed with unknown error attempting to determine project root:" - echo ${CUSPATIAL_BUILD_DIR} - fi - exit 1 -fi - -DEFAULT_FORMAT_FILE_LOCATIONS=( - "${CUSPATIAL_BUILD_DIR:-${HOME}}/_deps/rapids-cmake-src/cmake-format-rapids-cmake.json" -) - -if [ -z ${RAPIDS_CMAKE_FORMAT_FILE:+PLACEHOLDER} ]; then - for file_path in ${DEFAULT_FORMAT_FILE_LOCATIONS[@]}; do - if [ -f ${file_path} ]; then - RAPIDS_CMAKE_FORMAT_FILE=${file_path} - break - fi - done -fi - -if [ -z ${RAPIDS_CMAKE_FORMAT_FILE:+PLACEHOLDER} ]; then - echo "The rapids-cmake cmake-format configuration file was not found at any of the default search locations: " - echo "" - ( IFS=$'\n'; echo "${DEFAULT_FORMAT_FILE_LOCATIONS[*]}" ) - echo "" - echo "Try setting the environment variable RAPIDS_CMAKE_FORMAT_FILE to the path to the config file." - exit 0 -else - echo "Using format file ${RAPIDS_CMAKE_FORMAT_FILE}" -fi - -if [[ $1 == "cmake-format" ]]; then - cmake-format -i --config-files cpp/cmake/config.json ${RAPIDS_CMAKE_FORMAT_FILE} -- ${@:2} -elif [[ $1 == "cmake-lint" ]]; then - # Since the pre-commit hook is verbose, we have to be careful to only - # present cmake-lint's output (which is quite verbose) if we actually - # observe a failure. - OUTPUT=$(cmake-lint --config-files cpp/cmake/config.json ${RAPIDS_CMAKE_FORMAT_FILE} -- ${@:2}) - status=$? - - if ! [ ${status} -eq 0 ]; then - echo "${OUTPUT}" - fi - exit ${status} -fi diff --git a/java/src/main/native/CMakeLists.txt b/java/src/main/native/CMakeLists.txt index 5afbd5c46..1fe48b8ab 100755 --- a/java/src/main/native/CMakeLists.txt +++ b/java/src/main/native/CMakeLists.txt @@ -1,5 +1,5 @@ #============================================================================= -# Copyright (c) 2019-2025, NVIDIA CORPORATION. +# Copyright (c) 2019-2024, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -21,10 +21,7 @@ include(../../../../rapids_config.cmake) # that just an oversight, or is there a reason not to include this here? rapids_cuda_init_architectures(CUSPATIAL_JNI) -project( - CUDF_JNI - VERSION 0.7.0 - LANGUAGES C CXX CUDA) +project(CUDF_JNI VERSION 0.7.0 LANGUAGES C CXX CUDA) ################################################################################################### # - build type ------------------------------------------------------------------------------------ @@ -44,45 +41,41 @@ set(CMAKE_CUDA_STANDARD 17) set(CMAKE_CUDA_STANDARD_REQUIRED ON) if(CMAKE_COMPILER_IS_GNUCXX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=deprecated-declarations") - - option(CMAKE_CXX11_ABI "Enable the GLIBCXX11 ABI" ON) - if(CMAKE_CXX11_ABI) - message(STATUS "CUDF: Enabling the GLIBCXX11 ABI") - else() - message(STATUS "CUDF: Disabling the GLIBCXX11 ABI") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0") - set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler -D_GLIBCXX_USE_CXX11_ABI=0") - endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=deprecated-declarations") + + option(CMAKE_CXX11_ABI "Enable the GLIBCXX11 ABI" ON) + if(CMAKE_CXX11_ABI) + message(STATUS "CUDF: Enabling the GLIBCXX11 ABI") + else() + message(STATUS "CUDF: Disabling the GLIBCXX11 ABI") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0") + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler -D_GLIBCXX_USE_CXX11_ABI=0") + endif() endif() #set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_61,code=sm_61") set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -gencode=arch=compute_60,code=sm_60") -set(CMAKE_CUDA_FLAGS - "${CMAKE_CUDA_FLAGS} -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_70,code=compute_70" -) +set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_70,code=compute_70") # set warnings as errors # TODO: remove `no-maybe-uninitialized` used to suppress warnings in rmm::exec_policy -set(CMAKE_CUDA_FLAGS - "${CMAKE_CUDA_FLAGS} -Werror cross-execution-space-call -Xcompiler -Wall,-Werror,-Wno-error=deprecated-declarations" -) +set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Werror cross-execution-space-call -Xcompiler -Wall,-Werror,-Wno-error=deprecated-declarations") # 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") +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() # Debug options if(CMAKE_BUILD_TYPE MATCHES Debug) - message(STATUS "Building with debugging flags") - set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G -Xcompiler -rdynamic") + message(STATUS "Building with debugging flags") + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -G -Xcompiler -rdynamic") endif() -option(BUILD_TESTS "Configure CMake to build tests" ON) +option(BUILD_TESTS "Configure CMake to build tests" + ON) ################################################################################################### # - cudart options -------------------------------------------------------------------------------- @@ -91,10 +84,10 @@ option(BUILD_TESTS "Configure CMake to build tests" ON) option(CUDA_STATIC_RUNTIME "Statically link the CUDA runtime" OFF) if(CUDA_STATIC_RUNTIME) - message(STATUS "Enabling static linking of cudart") - set(CUDART_LIBRARY "cudart_static") + message(STATUS "Enabling static linking of cudart") + set(CUDART_LIBRARY "cudart_static") else() - set(CUDART_LIBRARY "cudart") + set(CUDART_LIBRARY "cudart") endif() ################################################################################################### @@ -109,82 +102,98 @@ include(CheckLibraryExists) ################################################################################################### # - Thrust/CUB/libcudacxx ------------------------------------------------------------------------------------ -find_path(LIBCUDACXX_INCLUDE "simt" HINTS "$ENV{CONDA_PREFIX}/include/libcudf/libcudacxx" - "$ENV{CUDF_HOME}/cpp/build/_deps/libcudacxx-src/include") +find_path(LIBCUDACXX_INCLUDE "simt" + HINTS "$ENV{CONDA_PREFIX}/include/libcudf/libcudacxx" + "$ENV{CUDF_HOME}/cpp/build/_deps/libcudacxx-src/include") message(STATUS "CUDACXX: LIBCUDACXX_INCLUDE set to ${LIBCUDACXX_INCLUDE}") ################################################################################################### # - RMM ------------------------------------------------------------------------------------------- -find_path(RMM_INCLUDE "rmm" HINTS "$ENV{CONDA_PREFIX}/include" "$ENV{CONDA_PREFIX}/include/rmm" - "$ENV{RMM_HOME}/include") +find_path(RMM_INCLUDE "rmm" + HINTS "$ENV{CONDA_PREFIX}/include" + "$ENV{CONDA_PREFIX}/include/rmm" + "$ENV{RMM_HOME}/include") -find_library(RMM_LIBRARY "rmm" HINTS "$ENV{CONDA_PREFIX}/lib" "$ENV{RMM_HOME}/build") +find_library(RMM_LIBRARY "rmm" + HINTS "$ENV{CONDA_PREFIX}/lib" + "$ENV{RMM_HOME}/build") message(STATUS "RMM: RMM_INCLUDE set to ${RMM_INCLUDE}") message(STATUS "RMM: RMM_LIBRARY set to ${RMM_LIBRARY}") add_library(rmm SHARED IMPORTED ${RMM_LIBRARY}) -if(RMM_INCLUDE AND RMM_LIBRARY) - set_target_properties(rmm PROPERTIES IMPORTED_LOCATION ${RMM_LIBRARY}) -endif(RMM_INCLUDE AND RMM_LIBRARY) +if (RMM_INCLUDE AND RMM_LIBRARY) + set_target_properties(rmm PROPERTIES IMPORTED_LOCATION ${RMM_LIBRARY}) +endif (RMM_INCLUDE AND RMM_LIBRARY) ################################################################################################### # - CUDF ------------------------------------------------------------------------------------------ -set(CUDF_INCLUDE "$ENV{CONDA_PREFIX}/include" "$ENV{CUDF_HOME}/java/src/main/native/include") +set(CUDF_INCLUDE "$ENV{CONDA_PREFIX}/include" + "$ENV{CUDF_HOME}/java/src/main/native/include") -find_library(CUDF_LIBRARY "cudf" HINTS "$ENV{CONDA_PREFIX}/lib" "$ENV{CUDF_HOME}/cpp/build") +find_library(CUDF_LIBRARY "cudf" + HINTS "$ENV{CONDA_PREFIX}/lib" + "$ENV{CUDF_HOME}/cpp/build") message(STATUS "CUDF: CUDF_INCLUDE set to ${CUDF_INCLUDE}") message(STATUS "CUDF: CUDF_LIBRARY set to ${CUDF_LIBRARY}") add_library(cudf SHARED IMPORTED ${CUDF_LIBRARY}) -if(CUDF_INCLUDE AND CUDF_LIBRARY) - set_target_properties(cudf PROPERTIES IMPORTED_LOCATION ${CUDF_LIBRARY}) -endif(CUDF_INCLUDE AND CUDF_LIBRARY) +if (CUDF_INCLUDE AND CUDF_LIBRARY) + set_target_properties(cudf PROPERTIES IMPORTED_LOCATION ${CUDF_LIBRARY}) +endif (CUDF_INCLUDE AND CUDF_LIBRARY) ################################################################################################### # - CUSPATIAL ------------------------------------------------------------------------------------------ set(CUSPATIAL_INCLUDE "$ENV{CUSPATIAL_HOME}/cpp/include") -find_library(CUSPATIAL_LIBRARY "cuspatial" HINTS "$ENV{CUSPATIAL_HOME}/cpp/build") +find_library(CUSPATIAL_LIBRARY "cuspatial" + HINTS "$ENV{CUSPATIAL_HOME}/cpp/build") message(STATUS "CUSPATIAL: CUSPATIAL_INCLUDE set to ${CUSPATIAL_INCLUDE}") message(STATUS "CUSPATIAL: CUSPATIAL_LIBRARY set to ${CUSPATIAL_LIBRARY}") add_library(cuspatial SHARED IMPORTED ${CUSPATIAL_LIBRARY}) -if(CUSPATIAL_INCLUDE AND CUSPATIAL_LIBRARY) - set_target_properties(cuspatial PROPERTIES IMPORTED_LOCATION ${CUSPATIAL_LIBRARY}) -endif(CUSPATIAL_INCLUDE AND CUSPATIAL_LIBRARY) +if (CUSPATIAL_INCLUDE AND CUSPATIAL_LIBRARY) + set_target_properties(cuspatial PROPERTIES IMPORTED_LOCATION ${CUSPATIAL_LIBRARY}) +endif (CUSPATIAL_INCLUDE AND CUSPATIAL_LIBRARY) ################################################################################################### # - find JNI ------------------------------------------------------------------------------------- find_package(JNI REQUIRED) if(JNI_FOUND) - message(STATUS "JDK with JNI in ${JNI_INCLUDE_DIRS}") + message(STATUS "JDK with JNI in ${JNI_INCLUDE_DIRS}") else() - message(FATAL_ERROR "JDK with JNI not found, please check your settings.") + message(FATAL_ERROR "JDK with JNI not found, please check your settings.") endif() ################################################################################################### # - include paths --------------------------------------------------------------------------------- -include_directories( - "${CMAKE_SOURCE_DIR}/include" "${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}" "${LIBCUDACXX_INCLUDE}" - "${RMM_INCLUDE}" "${CUDF_INCLUDE}" "${CUSPATIAL_INCLUDE}" "${JNI_INCLUDE_DIRS}") +include_directories("${CMAKE_SOURCE_DIR}/include" + "${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}" + "${LIBCUDACXX_INCLUDE}" + "${RMM_INCLUDE}" + "${CUDF_INCLUDE}" + "${CUSPATIAL_INCLUDE}" + "${JNI_INCLUDE_DIRS}") ################################################################################################### # - library paths --------------------------------------------------------------------------------- -link_directories("${CMAKE_BINARY_DIR}/lib" "${CUSPATIAL_LIBRARY}") +link_directories("${CMAKE_BINARY_DIR}/lib" + "${CUSPATIAL_LIBRARY}") + ################################################################################################### # - library targets ------------------------------------------------------------------------------- -set(SOURCE_FILES "src/cuSpatialJni.cpp") +set(SOURCE_FILES + "src/cuSpatialJni.cpp") add_library(cuspatialjni SHARED ${SOURCE_FILES}) #Override RPATH for cuspatialjni @@ -195,16 +204,16 @@ SET_TARGET_PROPERTIES(cuspatialjni PROPERTIES BUILD_RPATH "\$ORIGIN") option(USE_NVTX "Build with NVTX support" ON) if(USE_NVTX) - message(STATUS "Using Nvidia Tools Extension") - find_library(NVTX_LIBRARY nvToolsExt PATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) - target_link_libraries(cuspatialjni ${NVTX_LIBRARY}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_NVTX") + message(STATUS "Using Nvidia Tools Extension") + find_library(NVTX_LIBRARY nvToolsExt PATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) + target_link_libraries(cuspatialjni ${NVTX_LIBRARY}) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_NVTX") endif() option(PER_THREAD_DEFAULT_STREAM "Build with per-thread default stream" OFF) if(PER_THREAD_DEFAULT_STREAM) - message(STATUS "Using per-thread default stream") - add_compile_definitions(CUDA_API_PER_THREAD_DEFAULT_STREAM) + message(STATUS "Using per-thread default stream") + add_compile_definitions(CUDA_API_PER_THREAD_DEFAULT_STREAM) endif() ################################################################################################### From 15470a94b1dbb0cf87d03a86f881ed8ed13b7132 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Fri, 24 Jan 2025 14:47:10 -0600 Subject: [PATCH 5/5] Update .github/workflows/build.yaml --- .github/workflows/build.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 505b4c888..c2e3c4c1b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -88,8 +88,6 @@ jobs: date: ${{ inputs.date }} package-name: libcuspatial package-type: cpp - # build for every combination of arch and CUDA version, but only for the latest Python - matrix_filter: group_by([.ARCH, (.CUDA_VER|split(".")|map(tonumber)|.[0])]) | map(max_by(.PY_VER|split(".")|map(tonumber))) wheel-build-cuspatial: needs: wheel-build-libcuspatial secrets: inherit