Open usefulhyun opened 7 years ago
Please post questions to the Julia discourse discussion forum.
I believe this is due to this line in the generic matrix multiply code:
z2 = zero(A[i, 1]*B[1, j] + A[i, 1]*B[1, j])
It's doing the interior matrix multiply 3 times, 2 of which are for computing a zero element.
The other sizes aren't affected because they use special-case code for 2x2 and 3x3 matrices.
Yeah. We basically assume it is free to compute things like zero(A[i, 1]*B[1, j] + A[i, 1]*B[1, j])
to get the right accumulator type. 2x2 and 3x3 are completely unrolled so there the type computation isn't necessary. Generally, we don't try to be smart about the cases where the elements are mutable. Hence multiplication of arrays of arrays will create a ton of temporaries (and similarly with Matrix{BigFloat}
)
We should perhaps wrap this in a function call to be able to overload this.
Hi, there! First, I show you my example.
All block_mat# have the same number of elements and the multiplications also have the same number of computations too. But the execution time of mat1 and mat4 is especially slow and you will know if you block more than 4 in the row and column, it shows you slow execution times. Namely, no partition and more than 16 partitions happen slow execution time.
But....
The above mul function is my custom matrix multiplication function between two matrix type. If you use mul function instead of * operator, you will get a proper execution time. Why does this happen? is it a bug? and I have tried type annotated for matrix, but it failed to get a proper execution time.