Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ disableKinds = ['taxonomy', 'term', 'rss', 'sitemap', '404']

[[params.repos]]
name = "ndarray"
kind = "library · v0.41.0"
kind = "library · v0.41.1"
href = "https://github.com/go-ndarray/ndarray"
blurb = "The library, in <strong>13 dtypes</strong> with NumPy 2 promotion. Creation (<code>Zeros</code>/<code>Arange</code>/<code>Linspace</code>/…), strided <strong>views</strong>, broadcasting elementwise + ufuncs, reductions (<code>Sum</code> in <strong>NumPy's pairwise order, within a stated error bound checked against <code>math/big</code></strong>, from <a href=\"https://github.com/go-simd/floats\">go-simd/floats</a>; <code>Max</code>/<code>ArgMax</code>/<code>CumSum</code>/<code>Clip</code>/<code>Where</code>), manipulation (<code>Reshape</code>/<code>Concatenate</code>/<code>Stack</code>), linalg (<code>MatMul</code>/<code>Dot</code>) via a panel-packed cache-blocked GEMM with a go-asmgen SIMD-FMA micro-kernel (NEON 4&times;8 on arm64, AVX2/FMA 6&times;8 on amd64, VSX 8&times;8 on ppc64le, LASX 8&times;8 on loong64, RVV 6&times;16, or 8&times;16 on 256-bit vectors, on riscv64, 4&times;8 on s390x), and a <code>Workspace</code> arena for loops (<code>Use</code>/<code>Reset</code>/<code>Detach</code>). Packages <code>linalg</code>, <code>fft</code> and <code>random</code> are <code>numpy.linalg</code>, <code>numpy.fft</code> and <code>numpy.random</code>."
[[params.repos]]
Expand Down
18 changes: 13 additions & 5 deletions layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ <h2>The n-dimensional array, <i>without</i> cgo.</h2>
<div class="card"><div class="ico">🐹</div><h3>Pure Go</h3><p><code>CGO_ENABLED=0</code> across the org. No cgo, no BLAS shim.</p></div>
<div class="card"><div class="ico">✅</div><h3>100% test coverage</h3><p>Gated in CI, differentially checked against <code>numpy</code>.</p></div>
<div class="card"><div class="ico">🔢</div><h3>NumPy semantics</h3><p>Row-major strided arrays, <b>NumPy broadcasting</b>, and NumPy basic-indexing <code>Slice</code> returning strided views that share data.</p></div>
<div class="card"><div class="ico">♻️</div><h3><code>Workspace</code> arena for loops</h3><p>Bind the inputs with <code>ws.Use</code>, compute as usual, <code>ws.Reset()</code> at the end of each pass: results stop costing the garbage collector anything. On a Zen 3, <code>x + y</code> on 1&nbsp;024 elements drops from 2.6 to 0.38&nbsp;µs (2.1× NumPy).</p></div>
<div class="card"><div class="ico">♻️</div><h3><code>Workspace</code> arena for loops</h3><p>Bind the inputs with <code>ws.Use</code>, compute as usual, <code>ws.Reset()</code> at the end of each pass: results stop costing the garbage collector anything. On a Zen 3, <code>x + y</code> on 1&nbsp;024 elements drops from 2.6 to 0.38&nbsp;µs, Go against Go.</p></div>
<div class="card"><div class="ico">⚡</div><h3>SIMD on every 64-bit target</h3><p>go-asmgen SIMD kernels on amd64 (SSE2, AVX2/FMA picked at run time), arm64 (NEON), ppc64le (VSX), loong64 (LASX, when the CPU has it), riscv64 (RVV, when the CPU has it) and s390x (vector facility, measured on a real IBM z17); the 32-bit targets run the same pure-Go code those kernels are tested against.</p></div>
<div class="card"><div class="ico">🎯</div><h3>Accurate <code>Exp</code>/<code>Log</code></h3><p>Ports of Arm's optimized-routines: worst 0.504 / 0.508 ULP against a 300-bit reference, and correct where Go's amd64 <code>math.Exp</code> returns +Inf (<a href="https://github.com/golang/go/issues/81995"><u>golang/go#81995</u></a>) and <code>math.Log</code> is wrong on subnormals (<a href="https://github.com/golang/go/issues/56600"><u>golang/go#56600</u></a>).</p></div>
<div class="card"><div class="ico">🧪</div><h3>Multi-arch CI</h3><p>The suite runs on amd64, arm64 and 386 natively and on riscv64/loong64/ppc64le/s390x/arm under qemu, on Linux, macOS and Windows, and compiles for every <code>GOOS/GOARCH</code> pair Go supports; v0.2.0 was also run on real amd64, arm64, ppc64le, riscv64 and loong64 hardware.</p></div>
Expand All @@ -104,11 +104,19 @@ <h2>{{ len .Site.Params.families }} families, <i>NumPy's names</i>.</h2>
<section id="perf" style="padding-top:10px"><div class="wrap">
<div class="stats">
<div><div class="n">100%</div><div class="l">test coverage, differentially checked against numpy</div></div>
<div><div class="n">2.3–4.5×</div><div class="l">NumPy's speed on whole-array <code>Sum</code>/<code>Mean</code>/<code>Max</code> at 4&nbsp;Mi (NumPy 2.5.3, 16-core Zen 3)</div></div>
<div><div class="n">3.7–5.9×</div><div class="l">single-threaded OpenBLAS 0.3.34 on <code>MatMul</code> from 512² (Zen 3)</div></div>
<div><div class="n">54 / 256</div><div class="l">public operations faster than NumPy 2.5.4 on one Zen 3 core (<code>Sum</code> 0.70×, <code>fft.FFT</code> 0.54× NumPy's time)</div></div>
<div><div class="n">188 / 256</div><div class="l">slower on one core, every one an open defect, tracked by cause in <a href="https://github.com/go-ndarray/ndarray/issues/118"><u>#118</u></a></div></div>
<div><div class="n">≤ 0.51</div><div class="l">ULP for <code>Exp</code>/<code>Log</code>, ports of Arm's optimized-routines</div></div>
</div>
<p class="lead" style="max-width:none;margin-top:28px"><b>Measured, wins and losses.</b> Against NumPy 2.5.3 + OpenBLAS 0.3.34 on a 16-core AMD Zen 3: <b>faster</b> on whole-array <code>Sum</code>/<code>Mean</code>/<code>Max</code> at 4&nbsp;Mi (2.3–4.5×), <code>SumAxis(1)</code> (2.2×), <code>MaxAxis(1)</code> (1.7×), <code>Exp</code> from 256&nbsp;Ki elements (2.4–5.6×) and <code>MatMul</code> against single-threaded OpenBLAS (3.7–5.9× from 512²); <b>slower</b> against 16-thread OpenBLAS (<code>MatMul</code> 0.42× at 512² and 0.51× at 1024², though 1.44× faster at 256²; <code>Dot</code> 0.69× and mat·vec 0.52×, all measured in one run with NumPy) and on allocating elementwise forms outside a <code>Workspace</code>. On Apple silicon the packed GEMM reaches <b>tuned-BLAS parity at 1024²</b> and beats the pure-Go <code>gonum</code> <b>4–10×</b>. On the other targets, against its own scalar code on one core: on a RISC-V SpacemiT X60 the RVV kernels make <code>Sum</code> up to <b>5.8×</b> faster and cut <code>MatMul</code> time by 31–45%; on an IBM z17 the s390x kernels take <code>MatMul</code> 1024² from 340 to <b>70&nbsp;ms</b> and cut <code>Max</code> by 92–96%.</p>
<div class="lead" style="max-width:none;margin-top:28px"><b>Measured, wins and losses, one core against one core.</b> The whole public API was timed against NumPy 2.5.4 with one-thread OpenBLAS 0.3.34, on the same data and on one AMD Zen 3 core (v0.41.0). <b>Faster</b> on 54 of 256 operations, for example <code>SqrtInto</code> (0.51× NumPy's time), the complex <code>fft.FFT</code> (0.54×), <code>Sum</code> (0.70×) and <code>Exp</code> (0.89×). <b>Slower</b> on 188, chiefly from:
<ul>
<li>allocating the result (<code>Add</code> 3.1× NumPy's time, where <code>AddInto</code> ties);</li>
<li>elementwise operations without a vector kernel yet (<code>Ceil</code> 20×, <code>Abs</code> 12×);</li>
<li>copies where NumPy returns a view;</li>
<li><code>linalg</code> at 64² (1.4–4×);</li>
<li>the <code>random</code> draws built on <code>log</code>/<code>exp</code>.</li>
</ul>
The table is in the <a href="https://go-ndarray.github.io/docs/latest/performance/"><u>docs</u></a>, and every slower row is tracked in <a href="https://github.com/go-ndarray/ndarray/issues/118"><u>#118</u></a>. On Apple silicon the packed GEMM reaches <b>tuned-BLAS parity at 1024²</b> and beats the pure-Go <code>gonum</code> <b>4–10×</b>. On the other targets, against its own scalar code on one core: on a RISC-V SpacemiT X60 the RVV kernels make <code>Sum</code> up to <b>5.8×</b> faster and cut <code>MatMul</code> time by 31–45%; on an IBM z17 the s390x kernels take <code>MatMul</code> 1024² from 340 to <b>70&nbsp;ms</b> and cut <code>Max</code> by 92–96%.</div>
</div></section>

<section id="repos" style="padding-top:20px"><div class="wrap">
Expand All @@ -127,7 +135,7 @@ <h2>What is here.</h2>
<section id="eco" style="padding-top:6px"><div class="wrap">
<div class="band">
<h2>The cgo-free ndarray the Go and Ruby ecosystems lacked.</h2>
<p>No cgo, no BLAS shim. A portable pure-Go core, multicore, with SIMD kernels on amd64, arm64, ppc64le, loong64, riscv64 and s390x and a <code>Workspace</code> arena that takes the garbage collector out of loops. Faster than NumPy on whole-array and row reductions, on large <code>Exp</code> and on <code>MatMul</code> against single-threaded BLAS, slower against 16-thread BLAS — the numbers are on the <a href="https://go-ndarray.github.io/docs/latest/performance/"><u>performance page</u></a>.</p>
<p>No cgo, no BLAS shim. A portable pure-Go core, multicore, with SIMD kernels on amd64, arm64, ppc64le, loong64, riscv64 and s390x and a <code>Workspace</code> arena that takes the garbage collector out of loops. Measured against NumPy one core against one core: faster on <code>Sum</code>, <code>Exp</code>, <code>SqrtInto</code> and the complex FFT, slower on 188 of 256 operations, which are being worked through. The numbers are on the <a href="https://go-ndarray.github.io/docs/latest/performance/"><u>performance page</u></a>.</p>
<a class="btn btn-ghost" href="https://github.com/go-ndarray/ndarray">{{ partial "icons/github.html" . }}Read the source on GitHub →</a>
</div>
</div></section>
Expand Down
2 changes: 1 addition & 1 deletion playground/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/go-ndarray/go-ndarray.github.io/playground
go 1.27.2

require (
github.com/go-ndarray/ndarray v0.41.0
github.com/go-ndarray/ndarray v0.41.1
github.com/go-widgets/mvvm v0.15.0
github.com/go-widgets/mvvmtk v0.15.0
github.com/go-widgets/painter v0.17.0
Expand Down
4 changes: 2 additions & 2 deletions playground/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ github.com/go-icons/iconoir v0.3.0 h1:kHG2sU5IsCvtBS1JICuXgfFo5f8UfwY1m7KYMVy97C
github.com/go-icons/iconoir v0.3.0/go.mod h1:lPh5OuzVQ+rR4qDPGgAdSRUhnCbHeCAX70HDdwp8/RI=
github.com/go-images/images v0.1.1-0.20261026203936-4ac989d310a1 h1:R7Phx1lhFniaqF+k7yE72HcadFeViKYXXb9w2puZJRI=
github.com/go-images/images v0.1.1-0.20261026203936-4ac989d310a1/go.mod h1:TXN7V9gKgEe8L4GVYeTO01sQI6n5JUL5Q1xIl09qOio=
github.com/go-ndarray/ndarray v0.41.0 h1:IN7ghnJCpIn9T/T3iXzOmqSzPWNWlTBbpRKvDJWHijI=
github.com/go-ndarray/ndarray v0.41.0/go.mod h1:e/5IBOVrikiwf3Hs8Z6G9EGC7kVwKAj+K569C83HbyU=
github.com/go-ndarray/ndarray v0.41.1 h1:VQp9HKprI8ctB1F4GP4N/PCtc5ZWU/1b/ZkRdktMP2s=
github.com/go-ndarray/ndarray v0.41.1/go.mod h1:e/5IBOVrikiwf3Hs8Z6G9EGC7kVwKAj+K569C83HbyU=
github.com/go-opentype/fonts v0.14.0 h1:WHw7k9gkHT1pu9B2yyvd0FWyQqn/4NKFQoKhvMYt3Mo=
github.com/go-opentype/fonts v0.14.0/go.mod h1:od2QcmdpKo7QCqo6Jb16y4GULk+h2Hhfq6x3xfvn62Q=
github.com/go-opentype/opentype v0.16.2-0.20261027113239-5e69589e9a5e h1:SxBkVzp042LB0X7Ndu0WntqCVaewOm4DwikQYHenP5A=
Expand Down
Loading