]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Move CUDA compilation to Kokkos with nvcc_wrapper
authorDaniel Arndt <arndtd@ornl.gov>
Thu, 27 Oct 2022 22:01:04 +0000 (22:01 +0000)
committerDaniel Arndt <arndtd@ornl.gov>
Thu, 27 Oct 2022 22:01:37 +0000 (22:01 +0000)
22 files changed:
.github/workflows/linux.yml
cmake/config/Config.cmake.in
cmake/configure/CUDAComputeCapability/cuda_compute_capability.cu [deleted file]
cmake/configure/configure_10_cuda.cmake
cmake/macros/macro_deal_ii_add_library.cmake
cmake/macros/macro_deal_ii_add_test.cmake
cmake/macros/macro_deal_ii_initialize_cached_variables.cmake
cmake/macros/macro_deal_ii_insource_setup_target.cmake
cmake/macros/macro_deal_ii_invoke_autopilot.cmake
cmake/macros/macro_deal_ii_pickup_tests.cmake
cmake/macros/macro_deal_ii_setup_target.cmake
cmake/modules/FindKOKKOS.cmake
cmake/setup_cached_variables.cmake
cmake/setup_write_config.cmake
examples/step-64/step-64.cc [moved from examples/step-64/step-64.cu with 100% similarity]
include/deal.II/base/config.h.in
include/deal.II/base/tensor.h
source/CMakeLists.txt
source/base/CMakeLists.txt
source/lac/CMakeLists.txt
source/matrix_free/CMakeLists.txt
tests/setup_testsubproject.cmake

index 49950dd842f2402616dc78d21fb5469870273739..cdb129cf15624bef1bbd66d3c7119252f4488e66 100644 (file)
@@ -76,6 +76,20 @@ jobs:
       run: |
         mpicc -v
         cmake --version
+    - uses: actions/checkout@v2
+      with:
+        repository: kokkos/kokkos
+        ref: 3.7.00
+        path: kokkos
+    - name: install kokkos
+      working-directory: kokkos
+      run: |
+        mkdir build
+        cd build
+        cmake -D BUILD_SHARED_LIBS=ON \
+              -D CMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/kokkos-install \
+              ..
+        make install
     - name: configure
       run: |
         mkdir build
@@ -83,13 +97,15 @@ jobs:
         cmake -D CMAKE_BUILD_TYPE=Debug \
               -D DEAL_II_CXX_FLAGS='-Werror -std=c++17' \
               -D DEAL_II_EARLY_DEPRECATIONS=ON \
+              -D DEAL_II_WITH_KOKKOS="ON" \
               -D DEAL_II_WITH_CGAL="ON" \
               -D DEAL_II_WITH_MPI="ON" \
-              -D DEAL_II_WITH_TRILINOS="ON" \
+              -D DEAL_II_WITH_TRILINOS="OFF" \
               -D DEAL_II_WITH_PETSC="ON" \
               -D DEAL_II_WITH_METIS="ON" \
               -D DEAL_II_WITH_HDF5="ON" \
               -D DEAL_II_COMPONENT_EXAMPLES="OFF" \
+              -D KOKKOS_DIR=${GITHUB_WORKSPACE}/kokkos-install \
               ..
     - name: archive
       uses: actions/upload-artifact@v3
@@ -126,6 +142,9 @@ jobs:
     name: linux debug cuda-10
     runs-on: [ubuntu-18.04]
 
+    env:
+      CUDA_ROOT: /usr/local/cuda
+
     steps:
     - uses: actions/checkout@v3
     - name: modules
@@ -148,13 +167,34 @@ jobs:
       run: |
         mpicc -v
         cmake --version
+    - uses: actions/checkout@v2
+      with:
+        repository: kokkos/kokkos
+        ref: 3.7.00
+        path: kokkos
+    - name: install kokkos
+      working-directory: kokkos
+      run: |
+        mkdir build
+        cd build
+        cmake -D BUILD_SHARED_LIBS=ON \
+              -D CMAKE_CXX_COMPILER=${GITHUB_WORKSPACE}/kokkos/bin/nvcc_wrapper \
+              -D CMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/kokkos-install \
+              -D Kokkos_ENABLE_CUDA=ON \
+              -D Kokkos_ENABLE_CUDA_LAMBDA=ON \
+              -D Kokkos_ARCH_VOLTA70=ON \
+              ..
+        make install
     - name: configure
       run: |
         cmake -D CMAKE_BUILD_TYPE=Debug \
