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