Open
Description
Hello,
I have encountered an issue where if hyperthreading is disabled on my machine, pyRAPL errors out in pyRAPL.setup()
. The problem appears to be that on my version of Debian Linux, the topology/
directory does not exist for disabled SMT cores. With SMT disabled on my machine, cores 0-15 are enabled and cores 16-31 are disabled. As shown in the error message below, the error occurs when pyRAPL attempts to access the topology/physical_package_id
file for core 16, which does not exist.
Traceback (most recent call last):
File "/home/willow/characterizing-pytorch-power/src/gen_dataset.py", line 182, in <module>
pyRAPL.setup()
~~~~~~~~~~~~^^
File "/home/willow/characterizing-pytorch-power/src/.venv/lib/python3.13/site-packages/pyRAPL/pyRAPL.py", line 39, in setup
pyRAPL._sensor = Sensor(devices=devices, socket_ids=socket_ids)
~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/willow/characterizing-pytorch-power/src/.venv/lib/python3.13/site-packages/pyRAPL/sensor.py", line 59, in __init__
self._device_api[device] = DeviceAPIFactory.create_device_api(device, socket_ids)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
File "/home/willow/characterizing-pytorch-power/src/.venv/lib/python3.13/site-packages/pyRAPL/device_api.py", line 186, in create_device_api
return PkgAPI(socket_ids)
File "/home/willow/characterizing-pytorch-power/src/.venv/lib/python3.13/site-packages/pyRAPL/device_api.py", line 137, in __init__
DeviceAPI.__init__(self, socket_ids)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "/home/willow/characterizing-pytorch-power/src/.venv/lib/python3.13/site-packages/pyRAPL/device_api.py", line 68, in __init__
all_socket_id = get_socket_ids()
File "/home/willow/characterizing-pytorch-power/src/.venv/lib/python3.13/site-packages/pyRAPL/device_api.py", line 50, in get_socket_ids
api_file = open('/sys/devices/system/cpu/cpu' + str(cpu_id) + '/topology/physical_package_id')
FileNotFoundError: [Errno 2] No such file or directory: '/sys/devices/system/cpu/cpu16/topology/physical_package_id'
Here is the relevant output of lscpu
:
$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 46 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 32
On-line CPU(s) list: 0-15
Off-line CPU(s) list: 16-31
Vendor ID: GenuineIntel
Model name: Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz
CPU family: 6
Model: 79
Thread(s) per core: 1
Core(s) per socket: 8
...
And my system information:
$ uname -a
Linux broadwell-ep 6.12.25-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.25-1 (2025-04-25) x86_64 GNU/Linux
If you are open to community contributions, let me know and if I have the time I'm happy to whip up a PR.
Thanks,
Willow
Metadata
Metadata
Assignees
Labels
No labels