Architectures API
AtmosTransport.Architectures Module
ArchitecturesExecution architectures and their optional runtime integration.
An architecture is part of a grid's type-level model contract: CPU() selects host execution, while GPU(:cuda) and GPU(:metal) select a concrete GPU runtime. The same object controls array adaptation, device synchronization, and runtime validation, so grid metadata cannot diverge from model storage.
AtmosTransport.Architectures.AbstractArchitectureRequest Type
abstract type AbstractArchitectureRequestA parsed request for an execution architecture. Configuration strings become one of the concrete request types at the configuration boundary; runtime selection then dispatches on the request instead of retaining a string or Symbol selector.
AtmosTransport.Architectures.AbstractPointOp Type
AbstractPointOpA unit of work applied independently at every index of its index space. A concrete operation is a small isbits struct of integers and flags; the arrays it reads and writes travel in a shared context ctx (usually a NamedTuple). It defines two methods:
index_space(op, ctx) -> NTuple{N, Int}
apply_point!(op, ctx, I::Vararg{Int, N}) # @inline; one index, no return valuelaunch!(op, ctx, backend) runs it as one kernel on a device and as a loop over the same body on the host, where bound_context(op, ctx) may first resolve loop-invariant lookups. Operations compose by type:
Fused(ops...): independent operations in one launch. A trailing slot index selects the operation; indices outside an operation's own space are skipped. The operations run concurrently on a device and one after the other on the host, so they must write pairwise-disjoint cells, and no operation may read a cell that another one writes.Sequence(ops...): dependent operations, launched in order (stream order on a device) with one synchronization at the end.
Fusing changes only the launch structure. For operations that satisfy the Fused contract, every index runs the same arithmetic on the same inputs, so results equal those of separate launches bit for bit.
AtmosTransport.Architectures.AutoGPURequest Type
Request automatic detection of a supported GPU runtime.
sourceAtmosTransport.Architectures.CPU Type
struct CPU <: AtmosTransport.Architectures.AbstractArchitectureHost CPU execution architecture.
sourceAtmosTransport.Architectures.Fused Type
Fused(ops::AbstractPointOp...)
Fused(ops::Tuple)Independent point operations of equal index rank in one launch, over the elementwise-largest index space plus a trailing slot index. At least one operation is required.
On a device the operations run concurrently; on the host they run one after the other. The operations must therefore write pairwise-disjoint cells, and no operation may read a cell that another fused operation writes. Under this contract both paths give the results of separate launches bit for bit.
sourceAtmosTransport.Architectures.FusionPolicy Type
FusionPolicyHow a backend launches a Fused set of point operations, chosen by fusion_policy(backend): FuseLaunches() (the default) runs them as one kernel; SeparateLaunches() launches each operation over its own index space on its bound_context (operations that define one, such as the halo fills, then see their arrays directly), one after another, with one synchronization at the end. Results are the same either way (fused operations write disjoint cells and read none that another writes); which is faster depends on the backend.
AtmosTransport.Architectures.GPU Type
struct GPU{B} <: AtmosTransport.Architectures.AbstractArchitectureGPU execution architecture for backend B.
Construct with GPU(:cuda) or GPU(:metal). Making the backend explicit keeps CUDA and Metal methods unambiguous when both optional packages are loaded.
AtmosTransport.Architectures.Sequence Type
Sequence(ops::AbstractPointOp...)Point operations where later ones read what earlier ones wrote: launched in order, with one synchronization after the last.
sourceAtmosTransport.Architectures.apply_point! Function
apply_point!(op, ctx, I...)The work of op at one index; methods should be @inline.
AtmosTransport.Architectures.architecture_from_config Method
architecture_from_config(config) -> AbstractArchitectureResolve an [architecture] configuration table to one concrete execution architecture. An omitted backend selects CPU() unless use_gpu = true, in which case a usable GPU runtime is detected.
AtmosTransport.Architectures.assert_residency! Method
assert_residency!(storage, architecture; label="storage")Verify that an array or tuple of arrays is resident on architecture. CPU storage is returned directly; a GPU mismatch aborts rather than falling back silently to host execution.
AtmosTransport.Architectures.autodetect_gpu_architecture Method
autodetect_gpu_architecture() -> GPUReturn the first functional supported GPU architecture on this host.
sourceAtmosTransport.Architectures.fusion_policy Method
fusion_policy(backend) -> FusionPolicyFuseLaunches() unless a backend extension says otherwise (Metal launches separately: measured on an M5 Pro, a C90 packed-tracer halo exchange takes 1.1–1.3 ms with separate launches of bound arrays and 1.7–2.0 ms fused, while on CUDA the fused launch is 3–9× faster).
AtmosTransport.Architectures.index_space Function
index_space(op, ctx) -> NTuple{N, Int}Extent of the indices at which apply_point!(op, ctx, I...) runs.
AtmosTransport.Architectures.launch! Method
launch!(op::AbstractPointOp, ctx, backend; workgroup = 256, sync = true)Run op at every index of index_space(op, ctx): one kernel launch on a device backend (then synchronize unless sync = false), and a loop calling the same apply_point! on the host backend.
AtmosTransport.Architectures.launch! Method
launch!(kernel, backend, workgroup, ndrange, args...; sync = true)Run the KernelAbstractions kernel (a @kernel function) on backend with workgroup over ndrange, then synchronize(backend) unless sync = false (several launches on one backend can share one synchronization). Kernel launches are being moved onto this helper module by module, so that workgroup choices and synchronization are explicit at each call site; the cubed-sphere advection sweeps keep their own profiled launch, which skips the host synchronization on GPU.
AtmosTransport.Architectures.reclaim_backend_pool! Method
reclaim_backend_pool!(reference_array)Release device allocator caches associated with reference_array after startup transients become unreachable. CPU arrays are a no-op.