Skip to content

Commit 32a99cc

Browse files
Allow compilation with Cuda 13 (#1063)
To makes cuda 13 available on Xmipp is required apart from the changes in the CMakeList, also changes in the CUFFTAdvisor repository, to apply it we forked the repository in I2PC https://github.com/I2PC/cuFFTAdvisor After compilling the branch, run test related to CUDA: - scipion3 tests xmipp3.tests.test_protocols_xmipp_movies.TestMovieAlignmentConsensus - scipion3 tests xmipp3.tests.test_protocols_xmipp_movies.TestCorrelationAlignment --------- Co-authored-by: DavidHerreros <david.herreroscalero@gmail.com>
1 parent efd34bb commit 32a99cc

3 files changed

Lines changed: 23 additions & 14 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ jobs:
1212
- 'ubuntu-24.04'
1313

1414
cuda:
15-
- {version: '12.6.0', method: 'network'}
15+
- {version: '13.1.0', method: 'network'}
16+
- {version: '12.6.0', method: 'network'}
1617
- {version: 'None'}
1718

1819
compiler:

CMakeLists.txt

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,23 +86,31 @@ if(${XMIPP_USE_CUDA})
8686
if(CUDAToolkit_FOUND)
8787
file(APPEND ${XMIPP_VERSIONS_FILE} "CUDA=${CUDAToolkit_VERSION}\n")
8888

89-
set(CMAKE_CUDA_STANDARD 14)
89+
set(CMAKE_CUDA_STANDARD 17)
9090

9191
string(APPEND CMAKE_CUDA_FLAGS " --expt-extended-lambda")
9292

93-
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.18")
94-
list(APPEND CMAKE_CUDA_ARCHITECTURES 60 75)
93+
# 1. Define base architectures supported by almost everyone (Turing, Ampere)
94+
set(XMIPP_CUDA_ARCHS 75 86)
95+
96+
# 2. Conditionally add Pascal (compute_60) ONLY if CUDA is older than 12.0
97+
if(CMAKE_CUDA_COMPILER_VERSION VERSION_LESS_EQUAL "12.0.0")
98+
list(APPEND XMIPP_CUDA_ARCHS 60)
99+
endif()
95100

96-
if(${CUDAToolkit_VERSION} VERSION_GREATER_EQUAL "11")
97-
list(APPEND CMAKE_CUDA_ARCHITECTURES 86)
98-
endif()
101+
# 3. Add newer architectures for CUDA 11.8+ (Ada, Hopper)
102+
if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL "11.8.0")
103+
list(APPEND XMIPP_CUDA_ARCHS 89 90)
104+
endif()
105+
106+
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.18")
107+
# Modern CMake approach: Just pass the list
108+
set(CMAKE_CUDA_ARCHITECTURES ${XMIPP_CUDA_ARCHS})
99109
else()
100-
string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_60,code=sm_60")
101-
string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_75,code=sm_75")
102-
103-
if(${CUDAToolkit_VERSION} VERSION_GREATER_EQUAL "11")
104-
string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_86,code=sm_86")
105-
endif()
110+
# Fallback for older CMake: Manual flags construction
111+
foreach(arch ${XMIPP_CUDA_ARCHS})
112+
string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_${arch},code=sm_${arch}")
113+
endforeach()
106114
endif()
107115

108116
else()

cmake/fetch_cuFFTAdvisor.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function(fetch_cuFFTAdvisor)
3030

3131
ExternalProject_Add(
3232
build_cuFFTAdvisor
33-
GIT_REPOSITORY https://github.com/HiPerCoRe/cuFFTAdvisor.git
33+
GIT_REPOSITORY https://github.com/I2PC/cuFFTAdvisor.git
3434
GIT_TAG master
3535
SOURCE_DIR ${SOURCE_DIR}
3636
UPDATE_COMMAND ""

0 commit comments

Comments
 (0)