Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.

matrix multiplication

rdabra
初学者
724 次查看
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 项奖励
2 回复数
TimP
名誉分销商 III
724 次查看
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 项奖励
ashoksaravanan
初学者
724 次查看
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 项奖励
回复