Browse documentation
aner.ml · Reference

Clustering across hardware

Compare measured native clustering on matched inputs, preserve each platform identity and inspect distortion alongside elapsed time.

Development APIs

These are actual Aner 0.0.10-dev.4 native e-means/o-means measurements, recorded November 16, 2026. The two machines use the same compiled source fingerprint and verified input bytes. This fixed epoch comparison measures this implementation and workload; it does not reproduce the authors' equal error speedup studies. L40 execution is pending. Its offline package contains V100 tested code for both GPU architectures, but no L40 performance result is claimed.

GPU time and final objective

Each time is the median of five fits after one untimed warm up. GPU fits use four host workers. MSE is final exhaustive inertia divided by the row count, with no additional division by feature count.

Input shapeAlgorithmM2 Metal msV100 CUDA msM2 MSEV100 MSE
2,048 × 16, k=32e-means90.05319.5316.7213016.721301
2,048 × 16, k=32o-means17.0765.09011.12745311.127453
8,192 × 32, k=64e-means17.1334.77616.20047516.200475
8,192 × 32, k=64o-means19.4718.99316.20067716.200677
16,384 × 32, k=4,096e-means72.58334.06716.74349716.743497
16,384 × 32, k=4,096o-means125.964132.38516.81644216.816442
65,536 × 32, k=4,096e-means141.48469.42514.58442014.584420
65,536 × 32, k=4,096o-means215.528202.82314.46857714.468577

For the largest case, the host CPU measurements provide context:

AlgorithmM2 CPU, 12 workers msV100 host CPU, 24 workers ms
e-means724.4141928.366
o-means730.2571319.669

The full reports also include CPU worker sweeps: 1, 4, 8 and 12 on M2; 1, 4, 8, 12 and 24 on the V100 guest. These are host CPU results, not GPU timings. Small inputs can favor CPU because GPU submission and synchronization overhead dominates. O-means' index maintenance can outweigh its candidate savings; inspect objective and time together, including cases where its final loss is higher. Neither method universally produces better clusters.

Matched protocol and timer boundaries

  • Four existing seeded synthetic shapes; input generator seed 20261115, fit seed 42, Float32 input/storage, three epochs, identical resolved batch, alpha, revival, coarse cell and probe controls.
  • Input hashes cover row major little endian IEEE754 Float32 feature bytes before upload. Every row records the hash and compiled source identity. Alpha comparison permits 1e-12 for platform libm rounding; discrete recipe controls match exactly.
  • One warm up and five measured fits per configuration, run serially. M2 has 40 configurations; V100 has 48. There is no overlap with local build/browser work during the recorded M2 campaign, or packaging work during V100 timing.
  • The external timer includes initialization, index maintenance, training, closing, final exhaustive assignment, output construction and backend/scratch destruction. It excludes data generation, input hashing/upload and destruction of the returned model. training_seconds() ends before backend cleanup and therefore is not this external timer.
  • GPU distance arithmetic and ordered reductions use Float32 without fast math; the original Metal contraction description is corrected below. Final SSE is accumulated with compensated Float64 arithmetic from backend rounded distances; it is not an independent Float64 distance rescore. No floating point atomic sums or retained N × k distance matrix are used.
  • Final labels and loss are exhaustive for both methods. O-means training assignment remains approximate. Equal epochs are not equal quality, and six decimal displayed equality does not assert bitwise agreement across devices.

Precision erratum, November 16, 2026 UTC

The recorded dev.4 metadata described Metal arithmetic as noncontracted. Its Metal safe math setting still permitted floating point contraction within expressions, so that description was incorrect. The dev.6 implementation explicitly uses #pragma METAL fp contract(off) and aligns the GPU full step mean shortcut with CPU when the update fraction is one. This can change training trajectories and final loss. The original measurements, raw JSON, build identities and packaged binaries retain their historical identities. See the new native comparison for measurements using the corrected policy and the p-means precision note for the numerical contract.

Hardware and build identity

PropertyM2V100
GPUM2 Max, 38 GPU coresTesla V100 PCIe, 32 GB, compute capability 7.0
Host CPU12 cores: 8 performance, 4 efficiencyXeon Gold 6248 virtualized guest, 24 vCPUs
Memory64 GB unified32,768 MiB GPU; host bytes recorded in JSON
CompilerApple Clang 21GCC 13.4; CUDA 12.9.1 / nvcc 12.9.86
CPU baselineApple M1 compatiblePortable x86-64; no AVX2/AVX512 requirement
BuildRelease, LTO off, Accelerate, MetalRelease, LTO off, native CUDA sm70 + sm89

