diff --git a/algo/base/util/EnumDict.h b/algo/base/util/EnumDict.h
index be1a740ecf509662baa0341ce3b9ca30a492232d..9bd598e296d9d36b17dcc27696b7ee8fcb5dbe11 100644
--- a/algo/base/util/EnumDict.h
+++ b/algo/base/util/EnumDict.h
@@ -7,13 +7,14 @@
 #include <boost/algorithm/string/predicate.hpp>
 
 #include <algorithm>
-#include <iostream>
+#include <iosfwd>
 #include <optional>
 #include <stdexcept>
 #include <string_view>
 #include <vector>
 
 #include <fmt/format.h>
+#include <xpu/defines.h>
 
 namespace cbm::algo
 {
@@ -57,6 +58,7 @@ namespace cbm::algo
   }
 }  // namespace cbm::algo
 
+#if XPU_IS_CPU
 /**
    * @brief Convert enums to strings and back.
    *
@@ -87,7 +89,10 @@ namespace cbm::algo
   template<>                                                                                                           \
   struct cbm::algo::detail::EnumHasDict<type> : std::true_type {                                                       \
   }
-
+#else  // XPU_IS_CPU
+// Disable macro in GPU code, causes some issues with nvcc
+#define CBM_ENUM_DICT(type, ...)
+#endif  // XPU_IS_CPU
 
 // Stream operators for enums
 // Placed in global namespace to be found by ADL e.g. for std::ostream_iterator