+              -D CMAKE_CXX_COMPILER=${GITHUB_WORKSPACE}/kokkos/bin/nvcc_wrapper \
               -D DEAL_II_CUDA_FLAGS='-arch=sm_70' \
               -D DEAL_II_CXX_FLAGS='-Werror -Wno-non-template-friend' \
               -D DEAL_II_EARLY_DEPRECATIONS=ON \
               -D DEAL_II_WITH_CUDA="ON" \
+              -D DEAL_II_WITH_KOKKOS="ON" \
+              -D KOKKOS_DIR=${GITHUB_WORKSPACE}/kokkos-install \
               -D DEAL_II_WITH_MPI="ON" \
               -D DEAL_II_WITH_P4EST="ON" \
               -D DEAL_II_COMPONENT_EXAMPLES="ON" \
index a3904c7f49c23e59c5a05ffe323c5145a9e10d4f..ec0e07e119ab862b55b1caa63ac40c06989e5aae 100644 (file)
@@ -149,11 +149,6 @@ SET(DEAL_II_MPIEXEC_NUMPROC_FLAG "@MPIEXEC_NUMPROC_FLAG@")
 SET(DEAL_II_MPIEXEC_PREFLAGS "@MPIEXEC_PREFLAGS@")
 SET(DEAL_II_MPIEXEC_POSTFLAGS "@MPIEXEC_POSTFLAGS@")
 
-#
-# CUDA specific setup:
-#
-SET(CMAKE_CUDA_ARCHITECTURES "@CMAKE_CUDA_ARCHITECTURES@")
-
 #
 # Build a static executable:
 #
@@ -178,23 +173,6 @@ SET(DEAL_II_LIBRARIES_RELEASE "@CONFIG_LIBRARIES_RELEASE@")
 SET(DEAL_II_LIBRARIES "@CONFIG_LIBRARIES@")
 
 
-#
-# Information about CUDA configuration
-#
-
-SET(DEAL_II_CUDA_TOOLKIT_ROOT_DIR "@CUDA_TOOLKIT_ROOT_DIR@")
-SET(DEAL_II_CUDA_COMPILER "@CMAKE_CUDA_COMPILER@")
-
-# used for all cuda targets:
-SET(DEAL_II_CUDA_FLAGS "@DEAL_II_CUDA_FLAGS@")
-
-# _additionally_ used for debug targets:
-SET(DEAL_II_CUDA_FLAGS_DEBUG "@DEAL_II_CUDA_FLAGS_DEBUG@")
-
-# _additionally_ used for release targets:
-SET(DEAL_II_CUDA_FLAGS_RELEASE "@DEAL_II_CUDA_FLAGS_RELEASE@")
-
-
 #
 # Information about library targets and feature configuration
 #
diff --git a/cmake/configure/CUDAComputeCapability/cuda_compute_capability.cu b/cmake/configure/CUDAComputeCapability/cuda_compute_capability.cu
deleted file mode 100644 (file)
index 23225d4..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2019 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE.md at
-// the top level directory of deal.II.
-//
-// ---------------------------------------------------------------------
-
-#include <iostream>
-
-int main()
-{
-  cudaDeviceProp device_properties;
-  const cudaError_t error = cudaGetDeviceProperties(&device_properties,
-                                                    /*device*/0);
-  if( error != cudaSuccess)
-  {
-    std::cout << "CUDA error: " << cudaGetErrorString(error) << '\n';
-    return error;
-  }
-  std::cout << device_properties.major << device_properties.minor;
-  return 0;
-}
index 4b1b78602bd88a6cf210ea41cc99f8d40719cd80..53cec077037ca619829a91b2918155378d8abe21 100644 (file)
@@ -86,113 +86,19 @@ MACRO(FEATURE_CUDA_FIND_EXTERNAL var)
 
     _cuda_ensure_feature_off(10 17 14)
 
