-
Notifications
You must be signed in to change notification settings - Fork 529
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drop
deepmd.tf.cluster.slurm
(#3239)
The `deepmd.tf.cluster.slurm` is too specialized - we are not able to support every cluster. This PR uses mpi4py as the alternatives, considering the documentation has asked users to install mpi4py. --------- Signed-off-by: Jinzhe Zeng <[email protected]>
- Loading branch information
Showing
6 changed files
with
39 additions
and
142 deletions.
There are no files selected for viewing
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
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# SPDX-License-Identifier: LGPL-3.0-or-later | ||
import socket | ||
from typing import ( | ||
List, | ||
Tuple, | ||
) | ||
|
||
|
||
def get_host_names() -> Tuple[str, List[str]]: | ||
"""Get host names of all nodes in the cluster. | ||
If mpi4py is not installed or MPI is not used, then the | ||
host name of the current node is returned as those of all nodes. | ||
Returns | ||
------- | ||
str | ||
Host name of the current node | ||
List[str] | ||
List of host names of all nodes in the cluster | ||
""" | ||
host_name = socket.gethostname() | ||
try: | ||
from mpi4py import ( | ||
MPI, | ||
) | ||
except ImportError: | ||
return host_name, [host_name] | ||
|
||
comm = MPI.COMM_WORLD | ||
if comm.Get_size() == 1: | ||
return host_name, [host_name] | ||
host_names = comm.allgather(host_name) | ||
return host_name, list(set(host_names)) |
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
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