class mesh_t An executor owns host threads or device streams, the activation scratch, and the pinned buffers staging passes through, grown to a high-water mark. One executor serves any number of models of its residency.
auto [threads, threads_status] = uf::executor_t::for_ram({.threads = 8}); // eight threads, where zero takes 7/8 of the cores less one
std::int32_t const domains[] = {1};
auto [numa, numa_status] = uf::executor_t::for_ram({.ram = {.memory_domains = domains, .memory_domains_count = 1}});
auto [serial, serial_status] = uf::executor_t::for_ram({.ram = {.cpu_class_ceiling = uform_cpu_class_serial_k}});
std::int32_t const devices[] = {0, 1};
auto [streams, streams_status] = uf::executor_t::for_vram({.vram = {.devices = devices, .devices_count = 2}});
uf::executor_t local; // owns nothing, runs on the calling thread
uf::status_t const drained = threads.drain(uform_mood_spinning_k); // waits until no call holds it, then keeps spinningEvery factory takes the C argument struct by designator, so a field left out is zero, which the library derives.
Naming one memory domain spawns the threads near it, while none or several interleave them across the machine. for_vram opens one stream per device, or adopts the caller’s streams, one per named device, and the executor destroys them; naming no devices drives every listed device of the first vendor with a known class. uf::gpu_devices(devices) fills a span of uform_gpu_device_t and answers how many GPUs the process can drive, and a device’s position there is the ordinal for_vram and load_vram name it by, while uf::version_name() spells the linked library’s version.
An executor runs one call at a time, so two threads that genuinely overlap take one apiece.
Destroying an executor waits until no call holds it, and asserts in Debug builds that no arena made with it lives.
API
Types
mesh_tOwns one process's place among the processes of a run; each trainer made over it holds it, so either may be freed first.
Classexecutor_tOwns one executor: the host threads or device streams every call runs on, apart from any model; an empty one runs every call on the caller's own thread.3
drainWaits until no call holds the executor, then sets its threads' idle mood.
status_t drain(uform_mood_t mood = uform_mood_parked_k) noexcept; for_ramCreates an executor of host threads for RAM-resident models, near the one memory domain arguments names, or interleaved across the machine for none or several.
expected<executor_t> for_ram(
uform_executor_for_ram_t arguments = {}) noexcept; for_vramOpens one submission stream on every device arguments names, or adopts the caller's streams : a CUDA or HIP stream becomes the executor's, which synchronizes and destroys it; a Metal queue is retained, the executor releasing its own reference while the caller keeps and releases theirs.
expected<executor_t> for_vram(
uform_executor_for_vram_t arguments = {}) noexcept; Functions
free_executorFrees executor as its owner dies, which every arena made with it refuses while it lives; declaring the executor before its arenas destroys them first.
void free_executor(uform_executor_t executor) noexcept; gpu_devicesFills devices with the GPUs this process can drive, in ordinal order, answering how many there are, which may exceed what devices holds.
expected<std::size_t> gpu_devices(
std::span<uform_gpu_device_t> devices) noexcept;