|
| 1 | +[](https://github.com/sponsors/hyperpolymath) |
| 2 | + |
| 3 | +// SPDX-License-Identifier: MPL-2.0 |
| 4 | +// SPDX-FileCopyrightText: 2025-2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk> |
| 5 | + |
| 6 | += AcceleratorGate.jl |
| 7 | +Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk> |
| 8 | +:toc: |
| 9 | + |
| 10 | +image:https://img.shields.io/badge/License-MPL--2.0-blue.svg[License: MPL-2.0,link="https://www.mozilla.org/MPL/2.0/"] |
| 11 | + |
| 12 | +== What this is |
| 13 | + |
| 14 | +AcceleratorGate.jl is a small, dependency-light *backend-selection layer*: |
| 15 | +a type hierarchy of compute backends (`JuliaBackend`, `CUDABackend`, |
| 16 | +`ROCmBackend`, `MetalBackend`, `TPUBackend`, `NPUBackend`, `FPGABackend`, |
| 17 | +`QPUBackend`, `DSPBackend`, …), environment-based availability detection, |
| 18 | +a platform probe, and a heuristic `select_backend` / `estimate_cost` / |
| 19 | +`fits_on_device` API. |
| 20 | + |
| 21 | +It was extracted from `Axiom.jl`'s backend module to remove duplicated |
| 22 | +selection logic shared by a few packages in the same author's ecosystem. |
| 23 | + |
| 24 | +== What this is NOT (honest scope) |
| 25 | + |
| 26 | +It does **not** execute GPU/accelerator computation. It contains no |
| 27 | +kernels and links no vendor runtimes. It is purely the *typing and |
| 28 | +selection* layer — the decision "which backend should this run on, and |
| 29 | +does it fit" — leaving execution to the real acceleration packages below. |
| 30 | + |
| 31 | +== Prior art |
| 32 | + |
| 33 | +The Julia ecosystem already covers accelerated compute thoroughly: |
| 34 | + |
| 35 | +- *Actual acceleration*: `CUDA.jl`, `AMDGPU.jl`, `Metal.jl`, `oneAPI.jl` |
| 36 | + — vendor GPU runtimes and kernels. |
| 37 | +- *Backend-agnostic kernels / array adaption*: `KernelAbstractions.jl`, |
| 38 | + `GPUArrays.jl`, `Adapt.jl` — write-once-run-on-any-backend kernels and |
| 39 | + array wrapping. These overlap conceptually with AcceleratorGate's |
| 40 | + selection idea and are more mature for kernel portability. |
| 41 | + |
| 42 | +AcceleratorGate is deliberately narrower than all of the above: a tiny |
| 43 | +type/selection seam with no compute and minimal deps. If you need to run |
| 44 | +work on a GPU, use the packages above; AcceleratorGate only helps a host |
| 45 | +package *decide* and *describe* backends uniformly. |
| 46 | + |
| 47 | +== Installation |
| 48 | + |
| 49 | +[source,julia] |
| 50 | +---- |
| 51 | +using Pkg |
| 52 | +Pkg.add(url="https://github.com/hyperpolymath/AcceleratorGate.jl") |
| 53 | +---- |
| 54 | + |
| 55 | +== Usage |
| 56 | + |
| 57 | +[source,julia] |
| 58 | +---- |
| 59 | +using AcceleratorGate |
| 60 | + |
| 61 | +select_backend(:matmul, 1_000_000) # => JuliaBackend() (no accelerator present) |
| 62 | +fits_on_device(JuliaBackend(), 10^6) # => false |
| 63 | +estimate_cost(JuliaBackend(), :matmul, 1000) # => 1000.0 |
| 64 | +detect_platform() # => PlatformInfo(:linux, :x86_64, false, false, false, v"1.12", 64, :little) |
| 65 | +capability_report() # => Dict: platform, per-backend availability, strategy order |
| 66 | +---- |
| 67 | + |
| 68 | +(Output above is from an actual run on a CPU-only Linux host with no |
| 69 | +accelerators installed — backends report `available => false` and |
| 70 | +selection falls back to `JuliaBackend`.) |
| 71 | + |
| 72 | +== License |
| 73 | + |
| 74 | +MPL-2.0 (OSI-approved). See `LICENSE`, `LICENSES/MPL-2.0.txt`, and |
| 75 | +`REUSE.toml`. |
0 commit comments