include/pops/core/foundation/kokkos_env.hpp File ReferenceΒΆ
|
adc_cpp 0.3.0
Model-free C++23 core for coupled hyperbolic-elliptic systems on adaptive (AMR) meshes, with MPI and GPU (Kokkos) backends
|
Shared Kokkos lifecycle: lazy init + device barrier. More...
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Namespaces | |
| namespace | pops |
Functions | |
| void | pops::device_fence () |
| Device barrier: waits for in-flight kernels to finish before a HOST access to unified memory. | |
Detailed Description
Shared Kokkos lifecycle: lazy init + device barrier.
Required since the unified allocator (kokkos_malloc<SharedSpace>) is called AS SOON AS a Fab is built, BEFORE any for_each. Init can therefore no longer be left to the first kernel alone: this same guard applies to allocation AND to kernels, so that the Kokkos build (Serial/OpenMP/Cuda) works without an explicit Kokkos::initialize in each main.
SEQUENCING INVARIANT: detail::ensure_kokkos_initialized() is called by ManagedArena before any kokkos_malloc; device_fence() is called by the host before any access to unified memory after a kernel. These two entry points are the ONLY places where the Kokkos lifecycle is driven; do not call Kokkos::initialize/finalize anywhere else.
Generated by