-
Notifications
You must be signed in to change notification settings - Fork 19
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
Remove MPI from multi-GPU example #268
Open
jwallwork23
wants to merge
6
commits into
main
Choose a base branch
from
253_multigpu-no-mpi
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jwallwork23
added
documentation
Improvements or additions to documentation
testing
Related to FTorch testing
labels
Jan 30, 2025
jwallwork23
force-pushed
the
253_multigpu-no-mpi
branch
from
January 30, 2025 14:02
aa79743
to
8be7e77
Compare
Tested on a laptop with 1 CUDA GPU device with the patch diff --git a/examples/3_MultiGPU/multigpu_infer_fortran.f90 b/examples/3_MultiGPU/multigpu_infer_fortran.f90
index 297844e..cfba096 100644
--- a/examples/3_MultiGPU/multigpu_infer_fortran.f90
+++ b/examples/3_MultiGPU/multigpu_infer_fortran.f90
@@ -27,7 +27,7 @@ program inference
type(torch_tensor), dimension(1) :: out_tensors
! Variables for multi-GPU setup
- integer, parameter :: num_devices = 2
+ integer, parameter :: num_devices = 1
integer :: device_index, i
! Get TorchScript model file as a command line argument
diff --git a/examples/3_MultiGPU/multigpu_infer_python.py b/examples/3_MultiGPU/multigpu_infer_python.py
index 1b49398..c504063 100644
--- a/examples/3_MultiGPU/multigpu_infer_python.py
+++ b/examples/3_MultiGPU/multigpu_infer_python.py
@@ -53,7 +53,7 @@ def deploy(saved_model: str, device: str, batch_size: int = 1) -> torch.Tensor:
if __name__ == "__main__":
saved_model_file = "saved_multigpu_model_cuda.pt"
- for device_index in range(2):
+ for device_index in range(1):
device_to_run = f"cuda:{device_index}"
batch_size_to_run = 1 |
jwallwork23
force-pushed
the
253_multigpu-no-mpi
branch
from
January 30, 2025 14:09
8be7e77
to
88e836e
Compare
Draft
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
documentation
Improvements or additions to documentation
gpu
Related to buiding and running on GPU
testing
Related to FTorch testing
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #253.
I decided to close #258 and split it into two separate PRs. Here's the first one that removes MPI from the multi-GPU example. (The second one will introduce a CPU-only example that uses MPI.)
Note that I decided to switch the names of the
multigpu.py
module /MultiGPU
class back tosimplenet.py
/SimpleNet
in this example. This is because the class is a direct copy. (Unlike inMultiIONet
, where it's modified.)