HNHacker News
TopNewBestAskShowJobs

mratsim

1,410 karma · joined October 15, 2017

Ethereum, Nim and open-source dev during the day, data scientist, Kaggler and deep learning framework author at night.

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

submissionscomments
mratsim··on Crystal 1.11.0 Is Released
I asked because Crystal was notorious for not having it.
mratsim··on Crystal 1.11.0 Is Released
It's been a while since I heard about Crystal.

What's the state of Windows support.

How did the compiler speed drama unfold?

mratsim··on Spot Bitcoin ETF receives official approval from the SEC
Real world value for which they'll be paid post-doc/PhD wages and be carrying student debt like Sisyphus carries his boulder for all eternity.
mratsim··on Spot Bitcoin ETF receives official approval from the SEC
Stocks of WeWork?
mratsim··on Spot Bitcoin ETF receives official approval from the SEC
Try moving $50 in a private bank. Fees for stocks start at $200.
mratsim··on Unity Software cutting 25% of staff in 'company reset' continuation
They'll look elsewhere on the dime of the company or for equity as compensation for increased risk. Might as well cut them off instead of pretending.
mratsim··on Fastest autograd in the West
Maybe instruction-level autograd. When you use a differentiable programming language.
mratsim··on Benchmarking 20 programming languages on N-queens and matrix multiplication
Ah,

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.

mratsim··on Benchmarking 20 programming languages on N-queens and matrix multiplication
First we can use Laser, which was my initial BLAS experiment in 2019. At the time in particular, OpenBLAS didn't properly use the AVX512 VPUs. (See thread in BLIS https://github.com/flame/blis/issues/352 ), It has made progress since then, still, on my current laptop perf is in the same range

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.

mratsim··on Benchmarking 20 programming languages on N-queens and matrix multiplication
The code is open-source

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

mratsim··on Nim on a Real-Time Operating System: Apache NuttX RTOS and Ox64 BL808 SBC
Your tone is nasty
mratsim··on Nim on a Real-Time Operating System: Apache NuttX RTOS and Ox64 BL808 SBC
> How long haven't you checked that for?

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.

mratsim··on Benchmarking 20 programming languages on N-queens and matrix multiplication
> People use matrix multiplication libraries (often written in Assembly) from every language if they really care about performance. That's because such libraries incorporate 100 PhD theses' worth of tricks that no individual can hope to reinvent in the course of solving another problem. There is absolutely nothing special about Python in this context.

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...

mratsim··on Benchmarking 20 programming languages on N-queens and matrix multiplication
Pandas/Numpy uses a lot of C and Scipy a lot of Fortran
mratsim··on Nim on a Real-Time Operating System: Apache NuttX RTOS and Ox64 BL808 SBC
The default is ARC, no cycle detection.

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.

mratsim··on [dead]
The title is "What are co-routines in Kotlin ? Kotlin for Android Part -2"
mratsim··on The Downsides of Go's Goroutines
The coloring of go functions is actually seen in the FFI. Go functions have a special calling convention so FFI is annoying.

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...

mratsim··on Misty Programming Language
After saying that it's a dynamic general-purpose, actor language, the introduction talks about spacing style, comment style, naming and purity.

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?

mratsim··on Apple wins bid to pause Apple Watch ban at US appeals court
If there is a ban for consumer safety reasons, say in food, health, agriculture, transport, is it reasonable to pause a ban?
mratsim··on A structured note-taking app for personal use
I tried Dendron, and I preferred to have a fully separate editor.

This way I context switch completely away from code.

Also it annoying to swap workspaces and keep the up.

mratsim··on Nvidia CEO: We bet the farm on AI and no one knew it
Ah yeah there was an article on HN about that a couple years ago. GPGPU before Cuda, now onto a treasure hunt ...
mratsim··on Nvidia CEO: We bet the farm on AI and no one knew it
What if I told you ...

Matrox is still alive.

Iirc they found a niche in medical device imaging.

mratsim··on Vulkan video extensions for accelerated H.264 and H.265 encode
Convolutions and Discrete Cosine Transforms and many matrix operations (rotations, shifts) depends on operations around and ARE parallelizable.

It's the non-linear-algebra stuff that is usually problematic.

mratsim··on How to learn chess as an adult (2021)
1. Play and have fun. You won't stick around if you don't. 2. Tsumegos, most important are the tesuji and life & death when beginning, opening/ending don't matter when a blunder kills half the board. See https://goproblems.com/

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...

mratsim··on How to learn chess as an adult (2021)
We have the same advice in go. But it's lose your first 50 games as fast as possible.

https://senseis.xmp.net/?LoseYourFirst50GamesAsQuicklyAsPoss...

mratsim··on Why do programmers need private offices with doors?
MacGyver-style support needs very creative solutions because no budget.
mratsim··on Why do programmers need private offices with doors?
So you're saying programmers' time is not expensive enough?
mratsim··on RFC 9518 – What can internet standards do about centralisation?
Email is worse than that, running your own mail server means pleasing Google and Outlook to accept your email. And you may also have to pay to get out of blocklists turned extorsionists.

Actually it examplifies what goes wrong when an infrastructure monopoly is created.

Also IE6.

mratsim··on Google's response to Reptar CPU vulnerability
Was TSX ever used? I didn't even see an ounce of dev documentation about it.
mratsim··on Lua programming language needs a web hosting
Works fine for serious discussions away from memes in likely the most meme-y community, see https://ethresear.ch
← PreviousPage 3 of 20Next →