-    IF("${DEAL_II_CUDA_FLAGS_SAVED}" MATCHES "-arch[ ]*sm_([0-9]*)")
-      SET(CUDA_COMPUTE_CAPABILITY "${CMAKE_MATCH_1}")
-    ELSEIF("${DEAL_II_CUDA_FLAGS_SAVED}" MATCHES "-arch=sm_([0-9]*)")
-      SET(CUDA_COMPUTE_CAPABILITY "${CMAKE_MATCH_1}")
-    ELSEIF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION)
-      #
-      # Try to autodetect the CUDA Compute Capability by asking the device
-      #
-      SET(_binary_test_dir ${CMAKE_CURRENT_BINARY_DIR}/cmake/configure/CUDAComputeCapabilityWorkdir)
-      FILE(REMOVE_RECURSE ${_binary_test_dir})
-      FILE(MAKE_DIRECTORY ${_binary_test_dir})
-
-      EXECUTE_PROCESS(
-        COMMAND ${CUDA_NVCC_EXECUTABLE}
-          -ccbin=${CMAKE_CXX_COMPILER}
-          ${CMAKE_CURRENT_SOURCE_DIR}/cmake/configure/CUDAComputeCapability/cuda_compute_capability.cu
-          -o cuda_compute_capability
-        WORKING_DIRECTORY ${_binary_test_dir}
-        OUTPUT_QUIET
-        ERROR_QUIET
-        )
-      EXECUTE_PROCESS(COMMAND ${_binary_test_dir}/cuda_compute_capability
-                      RESULT_VARIABLE _result
-                      OUTPUT_VARIABLE CUDA_COMPUTE_CAPABILITY)
-      IF(${_result} EQUAL 0)
-        ADD_FLAGS(DEAL_II_CUDA_FLAGS "-arch=sm_${CUDA_COMPUTE_CAPABILITY}")
-        MESSAGE(STATUS "Detected CUDA Compute Capability ${CUDA_COMPUTE_CAPABILITY}")
-      ELSE()
-        MESSAGE(STATUS "Couldn't detect CUDA Compute Capability! "
-                       "The error message was: ${CUDA_COMPUTE_CAPABILITY}")
-        SET(CUDA_ADDITIONAL_ERROR_STRING
-          ${CUDA_ADDITIONAL_ERROR_STRING}
-          "Couldn't detect CUDA Compute Capability! "
-          "The error message was: ${CUDA_COMPUTE_CAPABILITY}\n"
-          "Please check the return value of ${_binary_test_dir}/cuda_compute_capability.\n"
-          "If you want to disable the autodetection, set the compute capability to be used manually."
-          )
-        SET(${var} FALSE)
-      ENDIF()
-    ELSE()
-      #
-      # Assume a cuda compute capability of 35
-      #
-      SET(CUDA_COMPUTE_CAPABILITY "35")
-      ADD_FLAGS(DEAL_II_CUDA_FLAGS "-arch=sm_35")
-    ENDIF()
-
-    IF("${CUDA_COMPUTE_CAPABILITY}" LESS "35")
-      MESSAGE(STATUS "Too low CUDA Compute Capability specified -- deal.II requires at least 3.5 ")
-      SET(CUDA_ADDITIONAL_ERROR_STRING
-        ${CUDA_ADDITIONAL_ERROR_STRING}
-        "Too low CUDA Compute Capability specified: ${CUDA_COMPUTE_CAPABILITY}\n"
-        "deal.II requires at least Compute Capability 3.5\n"
-        "which is used as default if nothing is specified."
-        )
-      SET(${var} FALSE)
-    ENDIF()
-
     # cuSOLVER requires OpenMP
     FIND_PACKAGE(OpenMP REQUIRED)
     SET(DEAL_II_LINKER_FLAGS "${DEAL_II_LINKER_FLAGS} ${OpenMP_CXX_FLAGS}")
-
-    ADD_FLAGS(DEAL_II_CUDA_FLAGS_DEBUG "-G")
   ENDIF()
 ENDMACRO()
 
 
 MACRO(FEATURE_CUDA_CONFIGURE_EXTERNAL)
-
-  #
-  # Ensure that we enable CMake-internal CUDA support with the right
-  # compiler:
-  #
-  SET(CMAKE_CUDA_COMPILER "${CUDA_NVCC_EXECUTABLE}")
-  IF(NOT CMAKE_CUDA_HOST_COMPILER)
-    SET(CMAKE_CUDA_HOST_COMPILER "${CMAKE_CXX_COMPILER}")
-  ENDIF()
-  ENABLE_LANGUAGE(CUDA)
-
-  MARK_AS_ADVANCED(CMAKE_CUDA_HOST_COMPILER)
-
-  #
-  # Work around a cmake 3.10 bug, see https://gitlab.kitware.com/cmake/cmake/issues/17797
-  # because make does not support rsp link commands
-  #
-  SET(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_INCLUDES 0)
-  SET(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_LIBRARIES 0)
-  SET(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_OBJECTS 0)
-
-  #
-  # Disable CUDA_ARCHITECTURES target properties
-  #
-  IF(CMAKE_VERSION VERSION_GREATER_EQUAL 3.18)
-    SET(CMAKE_CUDA_ARCHITECTURES OFF)
-  ENDIF()
-
   # We cannot use -pedantic as compiler flags. nvcc generates code that
   # produces a lot of warnings when pedantic is enabled. So filter out the
   # flag:
   #
   STRING(REPLACE "-pedantic" "" DEAL_II_CXX_FLAGS "${DEAL_II_CXX_FLAGS}")
