duartegroup / mlp-train

MLP training for molecular systems
MIT License
24 stars 9 forks source link

parallelization issue for simple MLP dynamics #90

Open gtusha opened 3 months ago

gtusha commented 3 months ago

Hello! I was playing around with the parallelization of MLP-MDs in mlp-train. I have used the mlptrain/sampling/tests/test_umbrella.py as a template for my tests. I have notinced that each window in the umbrella sampling cannot run on more than one core (check on my output.log). Am I missing something?

I am including the scripts used in my test. test.zip data.zip

Thank you for your time!

Cheers, Gers

vitartas commented 3 months ago

Hi Gers,

I believe this is correct. As far as I understand the ASE MD code which is called in the run_mlp_md() routine does not benefit from additional OMP threads. However, it might be possible for the ASE calculator (depending on the calculator used) to use multiple OMP threads, but this is unlikely, as can be seen in your test. For this reason I have set kwargs["n_cores"] = 1 in the _run_individual_window() routine in umbrella.py. Therefore, it might be a good idea to set OMP_NUM_THREADS to 1 in run_mlp_md routine in the future versions of the mlp-train code.

Because of this, to fully utilize all the available cores, the number of windows used in umbrella sampling should match the number of cores available.

Best, Valdas

gtusha commented 3 months ago

Hi Valdas! Thank you for the thorough and quick answer.

Cheers, Gers