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
6 changes: 3 additions & 3 deletions .github/workflows/pr-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
runs-on: [gpu]
timeout-minutes: 120
env:
EXTRA_CMAKE_ARGS: "-DCMAKE_CUDA_ARCHITECTURES=native"
EXTRA_CMAKE_ARGS: "-DCMAKE_CUDA_ARCHITECTURES=native -DCUVSLAM_BUILD_CUNLS_TESTS=ON"
steps:
- name: Verify GPU
run: nvidia-smi
Expand Down Expand Up @@ -254,7 +254,7 @@ jobs:
env:
BASE_IMAGE: "nvcr.io/nvidia/12.6.11-devel:12.6.11-devel-aarch64-ubuntu22.04"
UBUNTU_VERSION: "22.04"
EXTRA_CMAKE_ARGS: "-DCMAKE_CUDA_ARCHITECTURES=87"
EXTRA_CMAKE_ARGS: "-DCMAKE_CUDA_ARCHITECTURES=87 -DCUVSLAM_BUILD_CUNLS_TESTS=ON"
steps:
- name: System info
run: |
Expand Down Expand Up @@ -331,7 +331,7 @@ jobs:
env:
CUDA_VERSION: "13.0.1"
UBUNTU_VERSION: "24.04"
EXTRA_CMAKE_ARGS: "-DCMAKE_CUDA_ARCHITECTURES=110"
EXTRA_CMAKE_ARGS: "-DCMAKE_CUDA_ARCHITECTURES=110 -DCUVSLAM_BUILD_CUNLS_TESTS=ON"
steps:
- name: System info
run: |
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ set(CUDAToolkit_ROOT /usr/local/cuda CACHE PATH "Path to installed CUDA toolkit"
set(CMAKE_CUDA_COMPILER ${CUDAToolkit_ROOT}/bin/nvcc CACHE PATH "Path to installed CUDA compiler")

option(USE_CUNLS "Build with cunls support." ON)
option(CUVSLAM_BUILD_CUNLS_TESTS "Build upstream cuNLS tests." OFF)
option(USE_CERES "Build with ceres support." OFF)
option(USE_NVTX "Build with nvtx tracing support." OFF)
option(USE_SLAM_OUTPUT "Build with option to enable debug output of SLAM" OFF)
Expand Down
45 changes: 40 additions & 5 deletions cmake/ext/cunls.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,16 @@ if(CUDAToolkit_VERSION VERSION_LESS "12.6")
"Either install CUDA 12.6+ or set -DUSE_CUNLS=OFF.")
endif()

set(CUNLS_VERSION "Release_07_13_2026")
set(CUNLS_VERSION "a4f7d645788b3d20a5850f2328d0caa32ef8cd7e")

# Keep cuNLS's own tests and Python bindings out of this build.
set(BUILD_TESTING OFF)
# Control cuNLS's generic BUILD_TESTING option without changing it for the rest of cuVSLAM.
if(DEFINED BUILD_TESTING)
set(_CUVSLAM_BUILD_TESTING_WAS_DEFINED TRUE)
set(_CUVSLAM_SAVED_BUILD_TESTING "${BUILD_TESTING}")
else()
set(_CUVSLAM_BUILD_TESTING_WAS_DEFINED FALSE)
endif()
set(BUILD_TESTING "${CUVSLAM_BUILD_CUNLS_TESTS}")
set(BUILD_PYTHON_BINDINGS OFF)

# cuNLS declares cmake_minimum_required(VERSION 3.24), but the Ubuntu 22.04 base images used for
Expand All @@ -47,12 +53,41 @@ set(BUILD_PYTHON_BINDINGS OFF)
# On cmake >= 3.24 its absence only triggers a harmless one-time CMP0135 dev warning.
FetchContent_Declare(
cunls
URL https://github.com/nvidia-isaac/cuNLS/archive/refs/tags/${CUNLS_VERSION}.tar.gz
URL_HASH SHA256=23b2917ae3903e6a688edb1652e40202d314527cd7fa9db68c762f0429375f77
GIT_REPOSITORY https://github.com/nvidia-isaac/cuNLS.git
GIT_TAG ${CUNLS_VERSION}
PATCH_COMMAND sed -i "s/cmake_minimum_required(VERSION 3.24)/cmake_minimum_required(VERSION 3.22)/" CMakeLists.txt
)
FetchContent_MakeAvailable(cunls)

if(_CUVSLAM_BUILD_TESTING_WAS_DEFINED)
set(BUILD_TESTING "${_CUVSLAM_SAVED_BUILD_TESTING}")
else()
unset(BUILD_TESTING)
endif()
unset(_CUVSLAM_BUILD_TESTING_WAS_DEFINED)
unset(_CUVSLAM_SAVED_BUILD_TESTING)

if(CUVSLAM_BUILD_CUNLS_TESTS)
if(NOT TARGET nls_tests)
message(FATAL_ERROR "cuNLS tests were requested, but the 'nls_tests' target was not created")
endif()

# The x86 cuDSS static archive bundled into libcunls.a contains a main.o. Ensure GoogleTest's
# main is resolved first; otherwise the linker silently selects cuDSS's main and discovers zero tests.
get_target_property(_CUVSLAM_CUNLS_TEST_LIBRARIES nls_tests LINK_LIBRARIES)
list(REMOVE_ITEM _CUVSLAM_CUNLS_TEST_LIBRARIES GTest::gtest_main)
list(PREPEND _CUVSLAM_CUNLS_TEST_LIBRARIES GTest::gtest_main)
set_property(TARGET nls_tests PROPERTY LINK_LIBRARIES "${_CUVSLAM_CUNLS_TEST_LIBRARIES}")
unset(_CUVSLAM_CUNLS_TEST_LIBRARIES)

# cuNLS derives its test-data path from CMAKE_SOURCE_DIR, which points at cuVSLAM when embedded.
get_target_property(_CUVSLAM_CUNLS_TEST_DEFINITIONS nls_tests COMPILE_DEFINITIONS)
list(FILTER _CUVSLAM_CUNLS_TEST_DEFINITIONS EXCLUDE REGEX "^CUNLS_TEST_DATA_DIR=")
list(APPEND _CUVSLAM_CUNLS_TEST_DEFINITIONS "CUNLS_TEST_DATA_DIR=\"${cunls_SOURCE_DIR}/tests/data\"")
set_property(TARGET nls_tests PROPERTY COMPILE_DEFINITIONS "${_CUVSLAM_CUNLS_TEST_DEFINITIONS}")
unset(_CUVSLAM_CUNLS_TEST_DEFINITIONS)
endif()

if(NOT TARGET cunls)
message(FATAL_ERROR "cuNLS source build did not define the 'cunls' target")
endif()
Expand Down
Loading