@@ -28,7 +28,7 @@ option( SPIRIT_USE_FFTW "If available, use the FFTW library instead of k
2828### Set the scalar type used in the Spirit library
2929option ( SPIRIT_SCALAR_TYPE "Use std threads to speed up certain parts of the code." "double" )
3030### Set the compute capability for CUDA compilation
31- option ( SPIRIT_CUDA_ARCH "Use std threads to speed up certain parts of the code." "sm_60 " )
31+ option ( SPIRIT_CUDA_ARCH "Use std threads to speed up certain parts of the code." "60 " )
3232####################################################################
3333
3434
@@ -146,20 +146,28 @@ if( SPIRIT_USE_CUDA )
146146 set ( SPIRIT_CUDA_LIBS "${CUDA_LIBRARIES} ;${CUDA_CUFFT_LIBRARIES} ;${CUDA_curand_LIBRARY} " )
147147 set ( FFT_LIB ${CUDA_CUFFT_LIBRARIES} )
148148
149- if ( "${CMAKE_CXX_COMPILER_ID } " MATCHES "NVHPC" OR " ${ CMAKE_CXX_COMPILER_ID } " MATCHES "NVCC " )
150- set ( CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo -arch=${SPIRIT_CUDA_ARCH} --expt-relaxed-constexpr --expt-extended-lambda" )
149+ if ( "${CMAKE_CUDA_COMPILER_ID } " MATCHES "NVIDIA " )
150+ set ( CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo -arch=sm_ ${SPIRIT_CUDA_ARCH} --expt-relaxed-constexpr --expt-extended-lambda" )
151151 ### Deactivate CUDA warning inside Eigen such as "warning: __host__ annotation is ignored on a function("Quaternion") that is explicitly defaulted on its first declaration"
152152 set ( CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcudafe=\" --diag_suppress=esa_on_defaulted_function_ignored\" " )
153153 ### Display warning number when writing a warning
154154 set ( CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcudafe \" --display_error_number\" " )
155155
156156 set ( META_COMPILER "${META_COMPILER} and nvcc" )
157157 set ( META_COMPILER_VERSION "${META_COMPILER_VERSION} and ${CUDA_VERSION} " )
158- set ( META_COMPILER_FULL "${META_COMPILER_FULL} and nvcc (${CUDA_VERSION} ) for cuda arch \\\" ${SPIRIT_CUDA_ARCH} \\\" " )
158+ set ( META_COMPILER_FULL "${META_COMPILER_FULL} and nvcc (${CUDA_VERSION} ) for cuda arch \\\" sm_${SPIRIT_CUDA_ARCH} \\\" " )
159+
160+ elseif ( "${CMAKE_CXX_COMPILER_ID } " MATCHES "NVHPC" )
161+ set ( CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -cuda" )
162+
163+ set ( META_COMPILER "${META_COMPILER} " )
164+ set ( META_COMPILER_VERSION "${META_COMPILER_VERSION} and ${CUDA_VERSION} " )
165+ set ( META_COMPILER_FULL "${META_COMPILER_FULL} and nvcc (${CUDA_VERSION} ) for cuda arch \\\" sm_${SPIRIT_CUDA_ARCH} \\\" " )
166+
159167 else ()
168+ set ( CMAKE_CUDA_ARCHITECTURES ${SPIRIT_CUDA_ARCH} )
160169 # set( CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -D__STRICT_ANSI__" )
161170 # set( SPIRIT_COMPILE_DEFINITIONS "${SPIRIT_COMPILE_DEFINITIONS} -D__STRICT_ANSI__" )
162-
163171 set ( META_COMPILER "${META_COMPILER} " )
164172 set ( META_COMPILER_VERSION "${META_COMPILER_VERSION} and CUDA ${CUDA_VERSION} " )
165173 set ( META_COMPILER_FULL "${META_COMPILER_FULL} and (CUDA ${CUDA_VERSION} ) for cuda arch \\\" ${SPIRIT_CUDA_ARCH} \\\" " )
@@ -741,4 +749,4 @@ if( SPIRIT_PRINT_SOURCES )
741749endif ()
742750MESSAGE ( STATUS ">> --------------------- Spirit done ---------------------------------- <<" )
743751message ( STATUS ">> CMake CXX Flags: ${CMAKE_CXX_FLAGS } " )
744- MESSAGE ( STATUS ">> -------------------------------------------------------------------- <<" )
752+ MESSAGE ( STATUS ">> -------------------------------------------------------------------- <<" )
0 commit comments