pyRAPL icon indicating copy to clipboard operation
pyRAPL copied to clipboard

iteration

Open fnoorbin opened this issue 3 years ago • 2 comments

Hi, Is it pyRAPL available for windows? what can be used for windows?

when the "number" is set >1, is a for loop required to run the function or measureit decorator measures it in iteration of number itself?

fnoorbin avatar Jul 28 '20 14:07 fnoorbin

@altor @chakib-belgaid @rouvoy

I also have the same question as @fnoorbin, I'm trying to profile energy consumption on Windows but when I end up with the following stack trace:

  File "C:\Users\kesha\Documents\NCSA\nengo.LIF_0.001_v4_nengo_synpase0.1_mp\reservoir.py", line 111, in initialize_reservoir
    pyRAPL.setup()
  File "C:\Users\kesha\Documents\NCSA\loihi\venv\lib\site-packages\pyRAPL\pyRAPL.py", line 39, in setup
    pyRAPL._sensor = Sensor(devices=devices, socket_ids=socket_ids)
  File "C:\Users\kesha\Documents\NCSA\loihi\venv\lib\site-packages\pyRAPL\sensor.py", line 59, in __init__
    self._device_api[device] = DeviceAPIFactory.create_device_api(device, socket_ids)
  File "C:\Users\kesha\Documents\NCSA\loihi\venv\lib\site-packages\pyRAPL\device_api.py", line 186, in create_device_api
    return PkgAPI(socket_ids)
  File "C:\Users\kesha\Documents\NCSA\loihi\venv\lib\site-packages\pyRAPL\device_api.py", line 137, in __init__
    DeviceAPI.__init__(self, socket_ids)
  File "C:\Users\kesha\Documents\NCSA\loihi\venv\lib\site-packages\pyRAPL\device_api.py", line 68, in __init__
    all_socket_id = get_socket_ids()
  File "C:\Users\kesha\Documents\NCSA\loihi\venv\lib\site-packages\pyRAPL\device_api.py", line 49, in get_socket_ids
    for cpu_id in cpu_ids():
  File "C:\Users\kesha\Documents\NCSA\loihi\venv\lib\site-packages\pyRAPL\device_api.py", line 31, in cpu_ids
    api_file = open('/sys/devices/system/cpu/present', 'r')
FileNotFoundError: [Errno 2] No such file or directory: '/sys/devices/system/cpu/present'

When I run the same code on a Linux system, I end up with the following stack trace:

Traceback (most recent call last):
  File "/jet/home/kshivvy/spiking_reservoir_rl_elastica/reservoir.py", line 111, in initialize_reservoir
    pyRAPL.setup()
  File "/jet/home/kshivvy/.conda/envs/venv/lib/python3.8/site-packages/pyRAPL/pyRAPL.py", line 39, in setup
    pyRAPL._sensor = Sensor(devices=devices, socket_ids=socket_ids)
  File "/jet/home/kshivvy/.conda/envs/venv/lib/python3.8/site-packages/pyRAPL/sensor.py", line 68, in __init__
    raise PyRAPLCantRecordEnergyConsumption(None)
pyRAPL.exception.PyRAPLCantRecordEnergyConsumption

Does your package support Windows, and if not do you know how I can profile how much energy certain lines of my Python code use?

kshivvy avatar Feb 24 '21 15:02 kshivvy

@altor @chakib-belgaid @rouvoy

I also have the same question as @fnoorbin, I'm trying to profile energy consumption on Windows but when I end up with the following stack trace:

  File "C:\Users\kesha\Documents\NCSA\nengo.LIF_0.001_v4_nengo_synpase0.1_mp\reservoir.py", line 111, in initialize_reservoir
    pyRAPL.setup()
  File "C:\Users\kesha\Documents\NCSA\loihi\venv\lib\site-packages\pyRAPL\pyRAPL.py", line 39, in setup
    pyRAPL._sensor = Sensor(devices=devices, socket_ids=socket_ids)
  File "C:\Users\kesha\Documents\NCSA\loihi\venv\lib\site-packages\pyRAPL\sensor.py", line 59, in __init__
    self._device_api[device] = DeviceAPIFactory.create_device_api(device, socket_ids)
  File "C:\Users\kesha\Documents\NCSA\loihi\venv\lib\site-packages\pyRAPL\device_api.py", line 186, in create_device_api
    return PkgAPI(socket_ids)
  File "C:\Users\kesha\Documents\NCSA\loihi\venv\lib\site-packages\pyRAPL\device_api.py", line 137, in __init__
    DeviceAPI.__init__(self, socket_ids)
  File "C:\Users\kesha\Documents\NCSA\loihi\venv\lib\site-packages\pyRAPL\device_api.py", line 68, in __init__
    all_socket_id = get_socket_ids()
  File "C:\Users\kesha\Documents\NCSA\loihi\venv\lib\site-packages\pyRAPL\device_api.py", line 49, in get_socket_ids
    for cpu_id in cpu_ids():
  File "C:\Users\kesha\Documents\NCSA\loihi\venv\lib\site-packages\pyRAPL\device_api.py", line 31, in cpu_ids
    api_file = open('/sys/devices/system/cpu/present', 'r')
FileNotFoundError: [Errno 2] No such file or directory: '/sys/devices/system/cpu/present'

When I run the same code on a Linux system, I end up with the following stack trace:

Traceback (most recent call last):
  File "/jet/home/kshivvy/spiking_reservoir_rl_elastica/reservoir.py", line 111, in initialize_reservoir
    pyRAPL.setup()
  File "/jet/home/kshivvy/.conda/envs/venv/lib/python3.8/site-packages/pyRAPL/pyRAPL.py", line 39, in setup
    pyRAPL._sensor = Sensor(devices=devices, socket_ids=socket_ids)
  File "/jet/home/kshivvy/.conda/envs/venv/lib/python3.8/site-packages/pyRAPL/sensor.py", line 68, in __init__
    raise PyRAPLCantRecordEnergyConsumption(None)
pyRAPL.exception.PyRAPLCantRecordEnergyConsumption

Does your package support Windows, and if not do you know how I can profile how much energy certain lines of my Python code use?

@kshivvy This package could be used only with Linux and not Windows. But I am no more able to use it with Linux, I think some permissions have changed by the Linux updates and then it was not accessible.

fnoorbin avatar Feb 25 '21 02:02 fnoorbin