diff --git a/src/pystencils/backend/platforms/cuda.py b/src/pystencils/backend/platforms/cuda.py index c05c45f0461b6c8eb01cf5fc3036b89b49fb661d..bbb608f5c0963a73441fd2a6f6239d747b45fe69 100644 --- a/src/pystencils/backend/platforms/cuda.py +++ b/src/pystencils/backend/platforms/cuda.py @@ -8,6 +8,4 @@ class CudaPlatform(GenericGpu): @property def required_headers(self) -> set[str]: - return { - '"gpu_atomics.h"', - } + return super().required_headers diff --git a/src/pystencils/backend/platforms/generic_gpu.py b/src/pystencils/backend/platforms/generic_gpu.py index 2a12d6b7bb0d75fb9e664eca7cbac5ef5b2320b3..4f97264b089de1d7263d885f9d13d1498a32fa41 100644 --- a/src/pystencils/backend/platforms/generic_gpu.py +++ b/src/pystencils/backend/platforms/generic_gpu.py @@ -198,6 +198,14 @@ class GenericGpu(Platform): thread_mapping: Callback object which defines the mapping of thread indices onto iteration space points """ + @property + @abstractmethod + def required_headers(self) -> set[str]: + return { + '"gpu_atomics.h"', + "<cmath>", + } + def __init__( self, ctx: KernelCreationContext, @@ -365,9 +373,9 @@ class GenericGpu(Platform): match func: case NumericLimitsFunctions.Min: - define = "NEG_INFINITY" + define = "-INFINITY" case NumericLimitsFunctions.Max: - define = "POS_INFINITY" + define = "INFINITY" case _: raise MaterializationError( f"Cannot materialize call to function {func}" diff --git a/src/pystencils/backend/platforms/hip.py b/src/pystencils/backend/platforms/hip.py index 65d844bbbc722aa6adc6b4a02e600f11ad4b1fa7..c5e8b3882de8600e4bec8c72e71c7a2032eb1f6e 100644 --- a/src/pystencils/backend/platforms/hip.py +++ b/src/pystencils/backend/platforms/hip.py @@ -8,7 +8,6 @@ class HipPlatform(GenericGpu): @property def required_headers(self) -> set[str]: - return { - '"gpu_atomics.h"', + return super().required_headers | { '"pystencils_runtime/hip.h"', }