Skip to content

Commit

Permalink
Fix specifying GPU architecture in JNI build (#7612)
Browse files Browse the repository at this point in the history
After #7593 the variables for controlling the CUDA build for either all architectures or detected architectures changed to be based on the project name which broke the JNI build.  This updates the JNI CMakeList accordingly to fix the JNI build.

Authors:
  - Jason Lowe (@jlowe)

Approvers:
  - Rong Ou (@rongou)
  - Gera Shegalov (@gerashegalov)
  - Thomas Graves (@tgravescs)

URL: #7612
  • Loading branch information
jlowe authored Mar 16, 2021
1 parent 2f5901f commit c1c60ba
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions java/src/main/native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ cmake_minimum_required(VERSION 3.18 FATAL_ERROR)

# Use GPU_ARCHS if it is defined
if(DEFINED GPU_ARCHS)
unset(CMAKE_CUDA_ARCHITECTURES CACHE)
if(NOT "${GPU_ARCHS}" STREQUAL "ALL")
set(CMAKE_CUDA_ARCHITECTURES "${GPU_ARCHS}")
endif()
set(CMAKE_CUDA_ARCHITECTURES "${GPU_ARCHS}")
endif()

# If `CMAKE_CUDA_ARCHITECTURES` is not defined, build for all supported architectures. If
Expand All @@ -29,11 +26,10 @@ endif()

# This needs to be run before enabling the CUDA language due to the default initialization behavior
# of `CMAKE_CUDA_ARCHITECTURES`, https://gitlab.kitware.com/cmake/cmake/-/issues/21302
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
set(CUDF_BUILD_FOR_ALL_ARCHS TRUE)
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES OR CMAKE_CUDA_ARCHITECTURES STREQUAL "ALL")
set(CUDF_JNI_BUILD_FOR_ALL_ARCHS TRUE)
elseif(CMAKE_CUDA_ARCHITECTURES STREQUAL "")
unset(CMAKE_CUDA_ARCHITECTURES CACHE)
set(CUDF_BUILD_FOR_DETECTED_ARCHS TRUE)
set(CUDF_JNI_BUILD_FOR_DETECTED_ARCHS TRUE)
endif()

project(CUDF_JNI VERSION 0.19 LANGUAGES C CXX)
Expand Down

0 comments on commit c1c60ba

Please sign in to comment.