File MemoryManager.hpp

Parent directory (core/include)

Singleton RAII owner of all solver buffers (host and device).

Definition (core/include/MemoryManager.hpp)

Detailed Description

The Class MemoryManager owns every allocated block and tracks it in an internal registry. It supports two back‑ends:

  1. Unified Memory (UM) – single pointer via cudaMallocManaged with optional cudaMemPrefetchAsync.

  2. Explicit mirrors – separate host/device buffers with async H2D/D2H.

Thread‑safety

All public methods are thread‑safe. The registry is protected by a mutex.

Typical use

auto& mm = MemoryManager::instance();
// Allocate SoA arrays with ghosts
double* rho = mm.allocate<double>(nx_tot*ny_tot*nz_tot);
// Transfer before a GPU kernel when not using UM
mm.to_device(rho, bytes, stream);
// On shutdown or scope end, release once
mm.release(rho);

Non‑owning views (Field<T>) should wrap the returned pointer for safer access.

Includes

Included By

Namespaces

Classes

Enums