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
1 change: 1 addition & 0 deletions .github/workflows/ci-macos-linux-windows-pixi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
env:
SOFA_BUILD_TYPE: ${{ matrix.build_type }}
run: |
pixi run -e ${{ matrix.environment }} configure -DCMAKE_CUDA_ARCHITECTURES="60;89"
pixi run -e ${{ matrix.environment }} build

- name: Testing - Run SOFA in batch mode [MacOS/Linux/Windows]
Expand Down
14 changes: 4 additions & 10 deletions applications/plugins/SofaCUDA/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.24)
project(SofaCUDA.Core LANGUAGES CUDA CXX)

set(SOFACUDA_CORE_MAJOR_VERSION 0)
set(SOFACUDA_CORE_MINOR_VERSION 1)
set(SOFACUDA_CORE_VERSION ${SOFACUDA_CORE_MAJOR_VERSION}.${SOFACUDA_CORE_MINOR_VERSION})

if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
option(SOFACUDA_ENABLE_NATIVE_ARCHITECTURE "Set native as for CUDA_ARCHITECTURES (which will compile compatible architectures for the current system)")
if(SOFACUDA_ENABLE_NATIVE_ARCHITECTURE)
set(CMAKE_CUDA_ARCHITECTURES native)
endif()
endif()

# set 75 as fallback value
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
message(NOTICE "CMAKE_CUDA_ARCHITECTURES is not set, it will be set by default to 75")
set(CMAKE_CUDA_ARCHITECTURES 75)
message(NOTICE "CMAKE_CUDA_ARCHITECTURES is not set, it will be set by default to native")
set(CMAKE_CUDA_ARCHITECTURES native)
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.

The problem is that native keyword is only supported for CMake >=3.24 https://cmake.org/cmake/help/latest/prop_tgt/CUDA_ARCHITECTURES.html and this plugin is supposed to be compatible with cmake >=3.22

so thats why the fallback was setting a hard-coded version.
I guess the solution would be to force cmake 3.24 in the header of this file

endif()

set(SOFACUDA_CORE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
Expand Down Expand Up @@ -113,7 +107,7 @@ target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Component.Mass)
target_link_libraries(${PROJECT_NAME} PUBLIC CUDA::cudart)

target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17 cuda_std_17)
target_link_libraries(${PROJECT_NAME} PUBLIC ${CUDA_cusparse_LIBRARY} CUDA::cublas)
target_link_libraries(${PROJECT_NAME} PUBLIC ${CUDA_cusparse_LIBRARY} ${CUDA_cublas_LIBRARY})

# see (I guess) https://github.com/sofa-framework/sofa/blob/314b95cbfba411bf8431486ea75b7c67c0bbcc76/Sofa/framework/Config/cmake/SofaMacrosInstall.cmake#L695
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>/include/${PROJECT_NAME}/${PROJECT_NAME}")
Expand Down
Loading
Loading