-
-  #
-  # Export definitions:
-  #
-  STRING(SUBSTRING "${CUDA_COMPUTE_CAPABILITY}" 0 1 CUDA_COMPUTE_CAPABILITY_MAJOR)
-  STRING(SUBSTRING "${CUDA_COMPUTE_CAPABILITY}" 1 1 CUDA_COMPUTE_CAPABILITY_MINOR)
 ENDMACRO()
 
 
index 7fd749bea466ec4dc0da7e8fd5dd779e24f436b5..002c6e607e3eb6a5584687069205023f318f5a5f 100644 (file)
@@ -59,32 +59,6 @@ MACRO(DEAL_II_ADD_LIBRARY _library)
         PUBLIC ${DEAL_II_DEFINITIONS} ${DEAL_II_DEFINITIONS_${_build}}
         )
 
-      IF(DEAL_II_WITH_CUDA)
-        #
-        # Add cxx compiler and cuda compilation flags to cuda source files:
-        #
-
-        SET(_cuda_flags "${DEAL_II_CUDA_FLAGS} ${DEAL_II_CUDA_FLAGS_${_build}}")
-        SEPARATE_ARGUMENTS(_cuda_flags)
-
-        #
-        # Workaround: cuda will split every compiler option with a comma
-        # (','), so remove all compiler flags that contain a comma:
-        #
-        STRING(REGEX REPLACE "[^ ]*,[^ ]*" "" _cxx_flags
-          "${DEAL_II_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_${_build}}"
-          )
-
-        TARGET_COMPILE_OPTIONS(${_library}_${_build_lowercase} PUBLIC
-          $<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler ${_cxx_flags}>
-          $<$<COMPILE_LANGUAGE:CUDA>:${_cuda_flags}>
-          )
-
-        SET_TARGET_PROPERTIES(${_library}_${_build_lowercase} PROPERTIES
-          CUDA_SEPARABLE_COMPILATION FALSE
-          )
-      ENDIF()
-
     ENDIF()
 
     SET_PROPERTY(GLOBAL APPEND PROPERTY DEAL_II_OBJECTS_${_build}
index 1cd35c2e20ca940b1472ec1dbe12e2147ea2dc1f..00e68df10cfcd1d72642830090fd9b32cb4c4c91 100644 (file)
@@ -414,6 +414,8 @@ FUNCTION(DEAL_II_ADD_TEST _category _test_name _comparison_file)
           ${CMAKE_CURRENT_BINARY_DIR}/${_target_short}/interrupt_guard.cc
           )
 
+        set_source_files_properties(${_source_file} PROPERTIES LANGUAGE CXX)
+
         SET_TARGET_PROPERTIES(${_target} PROPERTIES OUTPUT_NAME ${_target_short})
 
         DEAL_II_SETUP_TARGET(${_target} ${_build})
index 53c7bdbdfa496bfef6d2d185eec34a229030311e..37c4356d020f53ddd108f6371d576153896ccc2d 100644 (file)
@@ -95,22 +95,6 @@ MACRO(DEAL_II_INITIALIZE_CACHED_VARIABLES)
     )
 
 
-  IF(DEAL_II_WITH_CUDA)
-    SET(CMAKE_CUDA_COMPILER ${DEAL_II_CUDA_COMPILER} CACHE STRING
-      "CUDA Compiler.")
-    SET(CMAKE_CUDA_HOST_COMPILER ${DEAL_II_CXX_COMPILER} CACHE STRING
-      "CXX Compiler.")
-    SET(CMAKE_CUDA_FLAGS "" CACHE STRING
-      "Flags used by the compiler during all build types."
-      )
-    SET(CMAKE_CUDA_FLAGS_DEBUG "" CACHE STRING
-      "Flags used by the compiler during debug builds."
-      )
-    SET(CMAKE_CUDA_FLAGS_RELEASE "" CACHE STRING
-      "Flags used by the compiler during release builds."
-      )
-  ENDIF()
-
   MARK_AS_ADVANCED(CMAKE_INSTALL_PREFIX)
 
 ENDMACRO()
index 0854250ec041e66effff08d50a6874cac932d5af..7819afdc00c13e0f1e1cb61bd3d2527b74c19189 100644 (file)
@@ -60,31 +60,6 @@ MACRO(DEAL_II_INSOURCE_SETUP_TARGET _target _build)
       PUBLIC ${DEAL_II_DEFINITIONS} ${DEAL_II_DEFINITIONS_${_build}}
       )
 
-    IF(DEAL_II_WITH_CUDA)
-      #
-      # Add cxx compiler and cuda compilation flags to cuda source files:
-      #
-
-      SET(_cuda_flags "${DEAL_II_CUDA_FLAGS} ${DEAL_II_CUDA_FLAGS_${_build}}")
-      SEPARATE_ARGUMENTS(_cuda_flags)
-
-      #
-      # Workaround: cuda will split every compiler option with a comma
-      # (','), so remove all compiler flags that contain a comma:
-      #
-      STRING(REGEX REPLACE "[^ ]*,[^ ]*" "" _cxx_flags
-        "${DEAL_II_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_${_build}}"
-        )
-
-      TARGET_COMPILE_OPTIONS(${_target} PUBLIC
-        $<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler ${_cxx_flags}>
-        $<$<COMPILE_LANGUAGE:CUDA>:${_cuda_flags}>
-        )
-
-      SET_TARGET_PROPERTIES(${_target} PROPERTIES
-        CUDA_SEPARABLE_COMPILATION FALSE
-        )
-    ENDIF()
   ENDIF()
 
 GET_PROPERTY(_type TARGET ${_target} PROPERTY TYPE)
index 62e5f853a9a4f133d834ea11b2a0f0b7030eab24..3ccfdfcbbcb718521b531725bf28de2aa9ccdc4f 100644 (file)
@@ -44,14 +44,6 @@ MACRO(DEAL_II_INVOKE_AUTOPILOT)
     SET(_make_command " $ make")
   ENDIF()
 
-  # Make sure we can treat CUDA targets if available
-  IF(DEAL_II_WITH_CUDA)
-    IF(NOT CMAKE_CUDA_HOST_COMPILER)
-      SET(CMAKE_CUDA_HOST_COMPILER "${CMAKE_CXX_COMPILER}")
-    ENDIF()
-    ENABLE_LANGUAGE(CUDA)
-  ENDIF()
-
   # Define and setup a compilation target:
   ADD_EXECUTABLE(${TARGET} ${TARGET_SRC})
   DEAL_II_SETUP_TARGET(${TARGET})
index fc21612d925243eb6b7fef9e793e7ea1cbce0e21..c322129234d1480adb85e2740a269a91277e34f5 100644 (file)
@@ -116,11 +116,6 @@ MACRO(DEAL_II_PICKUP_TESTS)
     ENDIF()
   ENDIF()
 
-  IF(DEAL_II_WITH_CUDA)
-    FIND_PACKAGE(CUDA)
-    SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -std=c++14 -arch=sm_35 -Xcompiler ${OpenMP_CXX_FLAGS})
-  ENDIF()
-
   FIND_PACKAGE(Perl REQUIRED)
 
   FIND_PROGRAM(NUMDIFF_EXECUTABLE
index b7126296669475685bd571871ccafb0eb6ca77bd..ac2eda2902d55d8d227ae661ee759a5d5fb14d4d 100644 (file)
@@ -134,31 +134,6 @@ MACRO(DEAL_II_SETUP_TARGET _target)
       PUBLIC ${DEAL_II_USER_DEFINITIONS} ${DEAL_II_USER_DEFINITIONS_${_build}}
       )
 
-    IF(DEAL_II_WITH_CUDA)
-      #
-      # Add cxx compiler and cuda compilation flags to cuda source files:
-      #
-
-      SET(_cuda_flags "${DEAL_II_CUDA_FLAGS} ${DEAL_II_CUDA_FLAGS_${_build}}")
-      SEPARATE_ARGUMENTS(_cuda_flags)
-
-      #
-      # Workaround: cuda will split every compiler option with a comma
-      # (','), so remove all compiler flags that contain a comma:
-      #
-      STRING(REGEX REPLACE "[^ ]*,[^ ]*" "" _cxx_flags
-        "${DEAL_II_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_${_build}}"
-        )
-
-      TARGET_COMPILE_OPTIONS(${_target} PUBLIC
-        $<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler ${_cxx_flags}>
-        $<$<COMPILE_LANGUAGE:CUDA>:${_cuda_flags}>
-        )
-
-      SET_TARGET_PROPERTIES(${_target} PROPERTIES
-        CUDA_SEPARABLE_COMPILATION FALSE
-        )
-    ENDIF()
   ENDIF()
 
   #
