Skip to content

Commit

Permalink
revert all the style-related changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslamb committed Jan 24, 2025
1 parent 17be32f commit e7865f3
Show file tree
Hide file tree
Showing 17 changed files with 549 additions and 539 deletions.
27 changes: 1 addition & 26 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 2 additions & 4 deletions ci/check_style.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2020-2025, NVIDIA CORPORATION.
# Copyright (c) 2020-2024, NVIDIA CORPORATION.

set -euo pipefail

Expand All @@ -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}
Expand Down
221 changes: 107 additions & 114 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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.
Expand All @@ -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)

Expand All @@ -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")
Expand All @@ -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}'.")

###################################################################################################
Expand All @@ -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
Expand All @@ -120,74 +106,76 @@ 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 -------------------------------------------------------------------------------

# 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 "$<$<COMPILE_LANGUAGE:CXX>:${CUSPATIAL_CXX_FLAGS}>"
"$<$<COMPILE_LANGUAGE:CUDA>:${CUSPATIAL_CUDA_FLAGS}>")

target_compile_definitions(
cuspatial PUBLIC "$<$<COMPILE_LANGUAGE:CXX>:${CUSPATIAL_CXX_DEFINITIONS}>"
"$<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:CUDA>:${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 "$<$<COMPILE_LANGUAGE:CXX>:${CUSPATIAL_CXX_FLAGS}>"
"$<$<COMPILE_LANGUAGE:CUDA>:${CUSPATIAL_CUDA_FLAGS}>"
)

target_compile_definitions(cuspatial
PUBLIC "$<$<COMPILE_LANGUAGE:CXX>:${CUSPATIAL_CXX_DEFINITIONS}>"
"$<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:CUDA>:${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 "$<BUILD_INTERFACE:${CUSPATIAL_SOURCE_DIR}/include>"
PRIVATE "$<BUILD_INTERFACE:${CUSPATIAL_SOURCE_DIR}/src>"
INTERFACE "$<INSTALL_INTERFACE:include>")
target_include_directories(cuspatial
PUBLIC "$<BUILD_INTERFACE:${CUSPATIAL_SOURCE_DIR}/include>"
PRIVATE "$<BUILD_INTERFACE:${CUSPATIAL_SOURCE_DIR}/src>"
INTERFACE "$<INSTALL_INTERFACE:include>")

# Add Conda library, and include paths if specified
if(TARGET conda_env)
Expand All @@ -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
Expand All @@ -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()

###################################################################################################
Expand All @@ -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
[=[
Expand All @@ -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 -------------------------------------------------------------------------------
Expand All @@ -291,7 +282,9 @@ rapids_export(
EXPORT_SET cuspatial-exports
GLOBAL_TARGETS cuspatial
NAMESPACE cuspatial::
DOCUMENTATION doc_string)
DOCUMENTATION doc_string
)


# ##################################################################################################
# * build documentation ----------------------------------------------------------------------------
Expand All @@ -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()
Loading

0 comments on commit e7865f3

Please sign in to comment.