Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Easy switch between GPU/CPU for forcefields #829

Closed
JaGeo opened this issue May 3, 2024 · 6 comments · Fixed by #830
Closed

Feature: Easy switch between GPU/CPU for forcefields #829

JaGeo opened this issue May 3, 2024 · 6 comments · Fixed by #830

Comments

@JaGeo
Copy link
Member

JaGeo commented May 3, 2024

For workstations, switching between GPUs and CPUs should be possible for the force field workflows. Do we currently have an easy option within the workflow to do so?

We typically run these jobs on either GPUs or CPUs and rarely have an issue. Did anyone of you run into this? @esoteric-ephemera @janosh ? Especially in the context of CHGNet?

@janosh
Copy link
Member

janosh commented May 3, 2024

Are you asking about switching device mid-workflow? I've never tried or needed that, so can't comment.

To initialize a workflow on different device, there's the use_device kwarg.

I was going to add a new parameter model_kwargs to the ForceFieldMakers be able to customize model loading including use_device

@JaGeo
Copy link
Member Author

JaGeo commented May 3, 2024

Are you asking about switching device mid-workflow? I've never tried or needed that, so can't comment.

To initialize a workflow on different device, there's the use_device kwarg.

I was going to add a new parameter model_kwargs to the ForceFieldMakers be able to customize model loading including use_device

I am asking about initialization. Would be great to have that parameter

@esoteric-ephemera
Copy link
Contributor

@janosh you can already pass that switch through calculator_kwargs if it's a kwarg of the ML model's calculator

@janosh
Copy link
Member

janosh commented May 3, 2024

sweet, i'd forgotten you added that in #722.

looks like there are some doc string vestiges from a MACE-specific version of that which I'd planned to standardize across models at some point. i'll remove those

model_kwargs: dict[str, Any]
Further keywords (e.g. device, default_dtype, model) for
:obj:`mace.calculators.MACECalculator()'`.
"""

@JaGeo
Copy link
Member Author

JaGeo commented May 3, 2024

@esoteric-ephemera @janosh thank you both! I will then close this as resolved!

@JaGeo JaGeo closed this as completed May 3, 2024
@esoteric-ephemera
Copy link
Contributor

esoteric-ephemera commented May 3, 2024

Oh yeah if you don't mind doing that, that would be great. I also forgot to copy the base doc str over from the parent Relax, Static, and MD forcefield makers. If you don't mind adding that too, would be super appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants