pyJoules icon indicating copy to clipboard operation
pyJoules copied to clipboard

TypeError: reduce() of empty sequence with no initial value

Open ChenfengZhao opened this issue 1 year ago • 2 comments

Hi there,

I'm trying pyJoules in a linux docker (ubuntu 16.04) running on MacOS 10.13.6.

However, when I try to run a simple script about pyJoules (shown as below), I get error information saying "TypeError: reduce() of empty sequence with no initial value". Do you know how to solve this issue? Thanks!

This is the script:

from pyJoules.energy_meter import measure_energy @measure_energy def foo(num_itr=1000000): rst = 0 for i in range(num_itr): rst *= i

foo(100000000)

This is the error information:

Traceback (most recent call last): File "pyJoules_test.py", line 10, in foo(100000000) File "/miniconda/envs/benchmark_gnn/lib/python3.7/site-packages/pyJoules/energy_meter.py", line 298, in wrapper_measure handler.process(energy_meter.get_trace()) File "/miniconda/envs/benchmark_gnn/lib/python3.7/site-packages/pyJoules/energy_meter.py", line 160, in get_trace return self._generate_trace() File "/miniconda/envs/benchmark_gnn/lib/python3.7/site-packages/pyJoules/energy_meter.py", line 169, in _generate_trace domains = self._get_domain_list() File "/miniconda/envs/benchmark_gnn/lib/python3.7/site-packages/pyJoules/energy_meter.py", line 166, in _get_domain_list return reduce(operator.add, [device.get_configured_domains() for device in self.devices]) TypeError: reduce() of empty sequence with no initial value

ChenfengZhao avatar Jul 26 '22 05:07 ChenfengZhao