- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Forum,
I am trying to make MKL accelerate a matrix multiplication for me. It works, but MKL insists on doing it with a single thread. I played around a bit. But regardless of what I do - even when multiplying two randomly initialized 10000x10000 matrices - MKL does not use multiple threads. Am I missing something?
Function:
BLAS sgemm, via libmkl_rt.so
Environment settings:
MKL_NUM_THREADS=8; export MKL_NUM_THREADS OMP_NUM_THREADS=8; export OMP_NUM_THREADS MKL_DYNAMIC=FALSE; export MKL_DYNAMIC OMP_DYNAMIC=FALSE; export OMP_DYNAMIC MKL_DOMAIN_NUM_THREADS=MKL_DOMAIN_ALL,8; export MKL_DOMAIN_NUM_THREADS OMP_DOMAIN_NUM_THREADS=MKL_DOMAIN_ALL,8; export OMP_DOMAIN_NUM_THREADS
Machine:
LinuxMint 17.2, Kernel: 3.19.0-26, CPU: 4th gen. i7, HT activated in BIOS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Matthias L.
Do you have any result if MKL_VERBOSE=1 ? Or are you calling sgemm in one multi-thread application?
In some of situation, the MKL may not spawns threads as external threads.
Best Regards,
Ying
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Matthias, how do you check that MKL runs single-threaded? Also, can you please show your LD_LIBRARY_PATH?
Usually setting OMP_NUM_THREADS is not even necessary since when it is not set, the Intel OpenMP library would use all the CPUs in the process CPU mask which is set to all CPUs by default.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
please set the environment variable MKL_VERBOSE=1 to check how many threads has been used while ?gemm was called.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Matthias L.
Do you have any result if MKL_VERBOSE=1 ? Or are you calling sgemm in one multi-thread application?
In some of situation, the MKL may not spawns threads as external threads.
Best Regards,
Ying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your comments and sorry that it took so long. I got it working properly now. There was some conflict with the LD_LBIRARY_PATH. Instead the system loaded the another BLAS implementation that I had installed. Why that was I cannot tell. I can hereby confirm that the MK_VERBOSE is very helpful for diagnosing issues. And that
MKL_NUM_THREADS=8;
export
MKL_NUM_THREADS
OMP_NUM_THREADS=8;
export
OMP_NUM_THREADS
MKL_DYNAMIC=FALSE;
export
MKL_DYNAMIC
OMP_DYNAMIC=FALSE;
export
OMP_DYNAMIC
produces the right results one would expect (if one loads the right runtime library).
~Matthias

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page