From 49a857b70d61b1ebfb7916f06e20bf8a1fa282af Mon Sep 17 00:00:00 2001 From: Hannes Vogt Date: Tue, 2 Apr 2024 16:22:04 +0200 Subject: [PATCH 1/2] workaround nvcc problems --- include/gridtools/common/defs.hpp | 10 ++++++++++ include/gridtools/fn/column_stage.hpp | 3 +++ include/gridtools/sid/simple_ptr_holder.hpp | 4 +--- tests/unit_tests/common/CMakeLists.txt | 8 ++++---- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/include/gridtools/common/defs.hpp b/include/gridtools/common/defs.hpp index 53fbf4615..c0c1b0106 100644 --- a/include/gridtools/common/defs.hpp +++ b/include/gridtools/common/defs.hpp @@ -9,6 +9,10 @@ */ #pragma once +#if __has_include() +#include +#endif + namespace gridtools { using int_t = int; using uint_t = unsigned int; @@ -58,3 +62,9 @@ namespace gridtools { #else #define GT_NVCC_WORKAROUND_1766 0 #endif + +#if defined(__cpp_deduction_guides) && __cpp_deduction_guides >= 201907L +#define GT_HAS_AGGREGATE_CTAD 1 +#else +#define GT_HAS_AGGREGATE_CTAD 0 +#endif diff --git a/include/gridtools/fn/column_stage.hpp b/include/gridtools/fn/column_stage.hpp index 0a314b124..db965b874 100644 --- a/include/gridtools/fn/column_stage.hpp +++ b/include/gridtools/fn/column_stage.hpp @@ -27,7 +27,10 @@ namespace gridtools::fn { struct scan_pass { F m_f; Projector m_p; + +#if not GT_HAS_AGGREGATE_CTAD constexpr GT_FUNCTION scan_pass(F f, Projector p = {}) : m_f(f), m_p(p) {} +#endif }; template diff --git a/include/gridtools/sid/simple_ptr_holder.hpp b/include/gridtools/sid/simple_ptr_holder.hpp index 38a3b9bd5..3eb2997b7 100644 --- a/include/gridtools/sid/simple_ptr_holder.hpp +++ b/include/gridtools/sid/simple_ptr_holder.hpp @@ -31,9 +31,7 @@ namespace gridtools { struct simple_ptr_holder { T m_val; -#if defined(__cpp_deduction_guides) and __cpp_deduction_guides >= 201907 -// CTAD for aggregates works -#else +#if not GT_HAS_AGGREGATE_CTAD // Enables CTAD in C++17. simple_ptr_holder() = default; GT_TARGET GT_FORCE_INLINE constexpr simple_ptr_holder(T const &ptr) : m_val{ptr} {} diff --git a/tests/unit_tests/common/CMakeLists.txt b/tests/unit_tests/common/CMakeLists.txt index cdc525e10..95694f4d4 100644 --- a/tests/unit_tests/common/CMakeLists.txt +++ b/tests/unit_tests/common/CMakeLists.txt @@ -41,10 +41,10 @@ if(TARGET _gridtools_cuda) SOURCES test_hypercube_iterator.cu LIBRARIES _gridtools_cuda LABELS cuda) - gridtools_add_unit_test(test_int_vector_cuda - SOURCES test_int_vector.cu - LIBRARIES _gridtools_cuda - LABELS cuda) +# gridtools_add_unit_test(test_int_vector_cuda +# SOURCES test_int_vector.cu +# LIBRARIES _gridtools_cuda +# LABELS cuda) gridtools_add_unit_test(test_tuple_cuda SOURCES test_tuple.cu LIBRARIES _gridtools_cuda From cfeeb30eaddb1c4a5a1c91d73ee36671c72214cd Mon Sep 17 00:00:00 2001 From: Hannes Vogt Date: Thu, 13 Jun 2024 14:52:00 +0200 Subject: [PATCH 2/2] Update CMakeLists.txt --- tests/unit_tests/common/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/unit_tests/common/CMakeLists.txt b/tests/unit_tests/common/CMakeLists.txt index 95694f4d4..8934d660c 100644 --- a/tests/unit_tests/common/CMakeLists.txt +++ b/tests/unit_tests/common/CMakeLists.txt @@ -41,10 +41,10 @@ if(TARGET _gridtools_cuda) SOURCES test_hypercube_iterator.cu LIBRARIES _gridtools_cuda LABELS cuda) -# gridtools_add_unit_test(test_int_vector_cuda -# SOURCES test_int_vector.cu -# LIBRARIES _gridtools_cuda -# LABELS cuda) + gridtools_add_unit_test(test_int_vector_cuda + SOURCES test_int_vector.cu + LIBRARIES _gridtools_cuda + LABELS cuda) gridtools_add_unit_test(test_tuple_cuda SOURCES test_tuple.cu LIBRARIES _gridtools_cuda