Print NUMA/CPU topology before nsys captures stdout.
(rank: str)
| 77 | |
| 78 | |
| 79 | def _print_numa_info(rank: str) -> None: |
| 80 | """Print NUMA/CPU topology before nsys captures stdout.""" |
| 81 | cpus = sorted(os.sched_getaffinity(0)) |
| 82 | print(f"[rank {rank}] CPUs (after bind): {cpus}", flush=True) |
| 83 | if rank == "0": |
| 84 | try: |
| 85 | topo = subprocess.check_output(["nvidia-smi", "topo", "-m"], text=True).strip() |
| 86 | print(f"GPU topology:\n{topo}", flush=True) |
| 87 | except (FileNotFoundError, subprocess.CalledProcessError) as e: |
| 88 | print(f"[rank {rank}] Failed to get GPU topology: {e}", flush=True) |
| 89 | |
| 90 | |
| 91 | def main(): |