morton-arithmetic 0.1.0
Fast Morton (Z-order) codes with O(1) arithmetic
Loading...
Searching...
No Matches
hd.hpp File Reference

The MORTON_HD host/device function marker, shared by every core header. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MORTON_HD
 

Detailed Description

The MORTON_HD host/device function marker, shared by every core header.

Defining the marker in one tiny header (rather than inline in morton.hpp) lets headers that morton.hpp includes before its class body — notably wide_uint.hpp — annotate their own operators as device-callable too. Without this, wide_uint's arithmetic could not run inside a Kokkos kernel, which would break a device-resident Morton path for codes wider than 128 bits.

When the Morton Kokkos backend is enabled and Kokkos is already in the translation unit, defer to Kokkos's own function marker: KOKKOS_FUNCTION resolves to the right host/device attributes for whichever backend (CUDA / HIP / OpenMP / Serial) Kokkos was built with — so the same code is callable from a Kokkos kernel on any backend. The raw __CUDACC__/__HIPCC__ branch remains the fallback for a direct nvcc/hipcc compile without Kokkos; an ordinary host build expands it to nothing, leaving the CPU library byte-for-byte unchanged.

SPDX-License-Identifier: MIT

Macro Definition Documentation

◆ MORTON_HD

#define MORTON_HD