Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
20 Views

matrix multiplication

I am a newbie in thread programming, so sorry if my following question sounds stupid. I made a single threaded routine that multiplies two 5x5 matrices. I made another routine, 25 threaded, multiplying the pairs mat_1(line_i) x mat_2(column_j) for the same two matrices (I have a dual core processor). Why the multi-threaded routine is slower than the first one ? Is this true or have I made something wrong ?
0 Kudos
2 Replies
Highlighted
Black Belt
20 Views

A short answer: the problem is too small to overcome the overhead of threading. Probably too small to time accurately, if you did it efficiently without threading. If you test a professionally written function, such as DGEMM from Intel MKL library, you will see that it drops to a single thread for problems of this size.
0 Kudos
Highlighted
Beginner
20 Views

hello sir,
its advisable to use as many no. of software threads as there are hardware threads..
since your machine has only 2 hardware threads, its more than enough to use 2 threads..
Also, we can see a significant increase in performance only in the case of bigger programs or applications.. So dont get confused if the parallel run time is higher for ur multiplication..
0 Kudos