3 ms·
There are some Julia-based matmuls which are very close in performance with OpenBLAS, showing that it can happen. Written by an undergrad too.
by ChrisRackauckas 8y ago
There are some Julia-based matmuls which are very close in performance with OpenBLAS, showing that it can happen. Written by an undergrad too.
- xiphias2 8y agoMatmul is a very common operation, you get problems when you have more exotic computations. As an example where it got harder for me to find code is numerical CDF function approximation for bivariate / trivariate normal distributions. This is of course just my example, but I'm sure there are a lot of similar operations that are really hard to rewrite because the math is so complex.
- ChrisRackauckas 8y agoThat stuff is actually the easy stuff. If you write standard Julia code for those kinds of algorithms you'll hit C or Fortran speeds your first time if you know what you're doing. Lower levels kernels like BLAS have a lot of cache optimizations with how they do things like blocking, so it took awhile for things like StaticArrays to be used in a way to recreate what's going on there. There is still some work needed on mutable stack allocated buffers in order to handle to optimize more of the cache handling but it is quite close now!
- xiphias2 8y agoIf it's so easy can you show me an example code for it? The speed doesn't matter, it's the algorithm that's important. Please make sure that you handle all the numerical instabilities, and show me the Julia code for binomial and trinomial normal CDF computation that is not using integration, but a fast, correct and precise approximation.
- ChrisRackauckas 8y agoDid you not look at StatFuns.jl? Bivariate is here: https://github.com/JuliaStats/StatsFuns.jl/blob/e21bc26b1773aeb86bc8df4832db9c371d09ba2b/src/tvpack.jl#L338 https://github.com/JuliaStats/StatsFuns.jl/blob/e21bc26b1773... . For trivariate you'd just do the same kind of translation process if you have a Fortran code which has an appropriate license of course. If you have an example of a Fortran file for trivariate, we can open an issue on StatFuns.jl and get an undergrad via Google Summer of Code to translate it over, or implement from scratch from a paper's description. The reason why this kind of code is easy to translate is because there is a direct mapping of language features (difficult to translate code is code that uses unique language structures). The only real difficulty of mapping (non-object oriented non-distributed) Fortran into a higher level language is keeping the speed.
- xiphias2 8y agoIt's cool, thank you very much! I was looking at Distributions.jl when I was searching for it, but didn't find it there.