- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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
Lien copié
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
please set the environment variable MKL_VERBOSE=1 to check how many threads has been used while ?gemm was called.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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
- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable