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

Multiple GPUs using DataParallel #484

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

nerkulec
Copy link

This allows for utilization of multiple GPUs for training of MALA models.
It is done with DataParallel, which in contrast to DistributedDataParallel does not require multiprocessing.
Simply use

parameters.running.num_gpus = 4

No additional changes to python or slurm scripts are needed.

@RandomDefaultUser
Copy link
Member

Thanks for the PR! I really like this and I think we should implement this, before we move to DDP (which is the next thing on my todo list), so I just had a look at this PR.
I have two suggestions/adjustments:

  1. I would get rid of the example, since it only showcases one changed parameter. We can simply update the documentation.
  2. I think the functionality of parameters.running.num_gpus = 4 can simply be absorbed into parameters.use_gpu. That value could simply be an int instead of a bool, without any drawbacks.

I have made these changes in a PR here: nerkulec#1, if that looks OK we could first merge that PR and then this one here.

@RandomDefaultUser
Copy link
Member

Oh wait, there is one potential problem, and that is when training with multiple GPUs and then loading to run with either only one GPU or MPI+GPU. I will test this right away!

nerkulec and others added 2 commits April 25, 2024 11:11
@nerkulec
Copy link
Author

I like your changes :)
I added a small fix to my part. Now the checks make much more sense. Feel free to merge when you resolve the potential problem you mentioned.

# Conflicts:
#	mala/descriptors/descriptor.py
@RandomDefaultUser
Copy link
Member

I confirmed that inference pipeline indeed still works!

@RandomDefaultUser
Copy link
Member

In theory this works, once this is benchmarked we can merge it!

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

Successfully merging this pull request may close these issues.

None yet

2 participants