1,410 karma · joined October 15, 2017
Check out my Numpy/PyTorch alternative written in Nim: ergonomics of Python, speed of C, OpenMP, Cuda and OpenCL support - https://github.com/mratsim/Arraymancer
What's the state of Windows support.
How did the compiler speed drama unfold?
It was from an older implementation that wasn't compatible with Nim v2. I've commented it out.
If you pull again it should work.
> Anyway the reason for your competitive performance is likely that you are benchmarking with very small matrices. OpenBLAS spends some time preprocessing the tiles which doesn't really pay off until they become really huge.
I don't get why you think it's impossible to reach BLAS speed. The matrix sizes are configured here: https://github.com/mratsim/laser/blob/master/benchmarks/gemm...
It defaults to 1920x1920 * 1920x1920. Note, if you activate the benchmarks versus PyTorch Glow, in the past it didn't support non-multiple of 16 or something, not sure today.
Packing is done here: https://github.com/mratsim/laser/blob/master/laser/primitive...
And it also support pre-packing which is useful to reimplement batch_matmul like what CuBLAS provides and is quite useful for convolution via matmul.
Reproduction:
- Assuming x86 and preferably Linux.
- Install Nim
- Install a C compiler with OpenMP support (not the default MacOS Clang)
- Install git
The repo submodules MKLDNN (now Intel oneDNN) to bench vs Intel JIT Compiler
```
git clone https://github.com/mratsim/laser
cd laser
git submodule update --init --recursive
nim cpp -r --outdir:build -d:danger -d:openmp benchmarks/gemm/gemm_bench_float32.nim
```
This should output something like this
```
Laser production implementation
Collected 10 samples in 0.230 seconds
Average time: 22.684 ms
Stddev time: 0.596 ms
Min time: 21.769 ms
Max time: 23.603 ms
Perf: 624.037 GFLOP/s
OpenBLAS benchmark
Collected 10 samples in 0.216 seconds
Average time: 21.340 ms
Stddev time: 3.334 ms
Min time: 19.346 ms
Max time: 27.502 ms
Perf: 663.359 GFLOP/s
MKL-DNN JIT AVX512 benchmark
Collected 10 samples in 0.201 seconds
Average time: 19.775 ms
Stddev time: 8.262 ms
Min time: 15.625 ms
Max time: 43.237 ms
Perf: 715.855 GFLOP/s ```
Note: the Theoretical peak limit is hardcoded and used my previous machine i9-9980XE.
It maybe that your BLAS library is not named libopenblas.so, you can change that here: https://github.com/mratsim/laser/blob/master/benchmarks/thir...
Implementation is in this folder: https://github.com/mratsim/laser/tree/master/laser/primitive...
in particular, tiling, cache and register optimization: https://github.com/mratsim/laser/blob/master/laser/primitive...
AVX512 code generator: https://github.com/mratsim/laser/blob/master/laser/primitive...
And generic Scalar/SSE/AVX/AVX2/AVX512 microkernel generator (this is Nim macros to generate code at compile-time): https://github.com/mratsim/laser/blob/master/laser/primitive...
I'll come back later with details on how to use my custom HPC threadpool Weave instead of OpenMP (https://github.com/mratsim/weave/tree/master/benchmarks/matm...). As a side bonus it also has parallel nqueens implemented.
I have benches on i5-5257U (dual core from old MBP15), i9-9980XE (Skylake-X 18 cores), Dual Xeon Gold 6132, AMD 7840U.
See: https://github.com/mratsim/laser/blob/master/benchmarks%2Fge...
And using my own threadpool instead of OpenMP - https://github.com/mratsim/weave/issues/68#issuecomment-5692... - https://github.com/mratsim/weave/pull/94
Orc was blocked for a while due to cycles with async. I was under the impression that they were still there.
> It's been ORC for years.
The switch has been made for Nim v2 announced in December 2022, the PR #19972 that defaults to ORC has been made on September 2023.
ORC has just celebrated 1 year as default GC, certainly not years.
> When you confidently try to correct someone, at least consider you may be wrong.
I don't get why you're so butthurt about this and feel the need to be so nasty in your replies.
You don't have to use Assembly.
Case in point, this is as fast as OpenBLAS: https://github.com/mratsim/weave/tree/master/benchmarks/matm...
ARC is deterministic. ORC isn't, but doing cycles in general is usually a code smell, especially on embedded.
Also the GC is type-bound and only needed if you use ref objects. If you don't, no GC.
This is similar to Cilk back in 1995 with their continuation-stealing work-stealing scheduler. The C++ committee made an in-depth review of fibers (stackful coroutines that install their own stack).
Regarding scheme, the issue is that they have multishot undelimited continuations, which let to several debates. Delimited continuations are enough to express everything but non-determinism (which causes the lifetime issues, i.e. you can enter a room once and exit twice), in practice you allow continuations to be moved (on different executors like a state machine, threadpool or actors) but not copied.
Cilk: http://supertech.csail.mit.edu/papers/PPoPP95.pdf
Fibers under magnifying glass: https://open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1364r0...
on Scheme undelimited continuations: https://okmij.org/ftp/continuations/against-callcc.html#dyna...
In general, I've collected experiments and criticisms from many many language on continuations, coroutines, fibers, cancellation here: https://github.com/mratsim/weave-io-research/blob/master/res...
That's very lackluster. Show me a Fizzbuzz or an advent of code. Tell me a story of why it exists.
Now the only discussion I can have is why are there no reserved words and can we call our functions and variables "set", "call" and "def" then?
This way I context switch completely away from code.
Also it annoying to swap workspaces and keep the up.
Matrox is still alive.
Iirc they found a niche in medical device imaging.
It's the non-linear-algebra stuff that is usually problematic.
If looking for a book. Cho Chikun's life & death corner problems progress in a systematic manner from beginner to dan level.
Also https://senseis.xmp.net/?LoseYourFirst50GamesAsQuicklyAsPoss...
https://senseis.xmp.net/?LoseYourFirst50GamesAsQuicklyAsPoss...
Actually it examplifies what goes wrong when an infrastructure monopoly is created.
Also IE6.