OpenMP #238
-
(Apologies in advance for the noob question!) I'm running nequip on CPU. Can I convince the computationally expensive bits of the code to run with OpenMP? Simply setting OMP_NUM_THREADS has no obvious effect. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Hi @terryfrankcombe, I've tried to play around with this before... basically: any use of OpenMP will be inherited from PyTorch, so your best bet is to look through the PyTorch discussion forums to find out the best way to enable this for your hardware. It is very picky to get this working, in my experience, but these things also change a lot between PyTorch versions and I last looked at this a while ago. Pay particular attention to the combination of whether or not PyTorch is using MKL, whether you have AMD or Intel, etc. --- you may for example need to set |
Beta Was this translation helpful? Give feedback.
-
Just to chime in with some of my experience, using NumPy from Conda (not using MKL), I am able to get a small speedup of 1.5-2X by setting OMP_NUM_THREADS=8, but only for CPU only training on an AMD EPYC processor. It's worth a try if you don't have a GPU available. |
Beta Was this translation helpful? Give feedback.
-
Latest discussion on CPUs can be found here: #303 (comment) (Apparently building from source makes the speed much better) |
Beta Was this translation helpful? Give feedback.
Hi @terryfrankcombe,
I've tried to play around with this before... basically: any use of OpenMP will be inherited from PyTorch, so your best bet is to look through the PyTorch discussion forums to find out the best way to enable this for your hardware. It is very picky to get this working, in my experience, but these things also change a lot between PyTorch versions and I last looked at this a while ago.
Pay particular attention to the combination of whether or not PyTorch is using MKL, whether you have AMD or Intel, etc. --- you may for example need to set
MKL_NUM_THREADS
.