- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 ?
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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..
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..
![](/skins/images/D3C0B914909A6564BBB97F4AD1ED1973/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page