INNER CODE UNIT · Python
get_node_flags
veg/hyphy · contrib/slurm_cpu_detect.py:14
def get_node_flags(nodes):
if not nodes:
return None
# Bypassing srun as requested. We assume cluster homogeneity and
# use the local node's CPU flags as a proxy for the entire cluster.
try:
flags = set()
with open("/proc/cpuinfo", "r") as f:
for line in f:
if line.startswith("flags") or line.startswith("Features"):
parts = line.split(":", 1)
if len(parts) >= 2:
flags = set(parts[1].strip().split())
break
if flags:
# Return the same flags for all nodes