Frost
April 19, 2024, 7:16pm
1
I’m slightly confused as to how to run the MACE calculator on multiple threads, I can’t seem to find anything in any of the documentation.
from mace.calculators import mace_mp
from ase import build
atoms = build.molecule('H2O')
calc = mace_mp(model="medium", dispersion=False, default_dtype="float32", device='cpu')
atoms.calc = calc
print(atoms.get_potential_energy())
That’s about as simple as the code can get. Thanks for any help!
This version of MACE is based on PyTorch, so I think you should get some parallelism controlled by OMP_NUM_THREADS.
You may be better off directing this question to the MACE developers here: ACEsuit/mace · Discussions · GitHub
1 Like
Frost
April 24, 2024, 9:39am
3
Thank you! It worked when using MKL_NUM_THREADS
L4tte
February 24, 2025, 12:11pm
4
Hello, may i ask how to use MKL_NUM_THREADS, can you show the code plz…
Did you set MKL_NUM_THREADS in python?
Frost
February 25, 2025, 11:53am
5
Hi hi, you should set it in your terminal, run export MKL_NUM_THREADS=36
in your shell, you could do this in python too if you do
from os import system as sys
sys('export MKL_NUM_THREADS=36')
probably also worth trying OMP_NUM_THREADS too
L4tte
February 26, 2025, 3:29am
6
Hi, my current approach is to assign optimization tasks for different structures to different CPUs to improve efficiency, as my previous attempt with os.environ["MKL_NUM_THREADS"] = 32
didn’t seem to work well…
But still thank you for your response!!!