diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 020e185db..c94f03e22 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -146,6 +146,15 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Force downgrade to gcc-10 on Ubuntu 22.04 to avoid __noinline__ issue + if: matrix.os == 'ubuntu-22.04' + shell: bash + run: | + sudo apt-get --purge remove "g++*" + sudo apt install g++-10 + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10 + - name: 📚 Install LLVM and some libs (Ubuntu) if: matrix.os == 'ubuntu-22.04' shell: bash @@ -158,16 +167,16 @@ jobs: sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 16 sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-16 16 - - name: 📚 Install NVIDIA HPC SDK + - name: 📚 Install CUDA Toolkit if: matrix.parallelisation == 'cuda' shell: bash run: | - curl https://developer.download.nvidia.com/hpc-sdk/ubuntu/DEB-GPG-KEY-NVIDIA-HPC-SDK | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg - echo 'deb [signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 /' | sudo tee /etc/apt/sources.list.d/nvhpc.list - sudo apt update -y - sudo apt install -y nvhpc-23-3 - echo "/opt/nvidia/hpc_sdk/Linux_x86_64/23.3/compilers/bin" >> $GITHUB_PATH - echo "/opt/nvidia/hpc_sdk/Linux_x86_64/23.3/math_libs/lib64" >> $GITHUB_PATH + wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb + sudo dpkg -i cuda-keyring_1.0-1_all.deb + sudo apt-get update + sudo apt-get -y install cuda + echo "/usr/local/cuda-12.1/bin" >> $GITHUB_PATH + echo "/usr/local/cuda-12.1/lib64" >> $GITHUB_PATH - name: 📚 Install LLVM (MacOS) if: matrix.os == 'macos-13' @@ -199,7 +208,7 @@ jobs: if: matrix.parallelisation == 'cuda' shell: bash working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS -DSPIRIT_USE_CUDA=ON -DCUDA_TOOLKIT_ROOT_DIR=/opt/nvidia/hpc_sdk/Linux_x86_64/23.3/cuda/ + run: cmake $GITHUB_WORKSPACE -DCMAKE_CUDA_COMPILER=clang++ -DSPIRIT_CUDA_ARCH=70 -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS -DSPIRIT_USE_CUDA=ON -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-12.1/ - name: ⚙ Configure with OpenMP if: matrix.parallelisation == 'openmp' @@ -239,14 +248,14 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Force downgrade to gcc-10 on Ubuntu 22.04 to avoid a bug in gcc-11.3 header - if: matrix.config.os == 'ubuntu-22.04' + - name: Force upgrade to gcc-12 on Ubuntu 22.04 + if: matrix.os == 'ubuntu-22.04' shell: bash run: | sudo apt-get --purge remove "g++*" - sudo apt install g++-10 - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10 - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10 + sudo apt install g++-12 + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 10 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 10 - name: 📚 Install NVIDIA HPC SDK and some libs shell: bash @@ -470,7 +479,7 @@ jobs: run: ctest -C $BUILD_TYPE --rerun-failed --output-on-failure build-cuda: - runs-on: ${{ matrix.config.os }} + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: @@ -478,13 +487,13 @@ jobs: - os: ubuntu-22.04 env: BUILD_TYPE: Release - CMAKE_FLAGS: -DSPIRIT_UI_USE_IMGUI=OFF -DSPIRIT_UI_CXX_USE_QT=OFF -DSPIRIT_USE_CUDA=ON -DSPIRIT_CUDA_ARCH=sm_70 + CMAKE_FLAGS: -DSPIRIT_UI_USE_IMGUI=OFF -DSPIRIT_UI_CXX_USE_QT=OFF -DSPIRIT_USE_CUDA=ON -DSPIRIT_CUDA_ARCH=70 steps: - uses: actions/checkout@v3 - name: Force downgrade to gcc-10 on Ubuntu 22.04 to avoid a bug in gcc-11.3 header - if: matrix.config.os == 'ubuntu-22.04' + if: matrix.os == 'ubuntu-22.04' shell: bash run: | sudo apt-get --purge remove "g++*" @@ -763,4 +772,4 @@ jobs: tag_name: ${{ github.ref }} release_name: Release ${{ github.ref }} body: ${{ steps.changelog.outputs.changelog }} - draft: true \ No newline at end of file + draft: true diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f7b06a63..0f8a212d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,8 +26,8 @@ set( SPIRIT_USE_THREADS OFF CACHE BOOL "Use std threads to speed up certa set( SPIRIT_USE_FFTW ON CACHE BOOL "If available, use the FFTW library instead of kissFFT." ) ### Set the scalar type used in the Spirit library set( SPIRIT_SCALAR_TYPE "double" CACHE STRING "The scalar type to be used in the Spirit library." ) -### Set the compute capability for CUDA compilation -set( SPIRIT_CUDA_ARCH "sm_60" CACHE STRING "The CUDA compute architecture to use in case of a CUDA build." ) +### Set the compute capability for CUDA compilation (note: specify without prefix "sm_") +set( SPIRIT_CUDA_ARCH "60" CACHE STRING "The CUDA compute architecture to use in case of a CUDA build." ) #################################################################### ### CMake Verbosity option( SPIRIT_PRINT_SOURCES "Print Headers and Sources from Cmake." OFF ) @@ -303,4 +303,4 @@ install( FILES ${CMAKE_CURRENT_LIST_DIR}/ui-cpp/ui-imgui/thirdparty/stb/LICENSE ######### Write VERSION.txt ######################################## file( WRITE "${CMAKE_SOURCE_DIR}/VERSION.txt" "${SPIRIT_META_NAME_VERSION}" ) -#################################################################### \ No newline at end of file +#################################################################### diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 7ee64909d..9ad3d7d1e 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -28,7 +28,7 @@ option( SPIRIT_USE_FFTW "If available, use the FFTW library instead of k ### Set the scalar type used in the Spirit library option( SPIRIT_SCALAR_TYPE "Use std threads to speed up certain parts of the code." "double" ) ### Set the compute capability for CUDA compilation -option( SPIRIT_CUDA_ARCH "Use std threads to speed up certain parts of the code." "sm_60" ) +option( SPIRIT_CUDA_ARCH "Use std threads to speed up certain parts of the code." "60" ) #################################################################### @@ -146,8 +146,8 @@ if( SPIRIT_USE_CUDA ) set( SPIRIT_CUDA_LIBS "${CUDA_LIBRARIES};${CUDA_CUFFT_LIBRARIES};${CUDA_curand_LIBRARY}" ) set( FFT_LIB ${CUDA_CUFFT_LIBRARIES} ) - if( "${CMAKE_CXX_COMPILER_ID}" MATCHES "NVHPC" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "NVCC" ) - set( CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo -arch=${SPIRIT_CUDA_ARCH} --expt-relaxed-constexpr --expt-extended-lambda" ) + if( "${CMAKE_CUDA_COMPILER_ID}" MATCHES "NVIDIA" ) + set( CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo -arch=sm_${SPIRIT_CUDA_ARCH} --expt-relaxed-constexpr --expt-extended-lambda" ) ### Deactivate CUDA warning inside Eigen such as "warning: __host__ annotation is ignored on a function("Quaternion") that is explicitly defaulted on its first declaration" set( CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcudafe=\"--diag_suppress=esa_on_defaulted_function_ignored\"") ### Display warning number when writing a warning @@ -155,11 +155,19 @@ if( SPIRIT_USE_CUDA ) set( META_COMPILER "${META_COMPILER} and nvcc" ) set( META_COMPILER_VERSION "${META_COMPILER_VERSION} and ${CUDA_VERSION}" ) - set( META_COMPILER_FULL "${META_COMPILER_FULL} and nvcc (${CUDA_VERSION}) for cuda arch \\\"${SPIRIT_CUDA_ARCH}\\\"" ) + set( META_COMPILER_FULL "${META_COMPILER_FULL} and nvcc (${CUDA_VERSION}) for cuda arch \\\"sm_${SPIRIT_CUDA_ARCH}\\\"" ) + + elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "NVHPC") + set( CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -cuda" ) + + set( META_COMPILER "${META_COMPILER}" ) + set( META_COMPILER_VERSION "${META_COMPILER_VERSION} and ${CUDA_VERSION}" ) + set( META_COMPILER_FULL "${META_COMPILER_FULL} and nvcc (${CUDA_VERSION}) for cuda arch \\\"sm_${SPIRIT_CUDA_ARCH}\\\"" ) + else() + set( CMAKE_CUDA_ARCHITECTURES ${SPIRIT_CUDA_ARCH} ) # set( CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -D__STRICT_ANSI__" ) # set( SPIRIT_COMPILE_DEFINITIONS "${SPIRIT_COMPILE_DEFINITIONS} -D__STRICT_ANSI__" ) - set( META_COMPILER "${META_COMPILER}" ) set( META_COMPILER_VERSION "${META_COMPILER_VERSION} and CUDA ${CUDA_VERSION}" ) 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 ) endif() MESSAGE( STATUS ">> --------------------- Spirit done ---------------------------------- <<" ) message( STATUS ">> CMake CXX Flags: ${CMAKE_CXX_FLAGS}" ) -MESSAGE( STATUS ">> -------------------------------------------------------------------- <<" ) \ No newline at end of file +MESSAGE( STATUS ">> -------------------------------------------------------------------- <<" )