Skip to content

added build support on Ampere - #2267

Open
kmuseth wants to merge 2 commits into
AcademySoftwareFoundation:masterfrom
kmuseth:build_nanovdb_examples_on_Ampere
Open

added build support on Ampere#2267
kmuseth wants to merge 2 commits into
AcademySoftwareFoundation:masterfrom
kmuseth:build_nanovdb_examples_on_Ampere

Conversation

@kmuseth

@kmuseth kmuseth commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

ex_make_mgpu_nanovdb uses TF32 WMMA which requires SM_80+ (Ampere or newer)

changed cmake to address this issue

Signed-off-by: Ken Museth <ken.museth@gmail.com>
target_link_libraries(ex_make_mgpu_nanovdb PRIVATE CUDA::curand)
# ex_make_mgpu_nanovdb uses TF32 WMMA which requires SM_80+ (Ampere or newer)
execute_process(
COMMAND bash -c "nvidia-smi --query-gpu=compute_cap --format=csv,noheader 2>/dev/null | sort -n | tail -1 | tr -d '.'"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if you're building on a machine that doesn't have a GPU and going to run it on an SM >=8.0 machine? Or are we assuming all examples are built/run on the same machine and/or they're not used as CI tests (which might have this behaviour)?

target_link_libraries(ex_make_mgpu_nanovdb PRIVATE CUDA::curand)
# ex_make_mgpu_nanovdb uses TF32 WMMA which requires SM_80+ (Ampere or newer)
execute_process(
COMMAND bash -c "nvidia-smi --query-gpu=compute_cap --format=csv,noheader 2>/dev/null | sort -n | tail -1 | tr -d '.'"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Windows, assuming availability of bash is a hard requirement. Can we rely on something like CMAKE_CUDA_ARCHITECTURES (see, e.g. this) instead of probing the local machine with bash and nvidia-smi?

@apradhana apradhana Aug 5, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I asked Codex to scan CMAKE_CUDA_ARCHITECTURES and only add target if at least one architecture is >=80

if(CUDAToolkit_FOUND)
  set(_nanovdb_has_sm80 OFF)

  foreach(_cuda_arch IN LISTS CMAKE_CUDA_ARCHITECTURES)
    string(REGEX MATCH "^[0-9]+" _cuda_arch_number "${_cuda_arch}")
    if(_cuda_arch_number GREATER_EQUAL 80)
      set(_nanovdb_has_sm80 ON)
    endif()
  endforeach()

  if(_nanovdb_has_sm80)
    nanovdb_example(NAME "ex_make_mgpu_nanovdb") # requires cuRAND and SM_80+ (TF32 WMMA)
    target_link_libraries(ex_make_mgpu_nanovdb PRIVATE CUDA::curand)
  else()
    message(STATUS "Skipping ex_make_mgpu_nanovdb: requires CUDA architecture 80 or newer")
  endif()

  unset(_nanovdb_has_sm80)
  unset(_cuda_arch_number)
  unset(_cuda_arch)
endif()

@swahtz swahtz added the nanovdb label Aug 5, 2026
The unit test provides its own main() and uses only gtest (no gmock), so it
needs just GTest::gtest. Listing gmock / gtest_main / gmock_main as well pulled
libgtest.a and libgmock.a onto the link line multiple times, which the macOS
(Xcode 15+) linker flags as "ignoring duplicate libraries". Linking only
GTest::gtest removes the warning and also works against gtest-only GoogleTest
installs (BUILD_GMOCK=OFF).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants