From fc5b5aff3c47d576e599a8b6e9e7b1adc01653e0 Mon Sep 17 00:00:00 2001 From: Tobias Ribizel Date: Wed, 1 May 2024 15:28:21 +0200 Subject: [PATCH 01/13] require C++17 support --- README.md | 10 +++++----- accessor/utils.hpp | 12 +++++++----- cmake/build_helpers.cmake | 6 +++--- cmake/create_test.cmake | 4 ++-- cmake/hip.cmake | 2 +- common/cuda_hip/components/reduction.hpp | 2 +- common/cuda_hip/reorder/rcm_kernels.cpp | 1 - core/base/extended_float.hpp | 1 - core/solver/cb_gmres_accessor.hpp | 1 - core/test/accessor/CMakeLists.txt | 2 +- core/test/base/deferred_factory.cpp | 6 +++--- cuda/base/pointer_mode_guard.hpp | 9 ++++++--- dpcpp/reorder/rcm_kernels.dp.cpp | 1 - examples/custom-matrix-format/CMakeLists.txt | 2 +- hip/base/pointer_mode_guard.hip.hpp | 9 ++++++--- include/ginkgo/core/base/abstract_factory.hpp | 3 ++- include/ginkgo/core/base/combination.hpp | 3 ++- include/ginkgo/core/base/composition.hpp | 3 ++- include/ginkgo/core/base/math.hpp | 17 ++++++++--------- include/ginkgo/core/base/utils_helper.hpp | 5 ++--- include/ginkgo/core/distributed/matrix.hpp | 2 +- include/ginkgo/core/log/logger.hpp | 2 +- include/ginkgo/core/preconditioner/ic.hpp | 1 - include/ginkgo/core/preconditioner/ilu.hpp | 1 - include/ginkgo/core/solver/solver_traits.hpp | 12 +++++++----- test/test_install/CMakeLists.txt | 4 ++-- 26 files changed, 63 insertions(+), 58 deletions(-) diff --git a/README.md b/README.md index 36235ff53d1..4c595de2ba5 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Ginkgo is a high-performance numerical linear algebra library for many-core systems, with a focus on solution of sparse linear systems. It is implemented using modern C++ -(you will need an at least C++14 compliant compiler to build it), with GPU kernels +(you will need an at least C++17 compliant compiler to build it), with GPU kernels implemented for NVIDIA, AMD and Intel GPUs. --- @@ -39,7 +39,7 @@ implemented for NVIDIA, AMD and Intel GPUs. For Ginkgo core library: * _cmake 3.16+_ -* C++14 compliant compiler, one of: +* C++17 compliant compiler, one of: * _gcc 5.5+_ * _clang 3.9+_ * _Intel compiler 2019+_ @@ -50,7 +50,7 @@ For Ginkgo core library: The Ginkgo CUDA module has the following __additional__ requirements: * _cmake 3.18+_ (If CUDA was installed through the NVIDIA HPC Toolkit, we require _cmake 3.22+_) -* _CUDA 10.1+_ or _NVHPC Package 22.7+_ +* _CUDA 11.0+_ or _NVHPC Package 22.7+_ * Any host compiler restrictions your version of CUDA may impose also apply here. For the newest CUDA version, this information can be found in the [CUDA installation guide for Linux](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html) @@ -88,13 +88,13 @@ following: ### Windows * _cmake 3.16+_ -* C++14 compliant 64-bit compiler: +* C++17 compliant 64-bit compiler: * _MinGW : gcc 5.5+_ * _Microsoft Visual Studio : VS 2019+_ The Ginkgo CUDA module has the following __additional__ requirements: -* _CUDA 10.1+_ +* _CUDA 11.0+_ * _Microsoft Visual Studio_ * Any host compiler restrictions your version of CUDA may impose also apply here. For the newest CUDA version, this information can be found in the diff --git a/accessor/utils.hpp b/accessor/utils.hpp index 5dcd3e89fcd..14d1e26492a 100644 --- a/accessor/utils.hpp +++ b/accessor/utils.hpp @@ -5,9 +5,11 @@ #ifndef GKO_ACCESSOR_UTILS_HPP_ #define GKO_ACCESSOR_UTILS_HPP_ + #include #include #include +#include #if defined(__CUDACC__) || defined(__HIPCC__) @@ -144,7 +146,7 @@ namespace detail { * @internal * Tests if a member function `Ref::to_arithmetic_type` exists */ -template > +template > struct has_to_arithmetic_type : std::false_type { static_assert(std::is_same::value, "Do not modify the Dummy value!"); @@ -153,7 +155,7 @@ struct has_to_arithmetic_type : std::false_type { template struct has_to_arithmetic_type< - Ref, xstd::void_t().to_arithmetic_type())>> + Ref, std::void_t().to_arithmetic_type())>> : std::true_type { using type = decltype(std::declval().to_arithmetic_type()); }; @@ -163,14 +165,14 @@ struct has_to_arithmetic_type< * @internal * Tests if the type `Ref::arithmetic_type` exists */ -template > +template > struct has_arithmetic_type : std::false_type { static_assert(std::is_same::value, "Do not modify the Dummy value!"); }; template -struct has_arithmetic_type> +struct has_arithmetic_type> : std::true_type {}; @@ -236,7 +238,7 @@ struct has_implicit_cast { template struct has_implicit_cast( + std::void_t( std::declval()))>> { static constexpr bool value = true; }; diff --git a/cmake/build_helpers.cmake b/cmake/build_helpers.cmake index e8691b77587..f0337839a55 100644 --- a/cmake/build_helpers.cmake +++ b/cmake/build_helpers.cmake @@ -18,11 +18,11 @@ function(ginkgo_default_includes name) endfunction() function(ginkgo_compile_features name) - target_compile_features("${name}" PUBLIC cxx_std_14) + target_compile_features("${name}" PUBLIC cxx_std_17) # we set these properties regardless of the enabled backends, # because unknown properties are ignored - set_target_properties("${name}" PROPERTIES HIP_STANDARD 14) - set_target_properties("${name}" PROPERTIES CUDA_STANDARD 14) + set_target_properties("${name}" PROPERTIES HIP_STANDARD 17) + set_target_properties("${name}" PROPERTIES CUDA_STANDARD 17) if(GINKGO_WITH_CLANG_TIDY AND GINKGO_CLANG_TIDY_PATH) set_property(TARGET "${name}" PROPERTY CXX_CLANG_TIDY "${GINKGO_CLANG_TIDY_PATH};-checks=*") endif() diff --git a/cmake/create_test.cmake b/cmake/create_test.cmake index 9f7079f60a3..68f5708e829 100644 --- a/cmake/create_test.cmake +++ b/cmake/create_test.cmake @@ -37,8 +37,8 @@ function(ginkgo_set_test_target_properties test_target_name test_library_suffix) target_compile_features(${test_target_name} PUBLIC cxx_std_14) # we set these properties regardless of the enabled backends, # because unknown properties are ignored - set_target_properties(${test_target_name} PROPERTIES HIP_STANDARD 14) - set_target_properties(${test_target_name} PROPERTIES CUDA_STANDARD 14) + set_target_properties(${test_target_name} PROPERTIES HIP_STANDARD 17) + set_target_properties(${test_target_name} PROPERTIES CUDA_STANDARD 17) target_include_directories(${test_target_name} PRIVATE ${Ginkgo_BINARY_DIR} ${set_properties_ADDITIONAL_INCLUDES}) target_link_libraries(${test_target_name} PRIVATE ginkgo GTest::GTest ${set_properties_ADDITIONAL_LIBRARIES}) endfunction() diff --git a/cmake/hip.cmake b/cmake/hip.cmake index 327375bfe76..c94117242eb 100644 --- a/cmake/hip.cmake +++ b/cmake/hip.cmake @@ -128,4 +128,4 @@ find_package(ROCTX) if(GINKGO_HIP_AMD_UNSAFE_ATOMIC AND GINKGO_HIP_VERSION VERSION_GREATER_EQUAL 5) set(CMAKE_HIP_FLAGS "${CMAKE_HIP_FLAGS} -munsafe-fp-atomics -Wno-unused-command-line-argument") endif() -set(CMAKE_HIP_STANDARD 14) +set(CMAKE_HIP_STANDARD 17) diff --git a/common/cuda_hip/components/reduction.hpp b/common/cuda_hip/components/reduction.hpp index 1968a6d30b6..7c66befa6bd 100644 --- a/common/cuda_hip/components/reduction.hpp +++ b/common/cuda_hip/components/reduction.hpp @@ -141,7 +141,7 @@ __device__ void reduce(const Group& __restrict__ group, */ template < typename Group, typename ValueType, typename Operator, - typename = xstd::enable_if_t::value>> + typename = std::enable_if_t::value>> __device__ void multireduce(const Group& __restrict__ group, ValueType* __restrict__ data, size_type stride, size_type num, Operator reduce_op = Operator{}) diff --git a/common/cuda_hip/reorder/rcm_kernels.cpp b/common/cuda_hip/reorder/rcm_kernels.cpp index 3206fb28c8b..72729db30f1 100644 --- a/common/cuda_hip/reorder/rcm_kernels.cpp +++ b/common/cuda_hip/reorder/rcm_kernels.cpp @@ -16,7 +16,6 @@ #include #include -#include #include #include #include diff --git a/core/base/extended_float.hpp b/core/base/extended_float.hpp index 2dc60afd329..c14b5d1bd39 100644 --- a/core/base/extended_float.hpp +++ b/core/base/extended_float.hpp @@ -9,7 +9,6 @@ #include #include -#include #include diff --git a/core/solver/cb_gmres_accessor.hpp b/core/solver/cb_gmres_accessor.hpp index 64a7c9a46e5..a5d95793d15 100644 --- a/core/solver/cb_gmres_accessor.hpp +++ b/core/solver/cb_gmres_accessor.hpp @@ -16,7 +16,6 @@ #include #include #include -#include #include #include "accessor/range.hpp" diff --git a/core/test/accessor/CMakeLists.txt b/core/test/accessor/CMakeLists.txt index 4fd0ff158d0..07da99cc308 100644 --- a/core/test/accessor/CMakeLists.txt +++ b/core/test/accessor/CMakeLists.txt @@ -6,7 +6,7 @@ function(create_accessor_test test_name) ${PROJECT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}) string(REPLACE "/" "_" TEST_TARGET_NAME "${REL_BINARY_DIR}/${test_name}") add_executable("${TEST_TARGET_NAME}" "${test_name}.cpp") - target_compile_features("${TEST_TARGET_NAME}" PUBLIC cxx_std_14) + target_compile_features("${TEST_TARGET_NAME}" PUBLIC cxx_std_17) target_include_directories("${TEST_TARGET_NAME}" PRIVATE "${Ginkgo_SOURCE_DIR}" diff --git a/core/test/base/deferred_factory.cpp b/core/test/base/deferred_factory.cpp index a1c02103cf8..4b140bfcbc6 100644 --- a/core/test/base/deferred_factory.cpp +++ b/core/test/base/deferred_factory.cpp @@ -80,12 +80,12 @@ struct test_impl : std::false_type {}; // specialization for constructor template -struct test_impl()...))>, T, - Args...> : std::true_type {}; +struct test_impl()...))>, T, Args...> + : std::true_type {}; // specialization for DF2 with_factory_list template -struct test_impl()...))>, DummyFlag, Args...> : std::true_type {}; diff --git a/cuda/base/pointer_mode_guard.hpp b/cuda/base/pointer_mode_guard.hpp index 39af6100c46..56f46fedf40 100644 --- a/cuda/base/pointer_mode_guard.hpp +++ b/cuda/base/pointer_mode_guard.hpp @@ -13,7 +13,6 @@ #include #include -#include namespace gko { @@ -35,6 +34,7 @@ class pointer_mode_guard { pointer_mode_guard(cublasHandle_t& handle) { l_handle = &handle; + uncaught_exceptions_ = std::uncaught_exceptions(); GKO_ASSERT_NO_CUBLAS_ERRORS( cublasSetPointerMode(handle, CUBLAS_POINTER_MODE_HOST)); } @@ -50,7 +50,7 @@ class pointer_mode_guard { ~pointer_mode_guard() noexcept(false) { /* Ignore the error during stack unwinding for this call */ - if (xstd::uncaught_exception()) { + if (std::uncaught_exception() > uncaught_exceptions_) { cublasSetPointerMode(*l_handle, CUBLAS_POINTER_MODE_DEVICE); } else { GKO_ASSERT_NO_CUBLAS_ERRORS( @@ -59,6 +59,7 @@ class pointer_mode_guard { } private: + int uncaught_exceptions_; cublasHandle_t* l_handle; }; @@ -82,6 +83,7 @@ class pointer_mode_guard { pointer_mode_guard(cusparseHandle_t handle) { l_handle = handle; + uncaught_exceptions_ = std::uncaught_exceptions(); GKO_ASSERT_NO_CUSPARSE_ERRORS( cusparseSetPointerMode(handle, CUSPARSE_POINTER_MODE_HOST)); } @@ -97,7 +99,7 @@ class pointer_mode_guard { ~pointer_mode_guard() noexcept(false) { /* Ignore the error during stack unwinding for this call */ - if (xstd::uncaught_exception()) { + if (std::uncaught_exceptions() > uncaught_exceptions_) { cusparseSetPointerMode(l_handle, CUSPARSE_POINTER_MODE_DEVICE); } else { GKO_ASSERT_NO_CUSPARSE_ERRORS( @@ -106,6 +108,7 @@ class pointer_mode_guard { } private: + int uncaught_exceptions_; cusparseHandle_t l_handle; }; diff --git a/dpcpp/reorder/rcm_kernels.dp.cpp b/dpcpp/reorder/rcm_kernels.dp.cpp index 350b4c90a6d..2985f1a0dc7 100644 --- a/dpcpp/reorder/rcm_kernels.dp.cpp +++ b/dpcpp/reorder/rcm_kernels.dp.cpp @@ -7,7 +7,6 @@ #include #include -#include #include #include #include diff --git a/examples/custom-matrix-format/CMakeLists.txt b/examples/custom-matrix-format/CMakeLists.txt index 6881d6448d0..502eb7d4244 100644 --- a/examples/custom-matrix-format/CMakeLists.txt +++ b/examples/custom-matrix-format/CMakeLists.txt @@ -12,7 +12,7 @@ if(NOT (GINKGO_BUILD_CUDA AND GINKGO_BUILD_OMP)) "This example needs Ginkgo built with CUDA and OpenMP support") endif() -set(CMAKE_CUDA_STANDARD 14) +set(CMAKE_CUDA_STANDARD 17) set(CMAKE_CUDA_STANDARD_REQUIRED ON) add_executable(custom-matrix-format custom-matrix-format.cpp stencil_kernel.cu) diff --git a/hip/base/pointer_mode_guard.hip.hpp b/hip/base/pointer_mode_guard.hip.hpp index d14c8468c0b..ea03758e087 100644 --- a/hip/base/pointer_mode_guard.hip.hpp +++ b/hip/base/pointer_mode_guard.hip.hpp @@ -20,7 +20,6 @@ #include #include -#include #include "common/cuda_hip/base/runtime.hpp" @@ -44,6 +43,7 @@ class pointer_mode_guard { pointer_mode_guard(hipblasContext* handle) { l_handle = handle; + uncaught_exceptions_ = std::uncaught_exceptions(); GKO_ASSERT_NO_HIPBLAS_ERRORS( hipblasSetPointerMode(reinterpret_cast(handle), HIPBLAS_POINTER_MODE_HOST)); @@ -60,7 +60,7 @@ class pointer_mode_guard { ~pointer_mode_guard() noexcept(false) { /* Ignore the error during stack unwinding for this call */ - if (xstd::uncaught_exception()) { + if (std::uncaught_exceptions() > uncaught_exceptions_) { hipblasSetPointerMode(reinterpret_cast(l_handle), HIPBLAS_POINTER_MODE_DEVICE); } else { @@ -71,6 +71,7 @@ class pointer_mode_guard { } private: + int uncaught_exceptions_; hipblasContext* l_handle; }; @@ -94,6 +95,7 @@ class pointer_mode_guard { pointer_mode_guard(hipsparseContext* handle) { l_handle = handle; + uncaught_exceptions_ = std::uncaught_exceptions(); GKO_ASSERT_NO_HIPSPARSE_ERRORS( hipsparseSetPointerMode(reinterpret_cast(handle), HIPSPARSE_POINTER_MODE_HOST)); @@ -110,7 +112,7 @@ class pointer_mode_guard { ~pointer_mode_guard() noexcept(false) { /* Ignore the error during stack unwinding for this call */ - if (xstd::uncaught_exception()) { + if (std::uncaught_exceptions() > uncaught_exceptions_) { hipsparseSetPointerMode( reinterpret_cast(l_handle), HIPSPARSE_POINTER_MODE_DEVICE); @@ -122,6 +124,7 @@ class pointer_mode_guard { } private: + int uncaught_exceptions_; hipsparseContext* l_handle; }; diff --git a/include/ginkgo/core/base/abstract_factory.hpp b/include/ginkgo/core/base/abstract_factory.hpp index 5c799ab58f1..cbd18cf42d6 100644 --- a/include/ginkgo/core/base/abstract_factory.hpp +++ b/include/ginkgo/core/base/abstract_factory.hpp @@ -6,6 +6,7 @@ #define GKO_PUBLIC_CORE_BASE_ABSTRACT_FACTORY_HPP_ +#include #include #include @@ -563,7 +564,7 @@ private: \ \ public: \ template >...>::value>> \ auto with_##_name(Args&&... factories) \ diff --git a/include/ginkgo/core/base/combination.hpp b/include/ginkgo/core/base/combination.hpp index f3cdea82dcb..a9fb4d565ae 100644 --- a/include/ginkgo/core/base/combination.hpp +++ b/include/ginkgo/core/base/combination.hpp @@ -6,6 +6,7 @@ #define GKO_PUBLIC_CORE_BASE_COMBINATION_HPP_ +#include #include #include @@ -136,7 +137,7 @@ class Combination : public EnableLinOp>, */ template < typename CoefficientIterator, typename OperatorIterator, - typename = xstd::void_t< + typename = std::void_t< typename std::iterator_traits< CoefficientIterator>::iterator_category, typename std::iterator_traits::iterator_category>> diff --git a/include/ginkgo/core/base/composition.hpp b/include/ginkgo/core/base/composition.hpp index e151e121b56..9c16f8720aa 100644 --- a/include/ginkgo/core/base/composition.hpp +++ b/include/ginkgo/core/base/composition.hpp @@ -6,6 +6,7 @@ #define GKO_PUBLIC_CORE_BASE_COMPOSITION_HPP_ +#include #include #include @@ -125,7 +126,7 @@ class Composition : public EnableLinOp>, * @param end iterator pointing behind the last operator */ template ::iterator_category>> explicit Composition(Iterator begin, Iterator end) : EnableLinOp([&] { diff --git a/include/ginkgo/core/base/math.hpp b/include/ginkgo/core/base/math.hpp index 42eff5a5d40..f7b3b35c3f6 100644 --- a/include/ginkgo/core/base/math.hpp +++ b/include/ginkgo/core/base/math.hpp @@ -877,7 +877,7 @@ namespace detail { * @note * This basically mirrors the accessor functionality */ -template > +template > struct has_to_arithmetic_type : std::false_type { static_assert(std::is_same::value, "Do not modify the Dummy value!"); @@ -886,7 +886,7 @@ struct has_to_arithmetic_type : std::false_type { template struct has_to_arithmetic_type< - Ref, xstd::void_t().to_arithmetic_type())>> + Ref, std::void_t().to_arithmetic_type())>> : std::true_type { using type = decltype(std::declval().to_arithmetic_type()); }; @@ -896,14 +896,14 @@ struct has_to_arithmetic_type< * @internal * Tests if the type `Ref::arithmetic_type` exists */ -template > +template > struct has_arithmetic_type : std::false_type { static_assert(std::is_same::value, "Do not modify the Dummy value!"); }; template -struct has_arithmetic_type> +struct has_arithmetic_type> : std::true_type {}; @@ -1070,17 +1070,16 @@ GKO_INLINE GKO_ATTRIBUTES constexpr auto squared_norm(const T& x) * @return x >= zero() ? x : -x; */ template -GKO_INLINE - GKO_ATTRIBUTES constexpr xstd::enable_if_t::value, T> - abs(const T& x) +GKO_INLINE GKO_ATTRIBUTES constexpr std::enable_if_t::value, T> +abs(const T& x) { return x >= zero() ? x : -x; } template -GKO_INLINE GKO_ATTRIBUTES constexpr xstd::enable_if_t::value, - remove_complex> +GKO_INLINE GKO_ATTRIBUTES constexpr std::enable_if_t::value, + remove_complex> abs(const T& x) { return sqrt(squared_norm(x)); diff --git a/include/ginkgo/core/base/utils_helper.hpp b/include/ginkgo/core/base/utils_helper.hpp index faa74974703..3ea5c9d878d 100644 --- a/include/ginkgo/core/base/utils_helper.hpp +++ b/include/ginkgo/core/base/utils_helper.hpp @@ -12,7 +12,6 @@ #include #include -#include #include @@ -99,7 +98,7 @@ template struct is_clonable_impl : std::false_type {}; template -struct is_clonable_impl().clone())>> +struct is_clonable_impl().clone())>> : std::true_type {}; template @@ -114,7 +113,7 @@ struct is_clonable_to_impl : std::false_type {}; template struct is_clonable_to_impl< - T, xstd::void_t().clone( + T, std::void_t().clone( std::declval>()))>> : std::true_type {}; diff --git a/include/ginkgo/core/distributed/matrix.hpp b/include/ginkgo/core/distributed/matrix.hpp index 4689c3d3381..9e3d45443b1 100644 --- a/include/ginkgo/core/distributed/matrix.hpp +++ b/include/ginkgo/core/distributed/matrix.hpp @@ -55,7 +55,7 @@ struct is_matrix_type_builder : std::false_type {}; template struct is_matrix_type_builder< Builder, ValueType, IndexType, - gko::xstd::void_t< + std::void_t< decltype(std::declval().template create( std::declval>()))>> : std::true_type {}; diff --git a/include/ginkgo/core/log/logger.hpp b/include/ginkgo/core/log/logger.hpp index 907bc418906..dd9d30249e9 100644 --- a/include/ginkgo/core/log/logger.hpp +++ b/include/ginkgo/core/log/logger.hpp @@ -796,7 +796,7 @@ class EnableLogging : public PolymorphicBase { template struct propagate_log_helper< Event, ConcreteLoggableT, - xstd::void_t< + std::void_t< decltype(std::declval().get_executor())>> { template static void propagate_log(const ConcreteLoggableT* loggable, diff --git a/include/ginkgo/core/preconditioner/ic.hpp b/include/ginkgo/core/preconditioner/ic.hpp index f78e00eea09..aea43af3cf1 100644 --- a/include/ginkgo/core/preconditioner/ic.hpp +++ b/include/ginkgo/core/preconditioner/ic.hpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include diff --git a/include/ginkgo/core/preconditioner/ilu.hpp b/include/ginkgo/core/preconditioner/ilu.hpp index 869681fc547..1f4be3e3046 100644 --- a/include/ginkgo/core/preconditioner/ilu.hpp +++ b/include/ginkgo/core/preconditioner/ilu.hpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include diff --git a/include/ginkgo/core/solver/solver_traits.hpp b/include/ginkgo/core/solver/solver_traits.hpp index b5c437716b3..d5306f56b08 100644 --- a/include/ginkgo/core/solver/solver_traits.hpp +++ b/include/ginkgo/core/solver/solver_traits.hpp @@ -6,7 +6,9 @@ #define GKO_PUBLIC_CORE_SOLVER_SOLVER_TRAITS_HPP_ -#include +#include + + #include @@ -33,12 +35,12 @@ struct has_with_criteria : std::false_type {}; * * @internal The second template parameter (which uses SFINAE) must match * the default value of the general case in order to be accepted - * as a specialization, which is why `xstd::void_t` is used. + * as a specialization, which is why `std::void_t` is used. */ template -struct has_with_criteria< - SolverType, xstd::void_t()))>> +struct has_with_criteria()))>> : std::true_type {}; diff --git a/test/test_install/CMakeLists.txt b/test/test_install/CMakeLists.txt index ee19b8d030e..60fad7cf339 100644 --- a/test/test_install/CMakeLists.txt +++ b/test/test_install/CMakeLists.txt @@ -38,7 +38,7 @@ if(GINKGO_BUILD_CUDA) enable_language(CUDA) configure_file(test_install.cpp test_install.cu COPYONLY) add_executable(test_install_cuda ${CMAKE_CURRENT_BINARY_DIR}/test_install.cu) - set_target_properties(test_install_cuda PROPERTIES CUDA_STANDARD 14) + set_target_properties(test_install_cuda PROPERTIES CUDA_STANDARD 17) target_compile_definitions(test_install_cuda PRIVATE HAS_CUDA=1) target_compile_definitions(test_install_cuda PRIVATE HAS_REFERENCE=${HAS_REFERENCE}) target_link_libraries(test_install_cuda PRIVATE Ginkgo::ginkgo) @@ -49,7 +49,7 @@ if(GINKGO_BUILD_HIP) configure_file(test_install.cpp test_install.hip.cpp COPYONLY) set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/test_install.hip.cpp PROPERTIES LANGUAGE HIP) add_executable(test_install_hip ${CMAKE_CURRENT_BINARY_DIR}/test_install.hip.cpp) - set_target_properties(test_install_hip PROPERTIES HIP_STANDARD 14) + set_target_properties(test_install_hip PROPERTIES HIP_STANDARD 17) target_link_libraries(test_install_hip PRIVATE Ginkgo::ginkgo) target_compile_definitions(test_install_hip PRIVATE HAS_HIP=1) From bd2ccae3a2dcaca6fd7fc395e2096ea1505c93ba Mon Sep 17 00:00:00 2001 From: Tobias Ribizel Date: Wed, 1 May 2024 15:31:40 +0200 Subject: [PATCH 02/13] adress TODOs --- core/log/profiler_hook.hpp | 8 +++----- include/ginkgo/core/log/profiler_hook.hpp | 1 - 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/core/log/profiler_hook.hpp b/core/log/profiler_hook.hpp index 3f4baf80db1..e6104bba932 100644 --- a/core/log/profiler_hook.hpp +++ b/core/log/profiler_hook.hpp @@ -135,14 +135,12 @@ class profiling_scope_guard { profiling_scope_guard(const char* name) { auto functions = log::create_vtune_fns(); - guard_ = std::make_unique( - name, log::profile_event_category::internal, - std::move(functions.first), std::move(functions.second)); + guard_.emplace(name, log::profile_event_category::internal, + std::move(functions.first), std::move(functions.second)); } private: - // TODO17: use std::optional - std::unique_ptr guard_; + std::optional guard_; }; diff --git a/include/ginkgo/core/log/profiler_hook.hpp b/include/ginkgo/core/log/profiler_hook.hpp index ce5e8831f1c..5db0e1275f5 100644 --- a/include/ginkgo/core/log/profiler_hook.hpp +++ b/include/ginkgo/core/log/profiler_hook.hpp @@ -419,7 +419,6 @@ class profiling_scope_guard { profiling_scope_guard(const profiling_scope_guard&) = delete; - // TODO17: unnecessary with guaranteed RVO /** Move-constructs from another scope guard, other will be left empty. */ profiling_scope_guard(profiling_scope_guard&& other); From 29666a44581bd30ebf6db5703107d3eef905df80 Mon Sep 17 00:00:00 2001 From: Tobias Ribizel Date: Wed, 1 May 2024 16:14:40 +0200 Subject: [PATCH 03/13] add missing include --- core/log/profiler_hook.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/log/profiler_hook.hpp b/core/log/profiler_hook.hpp index e6104bba932..31d1d1b5a83 100644 --- a/core/log/profiler_hook.hpp +++ b/core/log/profiler_hook.hpp @@ -9,6 +9,9 @@ #include +#include + + namespace gko { namespace log { From 38388eb7ea65d299d87f9fe7a84bdea82e87ddb4 Mon Sep 17 00:00:00 2001 From: Tobias Ribizel Date: Wed, 1 May 2024 16:27:34 +0200 Subject: [PATCH 04/13] set C++ version where necessary, remove checks where unnecessary ginkgo has the PUBLIC property cxx_std_17, so we don't need to set it in tests. pkg-config doesn't propagate C++ standards --- benchmark/CMakeLists.txt | 1 - cmake/create_test.cmake | 3 --- dpcpp/CMakeLists.txt | 1 - test/test_exportbuild/CMakeLists.txt | 1 - test/test_install/CMakeLists.txt | 1 - test/test_pkgconfig/CMakeLists.txt | 2 +- test/test_subdir/CMakeLists.txt | 1 - 7 files changed, 1 insertion(+), 9 deletions(-) diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt index 306655d2315..de6e74d464c 100644 --- a/benchmark/CMakeLists.txt +++ b/benchmark/CMakeLists.txt @@ -37,7 +37,6 @@ function(ginkgo_benchmark_onemkl_linops type def) add_library(onemkl_linops_${type} utils/dpcpp_linops.dp.cpp) # make the dependency public to catch issues target_compile_definitions(onemkl_linops_${type} PUBLIC ${def}) - target_compile_features(onemkl_linops_${type} PRIVATE cxx_std_17) target_link_libraries(onemkl_linops_${type} PRIVATE Ginkgo::ginkgo MKL::MKL_DPCPP) endfunction() diff --git a/cmake/create_test.cmake b/cmake/create_test.cmake index 68f5708e829..9ab0c40de20 100644 --- a/cmake/create_test.cmake +++ b/cmake/create_test.cmake @@ -34,7 +34,6 @@ function(ginkgo_set_test_target_properties test_target_name test_library_suffix) target_link_libraries(${test_target_name} PRIVATE ginkgo_gtest_main${test_library_suffix}) endif() endif() - target_compile_features(${test_target_name} PUBLIC cxx_std_14) # we set these properties regardless of the enabled backends, # because unknown properties are ignored set_target_properties(${test_target_name} PROPERTIES HIP_STANDARD 17) @@ -139,7 +138,6 @@ endfunction(ginkgo_create_test) function(ginkgo_create_dpcpp_test test_name) ginkgo_build_test_name(${test_name} test_target_name) add_executable(${test_target_name} ${test_name}.dp.cpp) - target_compile_features(${test_target_name} PUBLIC cxx_std_17) target_compile_options(${test_target_name} PRIVATE ${GINKGO_DPCPP_FLAGS}) gko_add_sycl_to_target(TARGET ${test_target_name} SOURCES ${test_name}.dp.cpp) target_link_options(${test_target_name} PRIVATE -fsycl-device-code-split=per_kernel) @@ -270,7 +268,6 @@ function(ginkgo_create_common_device_test test_name) ginkgo_build_test_name(${test_name} test_target_name) if(GINKGO_BUILD_SYCL) ginkgo_create_common_test_internal(${test_name} DpcppExecutor dpcpp ${ARGN}) - target_compile_features(${test_target_name}_dpcpp PRIVATE cxx_std_17) target_compile_options(${test_target_name}_dpcpp PRIVATE ${GINKGO_DPCPP_FLAGS}) # We need to use a new file to avoid sycl setting in other backends because add_sycl_to_target will change the source property. configure_file(${test_name}.cpp ${test_name}.dp.cpp COPYONLY) diff --git a/dpcpp/CMakeLists.txt b/dpcpp/CMakeLists.txt index ee373243842..851ef9a3dc6 100644 --- a/dpcpp/CMakeLists.txt +++ b/dpcpp/CMakeLists.txt @@ -104,7 +104,6 @@ gko_add_sycl_to_target(TARGET ginkgo_dpcpp) # Note: add MKL as PRIVATE not PUBLIC (MKL example shows) to avoid propagating # find_package(MKL) everywhere when linking ginkgo (see the MKL example # https://software.intel.com/content/www/us/en/develop/documentation/onemkl-windows-developer-guide/top/getting-started/cmake-config-for-onemkl.html) -target_compile_features(ginkgo_dpcpp PUBLIC cxx_std_17) target_link_options(ginkgo_dpcpp PRIVATE -fsycl-device-lib=all) # When building ginkgo as a static library, we need to use dpcpp and per_kernel # link option when the program uses a dpcpp related function. diff --git a/test/test_exportbuild/CMakeLists.txt b/test/test_exportbuild/CMakeLists.txt index c65f964d9a0..cb8f0b1225c 100644 --- a/test/test_exportbuild/CMakeLists.txt +++ b/test/test_exportbuild/CMakeLists.txt @@ -7,5 +7,4 @@ find_package(Ginkgo REQUIRED # Here, we use test install without any data. We instantiate the # interface only. add_executable(test_exportbuild ../test_install/test_install.cpp) -target_compile_features(test_exportbuild PUBLIC cxx_std_14) target_link_libraries(test_exportbuild PRIVATE Ginkgo::ginkgo) diff --git a/test/test_install/CMakeLists.txt b/test/test_install/CMakeLists.txt index 60fad7cf339..285c21f271b 100644 --- a/test/test_install/CMakeLists.txt +++ b/test/test_install/CMakeLists.txt @@ -26,7 +26,6 @@ if (GINKGO_BUILD_REFERENCE) set(HAS_REFERENCE 1) endif() add_executable(test_install test_install.cpp) -target_compile_features(test_install PUBLIC cxx_std_14) target_compile_definitions(test_install PRIVATE HAS_REFERENCE=${HAS_REFERENCE}) target_link_libraries(test_install PRIVATE Ginkgo::ginkgo) if(GINKGO_BUILD_MPI) diff --git a/test/test_pkgconfig/CMakeLists.txt b/test/test_pkgconfig/CMakeLists.txt index e904f997f26..12b9fc4dc26 100644 --- a/test/test_pkgconfig/CMakeLists.txt +++ b/test/test_pkgconfig/CMakeLists.txt @@ -8,7 +8,7 @@ pkg_check_modules(GINKGO REQUIRED IMPORTED_TARGET ginkgo) # Here, we use test install without any data. We instantiate the # interface only. add_executable(test_pkgconfig ../test_install/test_install.cpp) -target_compile_features(test_pkgconfig PUBLIC cxx_std_14) +target_compile_features(test_pkgconfig PUBLIC cxx_std_17) # CMake PkgConfig only puts the -l, -L, and -framework into link_libraries and others into link_options # When linking the target, the linking option will be before the compiled object to lead the linking error set_property(TARGET PkgConfig::GINKGO PROPERTY INTERFACE_LINK_LIBRARIES "${GINKGO_LDFLAGS}") diff --git a/test/test_subdir/CMakeLists.txt b/test/test_subdir/CMakeLists.txt index dcf846f4adc..00ae3bc07e2 100644 --- a/test/test_subdir/CMakeLists.txt +++ b/test/test_subdir/CMakeLists.txt @@ -5,5 +5,4 @@ file(CREATE_LINK "${CMAKE_CURRENT_SOURCE_DIR}/../.." "${CMAKE_CURRENT_BINARY_DIR add_subdirectory("${CMAKE_CURRENT_BINARY_DIR}/ginkgo") add_executable(test_subdir ../test_install/test_install.cpp) -target_compile_features(test_subdir PUBLIC cxx_std_14) target_link_libraries(test_subdir PRIVATE Ginkgo::ginkgo) From 718a42d225f08b6330d162dcf6afffb916fc8196 Mon Sep 17 00:00:00 2001 From: Tobias Ribizel Date: Wed, 1 May 2024 17:23:14 +0200 Subject: [PATCH 05/13] remove unsupported compilers --- .gitlab-ci.yml | 160 ++++------------------------------------------ .gitlab/image.yml | 27 -------- 2 files changed, 14 insertions(+), 173 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1866f16406a..88748c95b79 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -93,138 +93,6 @@ trigger_pipeline: # Build jobs # Job with example runs. -# cuda 10.1 and friends -# Build CUDA NVIDIA without omp -# Make sure that our jobs run when HWLOC is -# forcibly switched off -build/cuda101/nompi/clang/cuda_wo_omp/release/shared: - extends: - - .build_template - - .default_variables - - .full_test_condition - - .use_gko-cuda101-openmpi-gnu8-llvm7-intel2019 - variables: - CXX_COMPILER: "clang++" - BUILD_CUDA: "ON" - BUILD_HWLOC: "OFF" - BUILD_TYPE: "Release" - CUDA_ARCH: 35 - -# Job with example runs. -# Also explicitly test PAPI SDE -build/cuda101/openmpi/gcc/all/debug/shared: - extends: - - .build_template - - .default_variables - - .quick_test_condition - - .use_gko-cuda101-openmpi-gnu8-llvm7-intel2019 - variables: - BUILD_OMP: "ON" - BUILD_CUDA: "ON" - BUILD_MPI: "ON" - MPI_AS_ROOT: "ON" - BUILD_TYPE: "Debug" - BUILD_PAPI_SDE: "ON" - CUDA_ARCH: 35 - -build/cuda101/nompi/clang/all/release/static: - extends: - - .build_template - - .default_variables - - .full_test_condition - - .use_gko-cuda101-openmpi-gnu8-llvm7-intel2019 - variables: - CXX_COMPILER: "clang++" - BUILD_OMP: "ON" - BUILD_CUDA: "ON" - BUILD_TYPE: "Release" - BUILD_SHARED_LIBS: "OFF" - CUDA_ARCH: 35 - -# clang-cuda with cuda 10.1 and friends -#build/clang-cuda101/openmpi/clang/cuda/release/shared: -# extends: -# - .build_and_test_template -# - .default_variables -# - .quick_test_condition -# - .use_gko-cuda101-openmpi-gnu8-llvm13-intel2019 -# variables: -# CXX_COMPILER: "clang++" -# CUDA_COMPILER: "clang++" -# BUILD_OMP: "ON" -# BUILD_CUDA: "ON" -# BUILD_MPI: "ON" -# MPI_AS_ROOT: "ON" -# BUILD_HIP: "OFF" -# BUILD_TYPE: "Release" - - -#build/clang-cuda101/nompi/clang/cuda/debug/static: -# extends: -# - .build_and_test_template -# - .default_variables -# - .full_test_condition -# - .use_gko-cuda101-openmpi-gnu8-llvm13-intel2019 -# variables: -# CXX_COMPILER: "clang++" -# CUDA_COMPILER: "clang++" -# BUILD_OMP: "ON" -# BUILD_CUDA: "ON" -# BUILD_TYPE: "Debug" -# FAST_TESTS: "ON" -# BUILD_SHARED_LIBS: "OFF" - - -# cuda 10.2 and friends - -# works when there is no hwloc and tpl hwloc is also switched off. -build/cuda102/nompi/gcc/all/debug/shared: - extends: - - .build_template - - .default_variables - - .full_test_condition - - .use_gko-cuda102-nompi-gnu8-llvm8-intel2019 - variables: - BUILD_OMP: "ON" - BUILD_CUDA: "ON" - BUILD_TYPE: "Debug" - FAST_TESTS: "ON" - BUILD_HWLOC: "OFF" - CUDA_ARCH: 35 - -# Use TPL hwloc when no system hwloc is available -build/cuda102/nompi/clang/all/release/static: - extends: - - .build_template - - .default_variables - - .full_test_condition - - .use_gko-cuda102-nompi-gnu8-llvm8-intel2019 - variables: - CXX_COMPILER: "clang++" - BUILD_OMP: "ON" - BUILD_CUDA: "ON" - BUILD_TYPE: "Release" - BUILD_SHARED_LIBS: "OFF" - CUDA_ARCH: 35 - BUILD_HWLOC: "OFF" - -build/cuda102/nompi/intel/cuda/debug/static: - extends: - - .build_template - - .default_variables - - .full_test_condition - - .use_gko-cuda102-nompi-gnu8-llvm8-intel2019 - variables: - CXX_COMPILER: "icpc" - CXX_FLAGS: "" - BUILD_OMP: "ON" - BUILD_CUDA: "ON" - BUILD_TYPE: "Debug" - FAST_TESTS: "ON" - BUILD_SHARED_LIBS: "OFF" - CUDA_ARCH: 35 - BUILD_HWLOC: "OFF" - # cuda 11.0 and friends on HoreKa with tests build/cuda110/mvapich2/gcc/cuda/debug/shared: extends: @@ -521,13 +389,13 @@ build/nocuda/openmpi/clang/omp/glibcxx-debug-release/shared: # The tests are prohibitively slow in Debug BUILD_TYPE: "Release" -# nocuda with the oldest supported compiler +# nocuda with old compiler build/nocuda/nompi/gcc/omp/release/static: extends: - .build_and_test_template - .default_variables - .quick_test_condition - - .use_gko-nocuda-mvapich2-gnu5-llvm39-intel2019 + - .use_gko-nocuda-nompi-gnu9-llvm8 variables: BUILD_OMP: "ON" BUILD_TYPE: "Release" @@ -538,7 +406,7 @@ build/nocuda-nomixed/nompi/clang/omp/release/static: - .build_and_test_template - .default_variables - .full_test_condition - - .use_gko-nocuda-mvapich2-gnu5-llvm39-intel2019 + - .use_gko-nocuda-nompi-gnu9-llvm8 variables: CXX_COMPILER: "clang++" BUILD_OMP: "ON" @@ -668,7 +536,7 @@ warnings: - .build_template - .default_variables - .full_test_condition - - .use_gko-cuda101-openmpi-gnu8-llvm7-intel2019 + - .use_gko-cuda110-mvapich2-gnu9-llvm9-intel2020 variables: BUILD_OMP: "ON" BUILD_CUDA: "ON" @@ -682,7 +550,7 @@ no-circular-deps: - .build_template - .default_variables - .quick_test_condition - - .use_gko-cuda101-openmpi-gnu8-llvm7-intel2019 + - .use_gko-cuda110-mvapich2-gnu9-llvm9-intel2020 variables: BUILD_OMP: "ON" BUILD_CUDA: "ON" @@ -709,7 +577,7 @@ clang-tidy: - .build_template - .default_variables - .full_test_condition - - .use_gko-cuda101-openmpi-gnu8-llvm7-intel2019 + - .use_gko-cuda110-mvapich2-gnu9-llvm9-intel2020 variables: BUILD_OMP: "ON" BUILD_CUDA: "ON" @@ -722,7 +590,7 @@ iwyu: - .build_template - .default_variables - .full_test_condition - - .use_gko-cuda101-openmpi-gnu8-llvm7-intel2019 + - .use_gko-cuda110-mvapich2-gnu9-llvm9-intel2020 variables: BUILD_OMP: "ON" BUILD_CUDA: "ON" @@ -737,7 +605,7 @@ sonarqube_cov_: - .default_variables - .quick_test_short_lived_condition - .before_script_template - - .use_gko-cuda101-openmpi-gnu8-llvm7-intel2019 + - .use_gko-cuda110-mvapich2-gnu9-llvm9-intel2020 tags: - private_ci - controller @@ -773,7 +641,7 @@ sonarqube_cov: - .default_variables - .deploy_condition - .before_script_template - - .use_gko-cuda101-openmpi-gnu8-llvm7-intel2019 + - .use_gko-cuda110-mvapich2-gnu9-llvm9-intel2020 tags: - private_ci - controller @@ -836,7 +704,7 @@ threadsanitizer: - .default_variables - .deploy_condition - .before_script_template - - .use_gko-cuda101-openmpi-gnu8-llvm13-intel2019 + - .use_gko-cuda110-mvapich2-gnu9-llvm9-intel2020 script: - LD_PRELOAD=/usr/local/lib/libomp.so CC=clang CXX=clang++ @@ -851,7 +719,7 @@ leaksanitizer: - .default_variables - .deploy_condition - .before_script_template - - .use_gko-cuda101-openmpi-gnu8-llvm13-intel2019 + - .use_gko-cuda110-mvapich2-gnu9-llvm9-intel2020 script: - ctest -V -S cmake/CTestScript.cmake -DCTEST_BUILD_CONFIGURATION=LSAN -DCTEST_MEMORYCHECK_TYPE=LeakSanitizer @@ -862,7 +730,7 @@ addresssanitizer: - .default_variables - .deploy_condition - .before_script_template - - .use_gko-cuda101-openmpi-gnu8-llvm13-intel2019 + - .use_gko-cuda110-mvapich2-gnu9-llvm9-intel2020 script: - ctest -V -S cmake/CTestScript.cmake -DCTEST_BUILD_CONFIGURATION=ASAN -DCTEST_MEMORYCHECK_TYPE=AddressSanitizer @@ -873,7 +741,7 @@ undefinedsanitizer: - .default_variables - .deploy_condition - .before_script_template - - .use_gko-cuda101-openmpi-gnu8-llvm13-intel2019 + - .use_gko-cuda110-mvapich2-gnu9-llvm9-intel2020 script: # the Gold linker is required because of a linker flag issues given by UBsan # in the Ubuntu setup we are using. @@ -886,7 +754,7 @@ cudamemcheck: - .before_script_template - .default_variables - .deploy_condition - image: ginkgohub/cuda:101-openmpi-gnu8-llvm13-intel2019 + image: use_gko-cuda110-mvapich2-gnu9-llvm9-intel2020 tags: - private_ci - nvidia-gpu diff --git a/.gitlab/image.yml b/.gitlab/image.yml index da548066a86..60521044d7f 100644 --- a/.gitlab/image.yml +++ b/.gitlab/image.yml @@ -17,33 +17,6 @@ - cpu - amdci -.use_gko-nocuda-mvapich2-gnu5-llvm39-intel2019: - image: ginkgohub/cpu:mvapich2-gnu5-llvm39-intel2019 - tags: - - private_ci - - cpu - - controller - -.use_gko-cuda101-openmpi-gnu8-llvm7-intel2019: - image: ginkgohub/cuda:101-openmpi-gnu8-llvm7-intel2019 - tags: - - private_ci - - controller - - cpu - -.use_gko-cuda101-openmpi-gnu8-llvm13-intel2019: - image: ginkgohub/cuda:101-openmpi-gnu8-llvm13-intel2019 - tags: - - private_ci - - nvidia-gpu - -.use_gko-cuda102-nompi-gnu8-llvm8-intel2019: - image: ginkgohub/cuda:102-nompi-gnu8-llvm8-intel2019 - tags: - - private_ci - - controller - - cpu - .use_gko-cuda110-mvapich2-gnu9-llvm9-intel2020: image: ginkgohub/cuda:110-mvapich2-gnu9-llvm9-intel2020 tags: From 11158058d968479575fc2f098de1c1fc88fa7c9e Mon Sep 17 00:00:00 2001 From: Tobias Ribizel Date: Thu, 4 Jul 2024 14:09:50 +0200 Subject: [PATCH 06/13] use compile features for specifying HIP/CUDA standard version --- cmake/build_helpers.cmake | 10 ++++++---- examples/custom-matrix-format/CMakeLists.txt | 3 --- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/cmake/build_helpers.cmake b/cmake/build_helpers.cmake index f0337839a55..0985f089382 100644 --- a/cmake/build_helpers.cmake +++ b/cmake/build_helpers.cmake @@ -19,10 +19,12 @@ endfunction() function(ginkgo_compile_features name) target_compile_features("${name}" PUBLIC cxx_std_17) - # we set these properties regardless of the enabled backends, - # because unknown properties are ignored - set_target_properties("${name}" PROPERTIES HIP_STANDARD 17) - set_target_properties("${name}" PROPERTIES CUDA_STANDARD 17) + if (GINKG_BUILD_CUDA) + target_compile_features("${name}" PUBLIC cuda_std_17) + endif() + if (GINKG_BUILD_HIP) + target_compile_features("${name}" PUBLIC hip_std_17) + endif() if(GINKGO_WITH_CLANG_TIDY AND GINKGO_CLANG_TIDY_PATH) set_property(TARGET "${name}" PROPERTY CXX_CLANG_TIDY "${GINKGO_CLANG_TIDY_PATH};-checks=*") endif() diff --git a/examples/custom-matrix-format/CMakeLists.txt b/examples/custom-matrix-format/CMakeLists.txt index 502eb7d4244..493437f9789 100644 --- a/examples/custom-matrix-format/CMakeLists.txt +++ b/examples/custom-matrix-format/CMakeLists.txt @@ -12,9 +12,6 @@ if(NOT (GINKGO_BUILD_CUDA AND GINKGO_BUILD_OMP)) "This example needs Ginkgo built with CUDA and OpenMP support") endif() -set(CMAKE_CUDA_STANDARD 17) -set(CMAKE_CUDA_STANDARD_REQUIRED ON) - add_executable(custom-matrix-format custom-matrix-format.cpp stencil_kernel.cu) target_link_libraries(custom-matrix-format Ginkgo::ginkgo OpenMP::OpenMP_CXX) From 763b637f5126cfdf988edecabe6b99f6a0df4fa1 Mon Sep 17 00:00:00 2001 From: Tobias Ribizel Date: Fri, 5 Jul 2024 11:47:01 +0200 Subject: [PATCH 07/13] update version requirements --- README.md | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 4c595de2ba5..25962ef7deb 100644 --- a/README.md +++ b/README.md @@ -40,10 +40,10 @@ For Ginkgo core library: * _cmake 3.16+_ * C++17 compliant compiler, one of: - * _gcc 5.5+_ - * _clang 3.9+_ + * _gcc 7+_ + * _clang 5+_ * _Intel compiler 2019+_ - * _Apple Clang 14.0_ is tested. Earlier versions might also work. + * _Apple Clang 15.0_ is tested. Earlier versions might also work. * _Cray Compiler 14.0.1+_ * _NVHPC Compiler 22.7+_ @@ -59,9 +59,7 @@ The Ginkgo CUDA module has the following __additional__ requirements: The Ginkgo HIP module has the following __additional__ requirements: * _ROCm 4.5+_ -* the HIP, hipBLAS, hipSPARSE, hip/rocRAND and rocThrust packages compiled with either: - * _AMD_ backend (using the `clang` compiler) - * _10.1 <= CUDA < 11_ backend +* the HIP, hipBLAS, hipSPARSE, hip/rocRAND and rocThrust packages compiled with the ROCm backend * if the hipFFT package is available, it is used to implement the FFT LinOps. * _cmake 3.21+_ @@ -69,7 +67,6 @@ The Ginkgo DPC++(SYCL) module has the following __additional__ requirements: * _oneAPI 2023.1+_ * Set `dpcpp` or `icpx` as the `CMAKE_CXX_COMPILER` -* `c++17` is used to compile Ginkgo * The following oneAPI packages should be available: * oneMKL * oneDPL @@ -81,7 +78,7 @@ The Ginkgo MPI module has the following __additional__ requirements: In addition, if you want to contribute code to Ginkgo, you will also need the following: -* _clang-format 8.0.0+_ (ships as part of _clang_) +* _clang-format 14_ (downloaded automatically by `pre-commit`) * _clang-tidy_ (optional, when setting the flag `-DGINKGO_WITH_CLANG_TIDY=ON`) * _iwyu_ (Include What You Use, optional, when setting the flag `-DGINKGO_WITH_IWYU=ON`) @@ -89,7 +86,7 @@ following: * _cmake 3.16+_ * C++17 compliant 64-bit compiler: - * _MinGW : gcc 5.5+_ + * _MinGW : gcc 7+_ * _Microsoft Visual Studio : VS 2019+_ The Ginkgo CUDA module has the following __additional__ requirements: From b17b01abba6325dfa63bbe58aedc7f74189bb183 Mon Sep 17 00:00:00 2001 From: Tobias Ribizel Date: Fri, 5 Jul 2024 11:51:16 +0200 Subject: [PATCH 08/13] remove older std_extensions --- cuda/base/pointer_mode_guard.hpp | 2 +- include/ginkgo/core/base/std_extensions.hpp | 39 ++++----------------- 2 files changed, 8 insertions(+), 33 deletions(-) diff --git a/cuda/base/pointer_mode_guard.hpp b/cuda/base/pointer_mode_guard.hpp index 56f46fedf40..6340b98eb6f 100644 --- a/cuda/base/pointer_mode_guard.hpp +++ b/cuda/base/pointer_mode_guard.hpp @@ -50,7 +50,7 @@ class pointer_mode_guard { ~pointer_mode_guard() noexcept(false) { /* Ignore the error during stack unwinding for this call */ - if (std::uncaught_exception() > uncaught_exceptions_) { + if (std::uncaught_exceptions() > uncaught_exceptions_) { cublasSetPointerMode(*l_handle, CUBLAS_POINTER_MODE_DEVICE); } else { GKO_ASSERT_NO_CUBLAS_ERRORS( diff --git a/include/ginkgo/core/base/std_extensions.hpp b/include/ginkgo/core/base/std_extensions.hpp index 85857873f24..842ad86a23f 100644 --- a/include/ginkgo/core/base/std_extensions.hpp +++ b/include/ginkgo/core/base/std_extensions.hpp @@ -11,6 +11,8 @@ #include #include +#include "ginkgo/core/base/types.hpp" + // This header provides implementations of useful utilities introduced into the // C++ standard after C++14 (e.g. C++17 and C++20). @@ -25,33 +27,12 @@ namespace gko { * @ingroup xstd */ namespace xstd { -namespace detail { - - -template -struct make_void { - using type = void; -}; - - -} // namespace detail - - -// Added in C++17 template -using void_t = typename detail::make_void::type; +using void_t = std::void_t; -// Disable deprecation warnings when using standard > C++14 -inline bool uncaught_exception() noexcept -{ -// MSVC uses _MSVC_LANG as __cplusplus -#if (defined(_MSVC_LANG) && _MSVC_LANG > 201402L) || __cplusplus > 201402L - return std::uncaught_exceptions() > 0; -#else - return std::uncaught_exception(); -#endif -} +GKO_DEPRECATED("use std::uncaught_exceptions") +inline bool uncaught_exception() noexcept { return std::uncaught_exception(); } // Kept for backward compatibility. @@ -101,14 +82,8 @@ constexpr bool less_equal(const T&& lhs, const T&& rhs) } -// available in with C++17 -template -struct conjunction : std::true_type {}; -template -struct conjunction : B1 {}; -template -struct conjunction - : std::conditional_t, B1> {}; +template +using conjunction = std::conjunction; } // namespace xstd From f63f6221e7ebac637b919713eae21189dadec2b8 Mon Sep 17 00:00:00 2001 From: Tobias Ribizel Date: Fri, 5 Jul 2024 11:53:13 +0200 Subject: [PATCH 09/13] remove unsupported Intel + CUDA build --- .gitlab-ci.yml | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 88748c95b79..687b517bf78 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -159,40 +159,6 @@ test/cuda110/nompi/clang/cuda/release/static: needs: [ "build/cuda110/nompi/clang/cuda/release/static" ] -build/cuda110/nompi/intel/cuda/debug/static: - extends: - - .build_template - - .default_variables - - .full_test_condition - - .use_gko-cuda110-mvapich2-gnu9-llvm9-intel2020 - variables: - CXX_COMPILER: "icpc" - CXX_FLAGS: "" - BUILD_OMP: "ON" - BUILD_CUDA: "ON" - BUILD_TYPE: "Debug" - FAST_TESTS: "ON" - BUILD_SHARED_LIBS: "OFF" - CUDA_ARCH: 80 - USE_NAME: "cuda110-nompi-intel-${CI_PIPELINE_ID}" - KEEP_CONTAINER: "ON" - USE_SLURM: 0 - -test/cuda110/nompi/intel/cuda/debug/static: - extends: - - .horeka_test_template - - .default_variables - - .full_test_condition - - .use_gko-cuda110-mvapich2-gnu9-llvm9-intel2020 - variables: - USE_NAME: "cuda110-nompi-intel-${CI_PIPELINE_ID}" - SLURM_PARTITION: "accelerated" - SLURM_GRES: "gpu:4" - SLURM_TIME: "02:00:00" - dependencies: null - needs: [ "build/cuda110/nompi/intel/cuda/debug/static" ] - - # cuda 11.4 and friends build/cuda114/nompi/gcc/cuda/debug/shared: extends: From bc6ff65bfee19494565dba891c927e6d403877c4 Mon Sep 17 00:00:00 2001 From: Tobias Ribizel Date: Fri, 5 Jul 2024 12:22:59 +0200 Subject: [PATCH 10/13] review updates and formatting --- .gitlab-ci.yml | 2 +- core/log/profiler_hook.cpp | 7 ------- core/log/profiler_hook.hpp | 5 ++--- include/ginkgo/core/base/std_extensions.hpp | 5 ++++- include/ginkgo/core/log/profiler_hook.hpp | 3 +-- include/ginkgo/core/solver/solver_traits.hpp | 1 - 6 files changed, 8 insertions(+), 15 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 687b517bf78..8fd46cac12f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -720,7 +720,7 @@ cudamemcheck: - .before_script_template - .default_variables - .deploy_condition - image: use_gko-cuda110-mvapich2-gnu9-llvm9-intel2020 + image: ginkgohub/cuda:110-mvapich2-gnu9-llvm9-intel2020 tags: - private_ci - nvidia-gpu diff --git a/core/log/profiler_hook.cpp b/core/log/profiler_hook.cpp index 7cb4f807919..e3ed0ad8299 100644 --- a/core/log/profiler_hook.cpp +++ b/core/log/profiler_hook.cpp @@ -431,13 +431,6 @@ profiling_scope_guard::~profiling_scope_guard() } } -profiling_scope_guard::profiling_scope_guard(profiling_scope_guard&& other) - : empty_{std::exchange(other.empty_, true)}, - name_{std::exchange(other.name_, nullptr)}, - category_{other.category_}, - end_{std::move(other.end_)} -{} - } // namespace log } // namespace gko diff --git a/core/log/profiler_hook.hpp b/core/log/profiler_hook.hpp index 31d1d1b5a83..c4e31c76ef3 100644 --- a/core/log/profiler_hook.hpp +++ b/core/log/profiler_hook.hpp @@ -6,11 +6,10 @@ #define GKO_CORE_LOG_PROFILER_HOOK_HPP_ -#include - - #include +#include + namespace gko { namespace log { diff --git a/include/ginkgo/core/base/std_extensions.hpp b/include/ginkgo/core/base/std_extensions.hpp index 842ad86a23f..893b2b0d865 100644 --- a/include/ginkgo/core/base/std_extensions.hpp +++ b/include/ginkgo/core/base/std_extensions.hpp @@ -32,7 +32,10 @@ using void_t = std::void_t; GKO_DEPRECATED("use std::uncaught_exceptions") -inline bool uncaught_exception() noexcept { return std::uncaught_exception(); } +inline bool uncaught_exception() noexcept +{ + return std::uncaught_exceptions() > 0; +} // Kept for backward compatibility. diff --git a/include/ginkgo/core/log/profiler_hook.hpp b/include/ginkgo/core/log/profiler_hook.hpp index 5db0e1275f5..c5dc9dcbab6 100644 --- a/include/ginkgo/core/log/profiler_hook.hpp +++ b/include/ginkgo/core/log/profiler_hook.hpp @@ -419,8 +419,7 @@ class profiling_scope_guard { profiling_scope_guard(const profiling_scope_guard&) = delete; - /** Move-constructs from another scope guard, other will be left empty. */ - profiling_scope_guard(profiling_scope_guard&& other); + profiling_scope_guard(profiling_scope_guard&& other) = delete; profiling_scope_guard& operator=(const profiling_scope_guard&) = delete; diff --git a/include/ginkgo/core/solver/solver_traits.hpp b/include/ginkgo/core/solver/solver_traits.hpp index d5306f56b08..6209cad3e90 100644 --- a/include/ginkgo/core/solver/solver_traits.hpp +++ b/include/ginkgo/core/solver/solver_traits.hpp @@ -8,7 +8,6 @@ #include - #include From 1334ea7698834e0ef667ec490279973deb975fb6 Mon Sep 17 00:00:00 2001 From: Tobias Ribizel Date: Mon, 8 Jul 2024 15:17:07 +0200 Subject: [PATCH 11/13] add build-only job for SM 3.5 --- .gitlab-ci.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8fd46cac12f..055a7988a0c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -175,6 +175,25 @@ build/cuda114/nompi/gcc/cuda/debug/shared: CXX_FLAGS: "-Wno-error=maybe-uninitialized" # disable spurious unused argument warning EXTRA_CMAKE_FLAGS: "-DCMAKE_CUDA_FLAGS=-diag-suppress=177" + + +build/cuda114/nompi/clang/cuda/release/shared: + extends: + - .build_template + - .default_variables + - .quick_test_condition + - .use_gko_cuda114-openmpi-gnu10-llvm12 + variables: + CXX_COMPILER: "clang++" + CUDA_ARCH: 35 + BUILD_OMP: "ON" + BUILD_CUDA: "ON" + BUILD_TYPE: "Release" + FAST_TESTS: "ON" + # fix gtest issue https://github.com/google/googletest/issues/3514 + CXX_FLAGS: "-Wno-error=maybe-uninitialized" + # disable spurious unused argument warning + EXTRA_CMAKE_FLAGS: "-DCMAKE_CUDA_FLAGS=-diag-suppress=177" # nvhpc and friends From 4cc92498371f53b5719dfb8569224be13f92e250 Mon Sep 17 00:00:00 2001 From: Tobias Ribizel Date: Mon, 8 Jul 2024 16:48:47 +0200 Subject: [PATCH 12/13] remove warning flags --- .gitlab-ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 055a7988a0c..03e4b5ad4d0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -190,8 +190,6 @@ build/cuda114/nompi/clang/cuda/release/shared: BUILD_CUDA: "ON" BUILD_TYPE: "Release" FAST_TESTS: "ON" - # fix gtest issue https://github.com/google/googletest/issues/3514 - CXX_FLAGS: "-Wno-error=maybe-uninitialized" # disable spurious unused argument warning EXTRA_CMAKE_FLAGS: "-DCMAKE_CUDA_FLAGS=-diag-suppress=177" From f57055994e4668f7b61f004bb5b816bd1a5519f5 Mon Sep 17 00:00:00 2001 From: Tobias Ribizel Date: Mon, 8 Jul 2024 21:28:18 +0200 Subject: [PATCH 13/13] move to a compatible nvcc/clang combination nvcc with clang++ host compiler seems incompatible with libstdc++-10 --- .gitlab-ci.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 03e4b5ad4d0..2f8e3a892a5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -157,39 +157,39 @@ test/cuda110/nompi/clang/cuda/release/static: SLURM_TIME: "01:30:00" dependencies: null needs: [ "build/cuda110/nompi/clang/cuda/release/static" ] + - -# cuda 11.4 and friends -build/cuda114/nompi/gcc/cuda/debug/shared: +build/cuda110/nompi/clang/cuda/release/shared: extends: - - .build_and_test_template + - .build_template - .default_variables - .quick_test_condition - - .use_gko_cuda114-openmpi-gnu10-llvm12 + - .use_gko-cuda110-mvapich2-gnu9-llvm9-intel2020 variables: + CXX_COMPILER: "clang++" + CUDA_ARCH: 52 BUILD_OMP: "ON" BUILD_CUDA: "ON" - BUILD_TYPE: "Debug" + BUILD_TYPE: "Release" FAST_TESTS: "ON" - # fix gtest issue https://github.com/google/googletest/issues/3514 - CXX_FLAGS: "-Wno-error=maybe-uninitialized" # disable spurious unused argument warning EXTRA_CMAKE_FLAGS: "-DCMAKE_CUDA_FLAGS=-diag-suppress=177" - -build/cuda114/nompi/clang/cuda/release/shared: + +# cuda 11.4 and friends +build/cuda114/nompi/gcc/cuda/debug/shared: extends: - - .build_template + - .build_and_test_template - .default_variables - .quick_test_condition - .use_gko_cuda114-openmpi-gnu10-llvm12 variables: - CXX_COMPILER: "clang++" - CUDA_ARCH: 35 BUILD_OMP: "ON" BUILD_CUDA: "ON" - BUILD_TYPE: "Release" + BUILD_TYPE: "Debug" FAST_TESTS: "ON" + # fix gtest issue https://github.com/google/googletest/issues/3514 + CXX_FLAGS: "-Wno-error=maybe-uninitialized" # disable spurious unused argument warning EXTRA_CMAKE_FLAGS: "-DCMAKE_CUDA_FLAGS=-diag-suppress=177"