MCPcopy Index your code
hub / github.com/InternLM/InternLM / get_master_node

Function get_master_node

internlm/utils/common.py:27–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25
26
27def get_master_node():
28 import subprocess
29
30 if os.getenv("SLURM_JOB_ID") is None:
31 raise RuntimeError("get_master_node can only used in Slurm launch!")
32 result = subprocess.check_output('scontrol show hostnames "$SLURM_JOB_NODELIST" | head -n 1', shell=True)
33 result = result.decode("utf8").strip()
34 return result
35
36
37def move_norm_to_cuda(norm: Union[float, torch.Tensor]) -> Union[float, torch.Tensor]:

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected