- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, everyone!
I noticed that some parallel functions in MKL scale well with the number of cores. For example, ?gemm can be 2x if I setup two threads on two cores, and 6x if six threads on six cores. But some others, e.g. ?gemv, ?syev etc, scale less good with the number of cores. Why it is that?
Thanks in advance!
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, thank you for good question!
You're right, the scalability may vary depending on the algorithm the function implements.
For example, let's compare ?gemm vs. ?gemv for square NxN matrices and N vector:
gemmshould load3*N*N elements (matrices A, B and C) and perform ~2*N*N*N add/mul operations.
On the other hand, gemv should load N*N+2*N (matrix A and vectors X, Y), but perform ~2*N*N operations.
So, ?gemv is memory-limited operation (having not alldata in cache) and its perfromance depends more on the throughput of memory subsystem than on the number of cores.
Regards,
Konstantin
You're right, the scalability may vary depending on the algorithm the function implements.
For example, let's compare ?gemm vs. ?gemv for square NxN matrices and N vector:
gemmshould load3*N*N elements (matrices A, B and C) and perform ~2*N*N*N add/mul operations.
On the other hand, gemv should load N*N+2*N (matrix A and vectors X, Y), but perform ~2*N*N operations.
So, ?gemv is memory-limited operation (having not alldata in cache) and its perfromance depends more on the throughput of memory subsystem than on the number of cores.
Regards,
Konstantin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much!
To summarize, the compute-to-memory ratio in ?gemm is 2*N/3. If N is infinite, the ratio is 2 in ?gemv. Thus, ?gemm is compute bound, and ?gemv is bandwidth bound.
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