Parallel computing with *

Okay thank you very much. I appreciate your help. Not a programmer here, just assumed wrong on this one. Hopefully the docs include this information. I have probably been doing this wrong for some time now. Thanks!

Does Octavian.jl (or a similar package) not parallelize integer matmuls?

If you take a closer look at the post i linked, you would see that it is recommended that you copy and paste text instead of images of code. The reason being that it is easy to copy-paste from text (and thereby run and test it), but not from images. You get proper formatting by wrapping the code in triple backticks, as demonstrated in that post.

1 Like

I tested multiplying two Boolean matrices and it was very slow. I think it just fall back to some naive algorithm.

2 Likes

GitHub - MasonProtter/Gaius.jl: Divide and Conquer Linear Algebra says

Currently, fast, native matrix-multiplication is only implemented between matrices of types Matrix{<:Union{Float64, Float32, Int64, Int32, Int16}}, and StructArray{Complex}. Support for other other commonly encountered numeric struct types such as Rational and Dual numbers is planned.

2 Likes

I have not tried Octavian yet… I’ll do that tonight. On your 2nd post, interesting, it was an Int64 type. I just assumed it would work in parallel, but the other guy explained why not. Had no idea. Thanks for this link.

iirc Octavian will do integers. the optimizations are pretty much all the same (except for the lack of fma)

1 Like

Apparently not (ignore compilation times, doesn’t make a difference for the result):

julia> using Octavian

julia> A = rand(Int, 10^4, 10^3);

julia> @time A * A';
 36.394812 seconds (2.60 M allocations: 888.709 MiB, 0.43% gc time, 1.63% compilation time)

julia> A = rand(Float64, 10^4, 10^3);

julia> @time A * A';
  2.114822 seconds (2.73 M allocations: 895.197 MiB, 3.93% gc time, 31.80% compilation time)

just to be sure:

julia> A = rand(Int, 5*10^3, 5*10^3);

julia> @time Octavian.matmul(A,A');
  7.988792 seconds (3 allocations: 190.735 MiB, 0.08% gc time)

julia> A = rand(Float64, 5*10^3, 5*10^3);

julia> @time Octavian.matmul(A,A');
  2.022297 seconds (3 allocations: 190.735 MiB, 4.02% gc time)
2 Likes