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

LAMMPS multiple MPI instances over limited GPUs (multiple repllica simulations) #1

Open
wants to merge 3 commits into
base: mace
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/ML-MACE/pair_mace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
#include "memory.h"
#include "neigh_list.h"
#include "neighbor.h"
#include "universe.h"

#include <cuda_runtime.h>
#include <algorithm>
#include <iostream>
#include <stdexcept>
Expand Down Expand Up @@ -298,10 +300,12 @@ void PairMACE::coeff(int narg, char **arg)
} else {
std::cout << "CUDA found, setting device type to torch::kCUDA." << std::endl;
MPI_Comm local;
MPI_Comm_split_type(world, MPI_COMM_TYPE_SHARED, 0, MPI_INFO_NULL, &local);
MPI_Comm_split_type(universe->uworld, MPI_COMM_TYPE_SHARED, 0, MPI_INFO_NULL, &local);
int localrank;
MPI_Comm_rank(local, &localrank);
device = c10::Device(torch::kCUDA,localrank);
int nDevices;
cudaGetDeviceCount(&nDevices);
device = c10::Device(torch::kCUDA,localrank % nDevices);
}

std::cout << "Loading MACE model from \"" << arg[2] << "\" ...";
Expand Down