Skip to content

Commit

Permalink
Use new morpheus_utils_enable_cuda method
Browse files Browse the repository at this point in the history
  • Loading branch information
dagardner-nv committed Jan 18, 2024
1 parent 1ee0b45 commit 6f94942
Showing 1 changed file with 5 additions and 32 deletions.
37 changes: 5 additions & 32 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,46 +76,19 @@ morpheus_utils_initialize_package_manager(

# Configure CUDA architecture
# NOTE: This MUST occur before any 'project' calls because of rapids_cmake requirements.
# After calling project() we still need to make some clang specific settings for CUDA prior to calling
# enable_language(CUDA) which is why CUDA is not listed as a language in the project() call.
morpheus_utils_initialize_cuda_arch(mrc)

project(mrc
VERSION 24.03.00
LANGUAGES C CXX
)

rapids_cmake_write_version_file(${CMAKE_BINARY_DIR}/autogenerated/include/mrc/version.hpp)

# Delay enabling CUDA until after we have determined our CXX compiler
if(NOT DEFINED CMAKE_CUDA_HOST_COMPILER)
message(STATUS "Setting CUDA host compiler to match CXX compiler: ${CMAKE_CXX_COMPILER}")

# Only set the host compiler if we arent using clang. Using clang > 8ish is
# incompatible with CUDA 11.4/11.5/11.6. See Issue #102
if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER})
endif()
endif()

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# Our version of NVCC officially only supports clang versions 3.2 - 13, we are now using 14
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -allow-unsupported-compiler")

# Check if the major version of Clang is greater than 15
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "--version"
OUTPUT_VARIABLE clang_version_info
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
# This sets some clang specific settings for CUDA prior to calling enable_language(CUDA)
morpheus_utils_enable_cuda()

string(REGEX MATCH "version [0-9]+" clang_version_value ${clang_version_info})
string(REGEX REPLACE "version ([0-9]+)" "\\1" clang_version ${clang_version_value})

if(${clang_version} VERSION_LESS_EQUAL "15")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcoroutines-ts")
endif()

endif()

# Now enable CUDA
enable_language(CUDA)
rapids_cmake_write_version_file(${CMAKE_BINARY_DIR}/autogenerated/include/mrc/version.hpp)

# Create a variable for subdirectories to use to reference from the root of the
# project. Also used by ccache
Expand Down

0 comments on commit 6f94942

Please sign in to comment.