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
79 changes: 79 additions & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions c/sedona-libgpuspatial/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ which = "8.0"
arrow-array = { workspace = true, features = ["ffi"] }
arrow-schema = { workspace = true }
thiserror = { workspace = true }
geo = { workspace = true }
wkt = { workspace = true }
log = "0.4"
sedona-schema = { path = "../../rust/sedona-schema" }
nvml-wrapper = "0.10.0"

[dev-dependencies]
sedona-expr = { path = "../../rust/sedona-expr" }
Expand Down
18 changes: 18 additions & 0 deletions c/sedona-libgpuspatial/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ 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
Expand Down Expand Up @@ -157,6 +164,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,10 @@ function(find_and_configure_nanoarrow)
"NANOARROW_NAMESPACE gpuspatial"
${_exclude_from_all})
set_target_properties(nanoarrow PROPERTIES POSITION_INDEPENDENT_CODE ON)
if(TARGET nanoarrow_ipc) # Tests need this
target_compile_options(nanoarrow_ipc PRIVATE -Wno-conversion)
endif()
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
Loading
Loading