From 47ffae70e2ba24a9194a63f330fc003ca64f91c6 Mon Sep 17 00:00:00 2001 From: Frederik Hennig <frederik.hennig@fau.de> Date: Mon, 24 Mar 2025 11:41:28 +0100 Subject: [PATCH] fix: do not #include inside a namespace, you moron! --- lib/walberla/experimental/memory/MemoryTags.hpp | 9 +++++++-- .../experimental/memory/UnifiedMemoryAllocator.hpp | 9 +++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/walberla/experimental/memory/MemoryTags.hpp b/lib/walberla/experimental/memory/MemoryTags.hpp index f6c1f70..902d739 100644 --- a/lib/walberla/experimental/memory/MemoryTags.hpp +++ b/lib/walberla/experimental/memory/MemoryTags.hpp @@ -5,6 +5,13 @@ #include <concepts> #include <memory> +#if defined(WALBERLA_BUILD_WITH_CUDA) || defined(WALBERLA_BUILD_WITH_HIP) + +#include "./UnifiedMemoryAllocator.hpp" + +#endif + + namespace walberla::experimental::memory { @@ -52,8 +59,6 @@ struct SelectStandardAllocator< memtag::host > /* If CUDA or HIP are active, use the managed memory allocator for unified memory */ -#include "./UnifiedMemoryAllocator.hpp" - template<> struct SelectStandardAllocator< memtag::unified > { diff --git a/lib/walberla/experimental/memory/UnifiedMemoryAllocator.hpp b/lib/walberla/experimental/memory/UnifiedMemoryAllocator.hpp index e30afec..e08b16c 100644 --- a/lib/walberla/experimental/memory/UnifiedMemoryAllocator.hpp +++ b/lib/walberla/experimental/memory/UnifiedMemoryAllocator.hpp @@ -1,13 +1,14 @@ #pragma once #include "waLBerlaDefinitions.h" + +#if defined(WALBERLA_BUILD_WITH_CUDA) || defined(WALBERLA_BUILD_WITH_HIP) + #include "gpu/GPUWrapper.h" #include "gpu/ErrorChecking.h" namespace walberla::experimental::memory { - -#if defined(WALBERLA_BUILD_WITH_CUDA) || defined(WALBERLA_BUILD_WITH_HIP) /** * @brief Allocator for managed GPU memory. @@ -44,6 +45,6 @@ class UnifiedMemoryAllocator } }; -#endif - } // namespace walberla::experimental::memory + +#endif -- GitLab