Skip to content

Commit

Permalink
Fix for CUDA ARCH case with no GPU
Browse files Browse the repository at this point in the history
  • Loading branch information
ssheorey committed Aug 6, 2024
1 parent eeca250 commit a57c6f6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 0 additions & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ jobs:
CUDA_VERSION: 11.0.3
env:
BUILD_WEBRTC: ${{ ( matrix.BUILD_SHARED_LIBS == 'OFF' && matrix.STATIC_RUNTIME == 'ON' ) && 'ON' || 'OFF' }}
CUDAARCHS: 75 # Turing, oldest supported CUDA arch for CUDA v12. Required if no CUDA GPU on build machine.

steps:
- name: Disk space used
Expand Down
12 changes: 9 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ cmake_language(EVAL CODE "cmake_language(DEFER CALL open3d_patch_findthreads_mod
if(BUILD_CUDA_MODULE)
if(BUILD_COMMON_CUDA_ARCHS)
if (CMAKE_CUDA_ARCHITECTURES)
message(STATUS "Building with user-provided architectures.")
message(STATUS "Building with user-provided architectures: ${CMAKE_CUDA_ARCHITECTURES}")
else()
# Build with all supported architectures for previous 2 generations and
# M0 (minor=0) architectures for previous generations (including
Expand All @@ -424,11 +424,17 @@ if(BUILD_CUDA_MODULE)
else()
set(CMAKE_CUDA_ARCHITECTURES 30-real 50-real 60-real 70-real 75) # Kepler, Maxwell, Pascal, Turing
endif()
message(STATUS "Using CUDA architectures: ${CMAKE_CUDA_ARCHITECTURES}")
endif()
else()
set(CMAKE_CUDA_ARCHITECTURES native)
execute_process(COMMAND nvidia-smi RESULT_VARIABLE HAVE_NVIDIA_GPU)
if (HAVE_NVIDIA_GPU)
message(STATUS "Building with native CUDA architecture.")
set(CMAKE_CUDA_ARCHITECTURES native)
else()
message(WARNING "No CUDA GPU detected. Building with default CUDA architecture.")
endif()
endif()
message(STATUS "Using CUDA architectures: ${CMAKE_CUDA_ARCHITECTURES}")
enable_language(CUDA)
if (CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA" AND CMAKE_CUDA_COMPILER_VERSION VERSION_LESS "10.1")
message(FATAL_ERROR "CUDA 10.0 and older are not supported. Please upgrade to CUDA 10.1 or newer.")
Expand Down

0 comments on commit a57c6f6

Please sign in to comment.