kicad2ems.emsdev.vulkan

The Vulkan GPUs, through the system's Vulkan loader (libvulkan.so.1,
vulkan-1.dll: ctypes, no other dependency), and the slangpy device a solver's
Vulkan backend runs on. Vulkan is the GPU path where CuPy has none: AMD on
Windows (no ROCm CuPy there), older NVIDIA cards past CUDA's support.

    vulkan.adapters()           [Adapter]: the hardware GPUs (no CPU renderers
                                such as llvmpipe), best first
    vulkan.device(index=None)   Device (emsdev.gpu's) of adapter `index` (None:
                                the best; EMSDEV_VULKAN_DEVICE picks it), or
                                raises Unavailable
    vulkan.slang_device(index)  the slangpy Device on it, one per thread and
                                adapter (slangpy: pip install slangpy)
    vulkan.device(need=('float64', ...))
                                the same, refused (Unavailable) where the GPU
                                lacks a feature a solver's kernels need: bda
                                (buffer device addresses), int64, float64,
                                atomic_add_f32

The best adapter: a discrete GPU before an integrated one, then the most device
memory. Free memory is the device heaps' budget less their use
(VK_EXT_memory_budget), when the driver reports it.
class kicad2ems.emsdev.vulkan.Adapter(index: int, name: str, kind: str, vendor_id: int, device_id: int, total: float, driver: str = '', api_version: str = '', budget: bool = False, features: dict = None, _phys: int = 0, _order: int = 0)[source]
free()[source]
Bytes of device memory free now, None if the driver cannot tell.
class kicad2ems.emsdev.vulkan.HostBuffer(slang_dev, nbytes)[source]
`nbytes` of host memory on a slangpy device's VkDevice: .array (numpy
uint8, mapped), .address (for kernels), .cached (host-cached memory: fast
host reads). Freed with free() or when collected.
free()[source]
Unmap and free (idempotent).
exception kicad2ems.emsdev.vulkan.Unavailable[source]
No usable Vulkan GPU; the message says why.
kicad2ems.emsdev.vulkan.adapters(include_cpu=False)[source]
The Vulkan GPUs the loader finds, best first (CPU renderers left out
unless include_cpu, or EMSDEV_VULKAN_CPU=1: CI runs the solvers' Vulkan
paths on lavapipe that way, as no GPU is there).
kicad2ems.emsdev.vulkan.device(index=None, need=())[source]
kicad2ems.emsdev.gpu's Device of a Vulkan adapter (library 'vulkan', api
'Vulkan'). Needs slangpy, the solvers' Vulkan runtime: without it the GPU is
there but nothing can run on it; and the features in `need`.
kicad2ems.emsdev.vulkan.pick(index=None)[source]
The adapter a solver runs on: `index` (EMSDEV_VULKAN_DEVICE when None),
else the best.
kicad2ems.emsdev.vulkan.slang_device(index=None)[source]
The slangpy Device on adapter `index` (pick's), made once per thread: the
solvers' runs in threads each get their own (a Vulkan device and queue each,
so their work overlaps on the GPU).