Arraymancer viability spike #2
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Question
Does Arraymancer compile and train a small MLP on the user's Nim 2.2.x + NixOS setup?
Run the XOR perceptron example from Arraymancer's repo. Confirm: nimble install works, autograd works, Adam optimizer runs, weights are extractable after training. Report any compilation errors or runtime issues.
This is a go/no-go gate for the ML stack choice.
Arraymancer spike results — NixOS / Nim 2.2.4
Verdict: WORKS, with one NixOS-specific workaround required.
Environment
Step-by-step results
nimble install arraymancer -y— SUCCESS, ~73 secondsInfo: Ignoring ... because out of rangemessages for older dep versions — harmless, nimble resolved correctlynim c test_xor.nim— SUCCESS, 3.2 seconds (debug build)Running the binary — FAILS without fix, WORKS with fix
/nix/store/z3y5mylg3144fyy6v99r5iwakw0sr6jb-openblas-0.3.29/lib/), not in the standard dynamic linker pathLD_LIBRARY_PATH=/nix/store/z3y5mylg3144fyy6v99r5iwakw0sr6jb-openblas-0.3.29/lib ./test_xorcould not load: lib(blas|cblas|openblas).so(|.3|.2|.1|.0)Training results (2-layer MLP, Adam lr=0.01, 1000 epochs, batch=4)
Final predictions:
All 4 XOR outputs predicted correctly. Training time: 0.10s.
NixOS integration path
To avoid requiring
LD_LIBRARY_PATHat runtime, the real project will need one of:shell.nix/flake.nixthat bringsopenblasinto the build environment (standard NixOS approach)-d:openblasand-passL:-L/nix/store/.../libbaked innix developshell where BLAS is on the linker path automaticallyOption 1 (flake.nix with
pkgs.openblasinbuildInputs) is the standard and will resolve the runtime issue entirely.Conclusion
Arraymancer is viable on this machine. The library installs, compiles, and runs correctly. The only friction is the standard NixOS dynamic linking issue, which is solved by the flake. No Nim or Arraymancer code changes needed.
Resolution: Arraymancer 0.7.33 compiles and trains on Nim 2.2.4 + NixOS. XOR MLP trains in 0.10s, all predictions correct. NixOS requires LD_LIBRARY_PATH for OpenBLAS (standard flake.nix fix). Go/no-go: GO. Arraymancer is the ML stack.