The V100 host CPU binary prioritizes portability to the older L40 host CPU. It is not a host tuned AVX2/AVX512 performance ceiling. GPU results include their necessary host coordination, so they compare complete machines under this protocol, not isolated GPU silicon. Different drivers, compilers, CPU architecture, power conditions and shared host load remain limitations. Five timing samples from one seeded synthetic family do not establish a general performance ranking or a real data quality guarantee.

Both executable builds report compiled source SHA256 94880ca5a5fc8bae8c4403f5e24a47c2f92421804d2884e4b292864d0b27210e. Their manifest fingerprint is 154d3cb9884a0d4364e1112595501a5c56a00aefa77f844d3a63a04376ec2047. The recorded base_commit identifies the preceding committed baseline; the complete source manifest identifies the measured development snapshot. Do not reinterpret the baseline commit as containing every measured change. The two platform executable hashes differ and are retained separately.

Correctness and reproducibility

M2 passed 13,904 public CPU/Metal clustering checks, the independent Metal oracle and 11 selected native suites, including existing K-means, language and Tensor regressions. V100 passed native CPU/CUDA oracles, public diagnostics, language controls and runnable CUDA/Iris examples. NVIDIA memcheck, racecheck and synccheck reported zero errors; memcheck reported zero leaked bytes. The portable binaries were requalified after setting package relative runtime lookup and using only staged runtime dependencies. This is V100 qualification, not L40 execution.

The comparison manifest pairs the M2 report and V100 report. Each report retains all five raw samples, losses, settings, workspaces and source/executable hashes. Public projections omit hostnames, GPU UUIDs, user paths and raw tool output without changing measurements; private receipts retain the original evidence. The earlier dev.3 M2 results retain their original version and hashes.

The recorder is tools/run_clustering_comparison.py. For another matched campaign, use the exact frozen source/runtime and pass the M2 report as --reference. A stale executable or input/recipe mismatch fails rather than producing a comparable report. Use the offline qualification instructions to verify the immutable L40 package, launch a detached serial campaign, inspect heartbeats after reconnecting and collect a small result receipt. The host must already supply Python 3.10+, Linux x86-64 and a compatible NVIDIA driver; the package performs no downloads or installation. L40 results must be reviewed before being added to this comparison.

See e-means, o-means and the data science workflow for algorithms, parameter controls, limitations and examples.

See the Machine learning module reference for the shared API.

Matched input, measured execution

Compare time and distortion across hardware

These retained runs use matching input hashes, dimensions, seeds and algorithm controls from the same compiled source. Each report retains its native executable identity and arithmetic.

2,048 rows · 16 dimensions · 32 clusters · 3 epochs · seed 42 · Float32 input

Apple M2 Max · e-means · Metal + 4 CPU workers · Float3290.053 ms
Apple M2 Max · o-means · Metal + 4 CPU workers · Float3217.076 ms
NVIDIA V100 PCIe 32 GB · e-means · CUDA + 4 CPU workers · Float3219.531 ms
NVIDIA V100 PCIe 32 GB · o-means · CUDA + 4 CPU workers · Float325.09 ms
Warm resident fit including initialization, index maintenance, training, closing, exhaustive final assignment, output construction and backend/scratch destruction; excludes data generation, input hashing/upload and returned model destruction. One warm up fit per process; cases run serially. Lower elapsed time is faster. Equal budgets do not imply equal clustering quality.
Quality from the same measured configurations
ConfigurationMSEMedian msInertiaTiming runs
Apple M2 Max · e-means · Metal + 4 CPU workers · Float326.7213090.05313765.25
Apple M2 Max · o-means · Metal + 4 CPU workers · Float3211.127517.07622789.05
NVIDIA V100 PCIe 32 GB · e-means · CUDA + 4 CPU workers · Float326.7213019.53113765.25
NVIDIA V100 PCIe 32 GB · o-means · CUDA + 4 CPU workers · Float3211.12755.0922789.05

MSE is inertia divided by the number of observations. Read it alongside elapsed time: these runs do not establish a speedup at equal quality or a general ranking of hardware. The default α calculation may differ by a few units in the last place across system math libraries; the pairing audit allows a tolerance of 10⁻¹² and preserves both recorded values.

Input and build provenance

Input SHA256: 698db4434ad2cfda96964d58e26b3a07e7c8f4899a5ba1eefd621dfeab0ba538

Compiled source SHA256: 94880ca5a5fc8bae8c4403f5e24a47c2f92421804d2884e4b292864d0b27210e

CPU worker counts may differ across machines. Each GPU configuration uses four host workers. Exact recipes, resolved controls, raw timing runs and executable hashes are retained in each report.

Inspect the comparison manifest
Aner documentation · Reference and guides