diff --git a/src/pystencils/backend/platforms/cuda.py b/src/pystencils/backend/platforms/cuda.py
index 98ff3e3d332a46074931514ba3af1603dc6318b2..c05c45f0461b6c8eb01cf5fc3036b89b49fb661d 100644
--- a/src/pystencils/backend/platforms/cuda.py
+++ b/src/pystencils/backend/platforms/cuda.py
@@ -8,4 +8,6 @@ class CudaPlatform(GenericGpu):
 
     @property
     def required_headers(self) -> set[str]:
-        return set()
+        return {
+            '"gpu_atomics.h"',
+        }
diff --git a/src/pystencils/backend/platforms/hip.py b/src/pystencils/backend/platforms/hip.py
index c758995a0d9f8fbbb2e9e424bf2cfa6ab7eca086..65d844bbbc722aa6adc6b4a02e600f11ad4b1fa7 100644
--- a/src/pystencils/backend/platforms/hip.py
+++ b/src/pystencils/backend/platforms/hip.py
@@ -8,4 +8,7 @@ class HipPlatform(GenericGpu):
 
     @property
     def required_headers(self) -> set[str]:
-        return {'"pystencils_runtime/hip.h"'}
+        return {
+            '"gpu_atomics.h"',
+            '"pystencils_runtime/hip.h"',
+        }