79638882

Date: 2025-05-26 12:16:24
Score: 0.5
Natty:
Report link

Thanks to Gilles Gouaillardet, hwloc-calc is what I was looking for. I wrote a little script to translate the bitmask.

#!/bin/python3

import argparse, subprocess

parser = argparse.ArgumentParser(description='parse verbose output of srun --cpu-bind=verbose')
parser.add_argument('file', type=str, help="the file to open")
args = parser.parse_args()
print(f"parse {args.file}")

lines = []
with open(args.file, 'r') as file:
    for line in file.readlines():
        if "cpu-bind=MASK" in line:
            lines.append(line.rstrip('\n'))
            
for line in lines:
    nodestr = line.split("=MASK - ", maxsplit=1)[-1].split(", task", maxsplit=1)[0]
    maskstr = line.split("mask ", maxsplit=1)[-1].split(" set", maxsplit=1)[0]
    print(f"{nodestr} {maskstr}")

    command = f"hwloc-calc -H package.core.pu {maskstr}"
    subprocess.run(command, shell=True)

And applying this on my log files gives me the specific bindings:

uc2n607 0x10000000000000001
Package:0.Core:0.PU:0 Package:0.Core:0.PU:1
uc2n607 0x1000000000000000100000000
Package:1.Core:0.PU:0 Package:1.Core:0.PU:1
...
Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: user28656646