index 49928cb21ddaac6b7380aa4bc99caa04ed774682..44c8715e892116854b6ba4368c24caa2ba8f5776 100644 (file)
@@ -54,10 +54,8 @@ ELSE()
       # we don't know if CUDA support is enabled in Kokkos
       IF(Kokkos_ENABLE_CUDA)
         SET(DEAL_II_VECTORIZATION_WIDTH_IN_BITS 0)
-        IF(DEAL_II_WITH_KOKKOS_BACKEND)
-          # Require lambda support to use Kokkos as a backend
-          KOKKOS_CHECK(OPTIONS CUDA_LAMBDA)
-        ENDIF()
+        # Require lambda support to use Kokkos as a backend
+        KOKKOS_CHECK(OPTIONS CUDA_LAMBDA)
       ENDIF()
 
       DEAL_II_FIND_LIBRARY(KOKKOS_CORE_LIBRARY
index 739f0f7261e94c516d74e39a9813484abf8d704c..279a13ff76c2f2f8d830ab2ad87987188c090bf1 100644 (file)
@@ -229,12 +229,6 @@ SET(DEAL_II_REMOVED_FLAGS
   CMAKE_Fortran_FLAGS_DEBUG
   CMAKE_Fortran_FLAGS_MINSIZEREL
   CMAKE_Fortran_FLAGS_RELWITHDEBINFO
-  CUDA_NVCC_FLAGS
-  CMAKE_CUDA_FLAGS
-  CMAKE_CUDA_FLAGS_RELEASE
-  CMAKE_CUDA_FLAGS_DEBUG
-  CMAKE_CUDA_FLAGS_MINSIZEREL
-  CMAKE_CUDA_FLAGS_RELWITHDEBINFO
   CMAKE_SHARED_LINKER_FLAGS
   CMAKE_SHARED_LINKER_FLAGS_DEBUG
   CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL
@@ -256,9 +250,6 @@ ENDFOREACH()
 #
 
 SET(DEAL_II_USED_FLAGS
-  DEAL_II_CUDA_FLAGS
-  DEAL_II_CUDA_FLAGS_DEBUG
-  DEAL_II_CUDA_FLAGS_RELEASE
   DEAL_II_CXX_FLAGS
   DEAL_II_CXX_FLAGS_DEBUG
   DEAL_II_CXX_FLAGS_RELEASE
@@ -289,7 +280,6 @@ ENDFOREACH()
 #
 
 FOREACH(_flag
-    CUDA_FLAGS CUDA_FLAGS_RELEASE CUDA_FLAGS_DEBUG
     CXX_FLAGS CXX_FLAGS_RELEASE CXX_FLAGS_DEBUG
     )
   IF(NOT "${CMAKE_${_flag}}" STREQUAL "")
@@ -309,13 +299,6 @@ FOREACH(_flag LINKER_FLAGS LINKER_FLAGS_DEBUG LINKER_FLAGS_RELEASE)
   ENDIF()
 ENDFOREACH()
 
-IF(NOT "${CUDA_NVCC_FLAGS}}" STREQUAL "")
-  MESSAGE(STATUS
-    "Prepending \${CUDA_NVCC_FLAGS} to \${DEAL_II_CUDA_FLAGS}"
-    )
-  SET(DEAL_II_CUDA_FLAGS "${CUDA_NVCC_FLAGS} ${DEAL_II_CUDA_FLAGS}")
-ENDIF()
-
 
 
 #
@@ -357,8 +340,6 @@ SET(DEAL_II_CXX_FLAGS_SAVED "$ENV{CXXFLAGS} ${DEAL_II_CXX_FLAGS_SAVED}")
 STRING(STRIP "${DEAL_II_CXX_FLAGS_SAVED}" DEAL_II_CXX_FLAGS_SAVED)
 SET(DEAL_II_LINKER_FLAGS_SAVED "$ENV{LDFLAGS} ${DEAL_II_LINKER_FLAGS_SAVED}")
 STRING(STRIP "${DEAL_II_LINKER_FLAGS_SAVED}" DEAL_II_LINKER_FLAGS_SAVED)
-SET(DEAL_II_CUDA_FLAGS_SAVED "$ENV{NVCCFLAGS} ${DEAL_II_CUDA_FLAGS_SAVED}")
-STRING(STRIP "${DEAL_II_CUDA_FLAGS_SAVED}" DEAL_II_CUDA_FLAGS_SAVED)
 UNSET(ENV{CXXFLAGS})
 UNSET(ENV{LDFLAGS})
 UNSET(ENV{NVCCFLAGS})
@@ -370,7 +351,6 @@ UNSET(ENV{NVCCFLAGS})
 #                                                                      #
 ########################################################################
 
-
 OPTION(DEAL_II_WITH_64BIT_INDICES
   "If set to ON, then use 64-bit data types to represent global degree of freedom indices. The default is to OFF. You only want to set this to ON if you will solve problems with more than 2^31 (approximately 2 billion) unknowns. If set to ON, you also need to ensure that both Trilinos and/or PETSc support 64-bit indices."
   OFF
index e8bbb9e12baff51cbfb94002d67d2931e2af7f88..979cbb031ea4dc60b3037e3390ff15debc39ce15 100644 (file)
@@ -224,13 +224,6 @@ FOREACH(_feature ${_deal_ii_features_sorted})
     IF(_feature MATCHES "THREADS" AND DEFINED TBB_VERSION)
       _detailed("#            TBB_VERSION = ${TBB_VERSION}\n")
     ENDIF()
-    IF(_feature MATCHES "CUDA" AND DEFINED CUDA_COMPUTE_CAPABILITY)
-      _detailed("#            CMAKE_CUDA_COMPILER = ${CMAKE_CUDA_COMPILER}\n")
-      _detailed("#            CUDA_COMPUTE_CAPABILITY = ${CUDA_COMPUTE_CAPABILITY_MAJOR}.${CUDA_COMPUTE_CAPABILITY_MINOR}\n")
-      _detailed("#            DEAL_II_CUDA_FLAGS = ${DEAL_II_CUDA_FLAGS}\n")
-      _detailed("#            DEAL_II_CUDA_FLAGS_RELEASE = ${DEAL_II_CUDA_FLAGS_RELEASE}\n")
-      _detailed("#            DEAL_II_CUDA_FLAGS_DEBUG = ${DEAL_II_CUDA_FLAGS_DEBUG}\n")
-    ENDIF()
 
 
     #
index a201f301ded359061aca74ba3f76c8f4a12cc971..c6dfc7153925cf28b2a142ddaf6ef501141f20c7 100644 (file)
@@ -577,3 +577,5 @@ static_assert(
   "deal.II.");
 
 #endif
+
+
index 8bb4f15da5245ead6bbb8711754f64bb4a996bd3..43e80e82d9237a44242a08b6cafeed7f683ecbe2 100644 (file)
@@ -1328,7 +1328,10 @@ constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV
 Tensor<rank_, dim, Number>::Tensor(
   const ArrayView<ElementType, MemorySpace> &initializer)
 {
+  // We cannot use Assert in a CUDA kernel
+#  ifndef __CUDA_ARCH__
   AssertDimension(initializer.size(), n_independent_components);
+#  endif
 
   for (unsigned int i = 0; i < n_independent_components; ++i)
     (*this)[unrolled_to_component_indices(i)] = initializer[i];
@@ -1385,7 +1388,6 @@ Tensor<rank_, dim, Number>::Tensor(Tensor<rank_, dim, Number> &&other) noexcept
 }
 #  endif
 
-
 namespace internal
 {
   namespace TensorSubscriptor
@@ -1404,24 +1406,10 @@ namespace internal
       return values[i];
     }
 
-    // The variables within this struct will be referenced in the next function.
-    // It is a workaround that allows returning a reference to a static variable
-    // while allowing constexpr evaluation of the function.
-    // It has to be defined outside the function because constexpr functions
-    // cannot define static variables
-    template <typename ArrayElementType>
-    struct Uninitialized
-    {
-      static ArrayElementType value;
-    };
-
-    template <typename Type>
-    Type Uninitialized<Type>::value;
-
     template <typename ArrayElementType>
     constexpr inline DEAL_II_ALWAYS_INLINE
       DEAL_II_CUDA_HOST_DEV ArrayElementType &
-                            subscript(ArrayElementType *,
+                            subscript(ArrayElementType *dummy,
                                       const unsigned int,
                                       std::integral_constant<int, 0>)
     {
@@ -1432,7 +1420,7 @@ namespace internal
         ExcMessage(
           "Cannot access elements of an object of type Tensor<rank,0,Number>."));
 #  endif
-      return Uninitialized<ArrayElementType>::value;
+      return *dummy;
     }
   } // namespace TensorSubscriptor
 } // namespace internal
index 9c3314943ad2140fbee5b2c7d139d7b8f15072ce..ee539b26b9e1b8087a3ec33d371907c92099b172 100644 (file)
@@ -84,20 +84,6 @@ FOREACH(build ${DEAL_II_BUILD_TYPES})
 
   GET_PROPERTY(_objects GLOBAL PROPERTY DEAL_II_OBJECTS_${build})
 
-  #
-  # FIXME: Somehow the cuda object files lose the "generated" property.
-  # This is an ugly hack
-  #
-  FOREACH(_object ${_objects})
-    IF("${_object}" MATCHES "cu.o$")
-      SET_SOURCE_FILES_PROPERTIES("${_object}"
-        PROPERTIES
-        EXTERNAL_OBJECT TRUE
-        GENERATED TRUE
-        )
-    ENDIF()
-  ENDFOREACH()
-
   ADD_LIBRARY(${DEAL_II_BASE_NAME}${DEAL_II_${build}_SUFFIX}
     dummy.cc # Workaround for a bug in the Xcode generator
     ${_objects}
@@ -122,14 +108,6 @@ FOREACH(build ${DEAL_II_BUILD_TYPES})
     RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${DEAL_II_EXECUTABLE_RELDIR}"
     )
 
-  IF(DEAL_II_WITH_CUDA)
-    # We need to use the CUDA linker to avoid confusing nvlink with sonaming.
-    SET_TARGET_PROPERTIES(${DEAL_II_BASE_NAME}${DEAL_II_${build}_SUFFIX}
-    PROPERTIES
-    LINKER_LANGUAGE "CUDA"
-    )
-  ENDIF()
-
   IF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
     SET_TARGET_PROPERTIES(${DEAL_II_BASE_NAME}${DEAL_II_${build}_SUFFIX}
       PROPERTIES
index 24d7cb4dd2f05391c9b6116fa23a6cb441b8f93e..a174c93ac6d854d6d80b59d246179693ee0ba153 100644 (file)
@@ -117,6 +117,8 @@ IF(DEAL_II_WITH_CUDA)
     cuda.cu
     partitioner.cu
   )
+  set_source_files_properties(cuda.cu PROPERTIES LANGUAGE CXX)
+  set_source_files_properties(partitioner.cu PROPERTIES LANGUAGE CXX)
 ENDIF()
 
 # determined by profiling
index fda0205828aa2c80a37d8f069337a0c66ba9f869..342e0a234afc850aaa8ed4d93b15fd5175e20055 100644 (file)
@@ -67,6 +67,8 @@ IF(DEAL_II_WITH_CUDA)
     vector_memory.cu
     affine_constraints.cu
     )
+  set_source_files_properties(vector_memory.cu PROPERTIES LANGUAGE CXX)
+  set_source_files_properties(affine_constraints.cu PROPERTIES LANGUAGE CXX)
 ENDIF()
 
 SET(_inst
@@ -171,6 +173,13 @@ IF(DEAL_II_WITH_CUDA)
     la_parallel_vector.cu
     read_write_vector.cu
   )
+  set_source_files_properties(cuda_kernels.cu PROPERTIES LANGUAGE CXX)
+  set_source_files_properties(cuda_precondition.cu PROPERTIES LANGUAGE CXX)
+  set_source_files_properties(cuda_solver_direct.cu PROPERTIES LANGUAGE CXX)
+  set_source_files_properties(cuda_sparse_matrix.cu PROPERTIES LANGUAGE CXX)
+  set_source_files_properties(cuda_vector.cu PROPERTIES LANGUAGE CXX)
+  set_source_files_properties(la_parallel_vector.cu PROPERTIES LANGUAGE CXX)
+  set_source_files_properties(read_write_vector.cu PROPERTIES LANGUAGE CXX)
 ENDIF()
 
 # determined by profiling
index 6154a09d436cadd8c23bb0eef040485b42589871..f4fde2f6ffb17a0404d77839ad17d4a7501db300 100644 (file)
@@ -62,6 +62,8 @@ IF(DEAL_II_WITH_CUDA)
   SET(_inst
     ${_inst}
     )
+
+  set_source_files_properties(cuda_matrix_free.cu PROPERTIES LANGUAGE CXX)
 ENDIF()
 
 DEAL_II_ADD_LIBRARY(obj_matrix_free OBJECT ${_src} ${_header} ${_inst})
index d131b95ed99e2bd8745a11e8d6f742187901ba31..30ecc17103923428588aeb5204075143112a2605 100644 (file)
@@ -12,9 +12,7 @@ FOREACH(_var
   SET(${_var} "${${_var}}" CACHE STRING "" FORCE)
 ENDFOREACH()
 
-IF(DEAL_II_WITH_CUDA)
-  PROJECT(TESTSUITE CXX CUDA)
-ENDIF()
+PROJECT(TESTSUITE CXX)
 
 #
 # A custom target that does absolutely nothing. It is used in the main

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.