Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions c/sedona-libgpuspatial/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,3 @@ gpu = []
bindgen = "0.72.1"
cmake = "0.1"
which = "8.0"

[dependencies]
arrow-array = { workspace = true, features = ["ffi"] }
arrow-schema = { workspace = true }
thiserror = { workspace = true }
log = "0.4"
sedona-schema = { path = "../../rust/sedona-schema" }

[dev-dependencies]
sedona-expr = { path = "../../rust/sedona-expr" }
sedona-geos = { path = "../sedona-geos" }
sedona-testing = { path = "../../rust/sedona-testing" }
19 changes: 19 additions & 0 deletions c/sedona-libgpuspatial/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,18 @@ fn main() {
println!("cargo:warning=CMAKE_CUDA_ARCHITECTURES environment variable not set. Defaulting to '86;89'.");
"86;89".to_string()
});
// Determine the build profile to match Cargo's debug/release mode
let profile_mode = if cfg!(debug_assertions) {
"Debug"
} else {
"Release"
};

let dst = cmake::Config::new("./libgpuspatial")
.define("CMAKE_CUDA_ARCHITECTURES", cuda_architectures)
.define("CMAKE_POLICY_VERSION_MINIMUM", "3.5") // Allow older CMake versions
.define("LIBGPUSPATIAL_LOGGING_LEVEL", "WARN") // Set logging level
.define("SPDLOG_FMT_EXTERNAL", "OFF") // Prevent spdlog from using external fmt library
.build();
let include_path = dst.join("include");
println!(
Expand Down Expand Up @@ -157,6 +165,17 @@ fn main() {
println!("cargo:rustc-link-lib=static=gpuspatial");
println!("cargo:rustc-link-lib=static=rmm");
println!("cargo:rustc-link-lib=static=rapids_logger");
// Use the 'd' suffix for the debug build of spdlog (libspdlogd.a)
let spdlog_lib_name = if cfg!(debug_assertions) {
"spdlogd"
} else {
"spdlog"
};
println!(
"cargo:warning=Linking spdlog in {} mode: lib{}.a",
profile_mode, spdlog_lib_name
);
println!("cargo:rustc-link-lib=static={}", spdlog_lib_name);
println!("cargo:rustc-link-lib=static=geoarrow");
println!("cargo:rustc-link-lib=static=nanoarrow");
println!("cargo:rustc-link-lib=stdc++");
Expand Down
12 changes: 8 additions & 4 deletions c/sedona-libgpuspatial/libgpuspatial/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,13 @@ config_shaders(PTX_FILES)

message("-- Config shader PTX files ${PTX_FILES}")

add_library(gpuspatial src/rt/rt_engine.cpp src/relate_engine.cu src/spatial_joiner.cu
${PTX_FILES})
add_library(gpuspatial
src/rt/rt_engine.cpp
src/memory_manager.cc
src/relate_engine.cu
src/rt_spatial_index.cu
src/rt_spatial_refiner.cu
${PTX_FILES})

# Link libraries
target_link_libraries(gpuspatial
Expand All @@ -142,8 +147,7 @@ target_link_libraries(gpuspatial
cuda
rmm::rmm
rapids_logger::rapids_logger
OptiX
PRIVATE zstd)
OptiX)

# Set include directories
target_include_directories(gpuspatial
Expand Down
2 changes: 1 addition & 1 deletion c/sedona-libgpuspatial/libgpuspatial/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"name": "default",
"configurePreset": "default-with-tests",
"environment": {
"GPUSPATIAL_TEST_DIR": "${sourceDir}/test_data"
"GPUSPATIAL_TEST_DIR": "${sourceDir}/test/data"
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function(find_and_configure_geoarrow)
"BUILD_SHARED_LIBS OFF"
${_exclude_from_all})
set_target_properties(geoarrow PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_compile_options(geoarrow PRIVATE -Wno-conversion)
rapids_export_find_package_root(BUILD
geoarrow
"${geoarrow_BINARY_DIR}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function(find_and_configure_nanoarrow)
"NANOARROW_NAMESPACE gpuspatial"
${_exclude_from_all})
set_target_properties(nanoarrow PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_compile_options(nanoarrow PRIVATE -Wno-conversion)
rapids_export_find_package_root(BUILD
nanoarrow
"${nanoarrow_BINARY_DIR}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
// under the License.
#pragma once

#include "gpuspatial/utils/array_view.h"
#include "gpuspatial/utils/cuda_utils.h"
#include "gpuspatial/utils/helpers.h"
#include "gpuspatial/utils/array_view.hpp"
#include "gpuspatial/utils/cuda_utils.hpp"
#include "gpuspatial/utils/helpers.cuh"

#include <optix_types.h>

Expand Down Expand Up @@ -86,22 +86,26 @@ class Box {
}

DEV_HOST_INLINE OptixAabb ToOptixAabb() const {
OptixAabb aabb;
OptixAabb aabb{0, 0, 0, 0, 0, 0};

memset(&aabb, 0, sizeof(OptixAabb));
if (sizeof(scalar_t) == sizeof(float)) {
if constexpr (sizeof(scalar_t) == sizeof(float)) {
for (int dim = 0; dim < n_dim; dim++) {
reinterpret_cast<float*>(&aabb.minX)[dim] = min_.get_coordinate(dim);
reinterpret_cast<float*>(&aabb.maxX)[dim] = max_.get_coordinate(dim);
auto min_val = min_.get_coordinate(dim);
auto max_val = max_.get_coordinate(dim);
if (min_val == max_val) {
min_val = next_float_from_double(min_val, -1, 2);
max_val = next_float_from_double(max_val, 1, 2);
}
(&aabb.minX)[dim] = min_val;
(&aabb.maxX)[dim] = max_val;
}
} else {
for (int dim = 0; dim < n_dim; dim++) {
auto min_val = min_.get_coordinate(dim);
auto max_val = max_.get_coordinate(dim);

reinterpret_cast<float*>(&aabb.minX)[dim] =
next_float_from_double(min_val, -1, 2);
reinterpret_cast<float*>(&aabb.maxX)[dim] = next_float_from_double(max_val, 1, 2);
(&aabb.minX)[dim] = next_float_from_double(min_val, -1, 2);
(&aabb.maxX)[dim] = next_float_from_double(max_val, 1, 2);
}
}
return aabb;
Expand Down Expand Up @@ -137,6 +141,8 @@ class Box {

DEV_HOST_INLINE scalar_t get_min(int dim) const { return min_.get_coordinate(dim); }

DEV_HOST_INLINE bool valid() const { return !min_.empty() && !max_.empty(); }

DEV_HOST_INLINE const point_t& get_max() const { return max_; }

DEV_HOST_INLINE scalar_t get_max(int dim) const { return max_.get_coordinate(dim); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
// specific language governing permissions and limitations
// under the License.
#pragma once
#include "gpuspatial/geom/box.cuh"
#include "gpuspatial/geom/geometry_type.cuh"
#include "gpuspatial/geom/line_string.cuh"
#include "gpuspatial/geom/multi_line_string.cuh"
#include "gpuspatial/geom/multi_point.cuh"
#include "gpuspatial/geom/multi_polygon.cuh"
#include "gpuspatial/geom/point.cuh"
#include "gpuspatial/geom/polygon.cuh"
#include "gpuspatial/utils/array_view.h"
#include "gpuspatial/geom/box.hpp"
#include "gpuspatial/geom/geometry_type.hpp"
#include "gpuspatial/geom/line_string.hpp"
#include "gpuspatial/geom/multi_line_string.hpp"
#include "gpuspatial/geom/multi_point.hpp"
#include "gpuspatial/geom/multi_polygon.hpp"
#include "gpuspatial/geom/point.hpp"
#include "gpuspatial/geom/polygon.hpp"
#include "gpuspatial/utils/array_view.hpp"

namespace gpuspatial {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
// specific language governing permissions and limitations
// under the License.
#pragma once
#include "gpuspatial/geom/box.cuh"
#include "gpuspatial/geom/point.cuh"
#include "gpuspatial/utils/cuda_utils.h"
#include "gpuspatial/utils/floating_point.h"
#include "gpuspatial/geom/box.hpp"
#include "gpuspatial/geom/point.hpp"
#include "gpuspatial/utils/cuda_utils.hpp"
#include "gpuspatial/utils/floating_point.hpp"

namespace gpuspatial {
template <typename POINT_T>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
// specific language governing permissions and limitations
// under the License.
#pragma once
#include "gpuspatial/geom/line_segment.cuh"
#include "gpuspatial/utils/array_view.h"
#include "gpuspatial/utils/cuda_utils.h"
#include "gpuspatial/geom/line_segment.hpp"
#include "gpuspatial/utils/array_view.hpp"
#include "gpuspatial/utils/cuda_utils.hpp"

namespace gpuspatial {
template <typename POINT_T>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
// specific language governing permissions and limitations
// under the License.
#pragma once
#include "gpuspatial/geom/line_string.cuh"
#include "gpuspatial/utils/array_view.h"
#include "gpuspatial/utils/cuda_utils.h"
#include "gpuspatial/geom/line_string.hpp"
#include "gpuspatial/utils/array_view.hpp"
#include "gpuspatial/utils/cuda_utils.hpp"

namespace gpuspatial {
template <typename POINT_T, typename INDEX_T>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
// specific language governing permissions and limitations
// under the License.
#pragma once
#include "gpuspatial/geom/box.cuh"
#include "gpuspatial/utils/array_view.h"
#include "gpuspatial/utils/cuda_utils.h"
#include "gpuspatial/geom/box.hpp"
#include "gpuspatial/utils/array_view.hpp"
#include "gpuspatial/utils/cuda_utils.hpp"

namespace gpuspatial {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.
#pragma once
#include "gpuspatial/geom/polygon.cuh"
#include "gpuspatial/geom/polygon.hpp"

namespace gpuspatial {
template <typename POINT_T, typename INDEX_T>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
// specific language governing permissions and limitations
// under the License.
#pragma once
#include "gpuspatial/geom/box.cuh"
#include "gpuspatial/utils/array_view.h"
#include "gpuspatial/utils/cuda_utils.h"
#include "gpuspatial/utils/floating_point.h"
#include "gpuspatial/utils/type_traits.h"
#include "gpuspatial/geom/box.hpp"
#include "gpuspatial/utils/array_view.hpp"
#include "gpuspatial/utils/cuda_utils.hpp"
#include "gpuspatial/utils/floating_point.hpp"
#include "gpuspatial/utils/type_traits.hpp"

namespace gpuspatial {
enum class PointLocation {
Expand Down Expand Up @@ -73,7 +73,14 @@ class Point {

DEV_HOST_INLINE const scalar_t* get_data() const { return &data_.x; }

DEV_HOST_INLINE bool empty() const { return std::isnan(data_.x); }
DEV_HOST_INLINE bool empty() const {
for (int dim = 0; dim < n_dim; dim++) {
if (std::isnan(get_coordinate(dim))) {
return true;
}
}
return false;
}

DEV_HOST_INLINE void set_empty() {
for (int dim = 0; dim < n_dim; dim++) {
Expand Down Expand Up @@ -102,11 +109,7 @@ class Point {
* @brief Provides const access to the x-coordinate.
* This method is only available if N_DIM >= 1.
*/
DEV_HOST_INLINE const scalar_t& x() const {
if constexpr (N_DIM >= 1) {
return data_.x;
}
}
DEV_HOST_INLINE const scalar_t& x() const { return data_.x; }

/**
* @brief Provides access to the y-coordinate.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
// under the License.
#pragma once

#include "gpuspatial/geom/box.cuh"
#include "gpuspatial/geom/line_string.cuh"
#include "gpuspatial/utils/array_view.h"
#include "gpuspatial/utils/cuda_utils.h"
#include "gpuspatial/utils/floating_point.h"
#include "gpuspatial/geom/box.hpp"
#include "gpuspatial/geom/line_string.hpp"
#include "gpuspatial/utils/array_view.hpp"
#include "gpuspatial/utils/cuda_utils.hpp"
#include "gpuspatial/utils/floating_point.hpp"

#include <cub/block/block_reduce.cuh>
#include <cub/warp/warp_reduce.cuh>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
// specific language governing permissions and limitations
// under the License.
#pragma once
#include "gpuspatial/geom/point.cuh"
#include "gpuspatial/utils/cuda_utils.h"
#include "gpuspatial/utils/doubledouble.h"
#include "gpuspatial/geom/point.hpp"
#include "gpuspatial/utils/cuda_utils.hpp"
#include "gpuspatial/utils/doubledouble.hpp"

namespace gpuspatial {

Expand Down
Loading