From 0a486d326b1166873e9cccb145038b63da507350 Mon Sep 17 00:00:00 2001 From: Hannes Vogt Date: Thu, 30 May 2024 14:07:48 +0200 Subject: [PATCH 1/4] Bug: storage/gpu.h functions within __CUDA_ARCH__ --- include/gridtools/storage/gpu.hpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/gridtools/storage/gpu.hpp b/include/gridtools/storage/gpu.hpp index 4d8f619a5..c845c547e 100644 --- a/include/gridtools/storage/gpu.hpp +++ b/include/gridtools/storage/gpu.hpp @@ -44,7 +44,6 @@ namespace gridtools { T *m_ptr; Info m_info; -#ifdef GT_CUDACC GT_FUNCTION_DEVICE auto *data() const { return m_ptr; } GT_FUNCTION_DEVICE auto const &info() const { return m_info; } @@ -62,7 +61,6 @@ namespace gridtools { GT_FUNCTION_DEVICE decltype(auto) operator()(array const &arg) const { return m_ptr[m_info.index_from_tuple(arg)]; } -#endif }; } // namespace gpu_impl_ From 1e6b0743f995f053b205b34da0a82e2aae3b62c2 Mon Sep 17 00:00:00 2001 From: Hannes Vogt Date: Thu, 30 May 2024 14:53:50 +0200 Subject: [PATCH 2/4] within GT_CUDACC --- include/gridtools/storage/gpu.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/gridtools/storage/gpu.hpp b/include/gridtools/storage/gpu.hpp index c845c547e..4d8f619a5 100644 --- a/include/gridtools/storage/gpu.hpp +++ b/include/gridtools/storage/gpu.hpp @@ -44,6 +44,7 @@ namespace gridtools { T *m_ptr; Info m_info; +#ifdef GT_CUDACC GT_FUNCTION_DEVICE auto *data() const { return m_ptr; } GT_FUNCTION_DEVICE auto const &info() const { return m_info; } @@ -61,6 +62,7 @@ namespace gridtools { GT_FUNCTION_DEVICE decltype(auto) operator()(array const &arg) const { return m_ptr[m_info.index_from_tuple(arg)]; } +#endif }; } // namespace gpu_impl_ From 3faab94da0aaa60ace7394bed275d698e1484811 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Tue, 28 May 2024 11:14:58 +0200 Subject: [PATCH 3/4] Define separately neighbor variable to avoid extra memory loads in horizontal_shift() --- include/gridtools/fn/unstructured.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/gridtools/fn/unstructured.hpp b/include/gridtools/fn/unstructured.hpp index 136930c19..d80eefab2 100644 --- a/include/gridtools/fn/unstructured.hpp +++ b/include/gridtools/fn/unstructured.hpp @@ -84,7 +84,8 @@ namespace gridtools::fn { template GT_FUNCTION constexpr auto horizontal_shift(iterator const &it, Conn, Offset) { auto const &table = host_device::at_key(it.m_domain.m_tables); - auto new_index = it.m_index == -1 ? -1 : get(neighbor_table::neighbors(table, it.m_index)); + const auto neighbor = get(neighbor_table::neighbors(table, it.m_index)); + const auto new_index = it.m_index == -1 ? -1 : neighbor; auto shifted = it; shifted.m_index = new_index; return shifted; From d302b0bd9896b7dee94be363aa0d1c6ad4548fc9 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Thu, 6 Jun 2024 10:17:12 +0200 Subject: [PATCH 4/4] Add my name on AUTHORS --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index ec3f45d3d..5474ca65c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -17,3 +17,4 @@ Mikael Simberg (msimberg), ETH Zurich (CSCS) Till Ehrengruber (tehrengruber), ETH Zurich (CSCS) Péter Kardos (petiaccja), ETH Zurich (EXCLAIM) Stefano Ubbiali (stubbiali), ETH Zurich +Ioannis Magkanaris (iomaganaris), ETH Zurich (CSCS)