Is there a preferred jdk, garbage collector, etc. ...
# mathematics
a
Is there a preferred jdk, garbage collector, etc. that is best used for numerical loads?
a
GC is not a problem usually. In my experience GraalVM gives the best results so far.
i
The point about Graal is correct. As for collector, choosing of it depends not on type of computations, but on expected latency, size of data set, number of CPU cores etc.
If you tell some more information about your workload, I will give my opinion
a
This would be N-Body problems with vector fields. Starting off with a Euler gravitational simulation, still trying to figure out particle mesh. I haven’t used graal before, and I like to profile on my Pi 4 and I’ll run the full simulation on an AWS server.
a
I do not think that GC will be an issue. GraalVM is in general better for boxing avoidance, but to my surprise it is significantly better, that OpenJ9 in a lot of other tasks.
a
Do you have a benchmark that is good at comparing different set ups between each jvm/hotspot/ garbage collectors to test against graal? Also would you happen to have a list of test loads for benchmarking numerical libraries?
a
There are some benchmarks in this thread: https://discuss.kotlinlang.org/t/using-lambda-and-method-reference-differ-significantly-in-performance-with-java-8-streams/19306/11. I actually did some tests for kmath and GraalVM gave the best results, but I am not sure if I saved it somewhere. Also there are a lot of benchmarks in ojalgo blog: https://github.com/optimatika/ojAlgo. But Ojalglo is super-optimized by itself, so VM does not play a huge role there.
a
I may actually have to use that library or atleast wrap it.
a
There is the ongoing work on a wrapper https://github.com/mipt-npm/kmath/tree/ojalgo by @Iaroslav Postovalov, if you need it, you can cooperate and contribute. But I do not think that you will get a significant perforamce boost for n-body compared to other libraries like commons-math .
a
I wrote a library just to make the vector math easily and have a familiar feel from matlab and numpy. Primarily I just wanted to directly operate on vectors to reduce math mistakes and improve upon an numerical methods library. https://github.com/jalexcole/numeric
a
I do not think that numpy approach is good for kotlin. Anyway, there is koma and now MultiK for that.
a
Under the hood, why would a numpy approach lead to poor performance?
a
I never said anything about performance, but performance is also an issue. We had a discussion about that yesterday with @Ролан. Suppose you want to compute an integral of a function. You can't use the actual lambda in numpy since lambda is really slow and you need for all operations to be don via numpy arrays. But numpy arrays are also slow on large expressions because you need to create an array for each operation instead of inlining the function. In general, it is possible to do very fast calculus in a numpy-style, if you know which things to avoid, but my main concern is not the speed, but extensibility and maintainability.
a
I have noticed the maintainability part by the polynomial Class and being able to add types to my ArrayND class for ComplexDoubles.