Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: cannot convert float NaN to integer #58

Open
T1mVo opened this issue Mar 13, 2023 · 3 comments · May be fixed by #60
Open

ValueError: cannot convert float NaN to integer #58

T1mVo opened this issue Mar 13, 2023 · 3 comments · May be fixed by #60

Comments

@T1mVo
Copy link

T1mVo commented Mar 13, 2023

Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.11/site-packages/asitop/utils.py", line 19, in parse_powermetrics
    gpu_metrics_dict = parse_gpu_metrics(powermetrics_parse)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/asitop/parsers.py", line 141, in parse_gpu_metrics
    "active": int((1 - gpu_metrics["idle_ratio"])*100),
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: cannot convert float NaN to integer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/bin/asitop", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/asitop/asitop.py", line 183, in main
    ready = parse_powermetrics(timecode=timecode)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/asitop/utils.py", line 30, in parse_powermetrics
    gpu_metrics_dict = parse_gpu_metrics(powermetrics_parse)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/asitop/parsers.py", line 141, in parse_gpu_metrics
    "active": int((1 - gpu_metrics["idle_ratio"])*100),
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: cannot convert float NaN to integer
@raylau1234
Copy link

raylau1234 commented Jun 24, 2023

I am seeing the same error but for cpu when I do something that maxes out the CPUs (like run a cinebench multi-core benchmark reproduces 100% for me). I am on a MacStudio non-ultra running Ventura 13.4.1.

I think it is because the power clusters are showing nan's in powermetrics:

P0-Cluster Online: 100%
P0-Cluster HW active frequency: 3264 MHz
P0-Cluster HW active residency: 100.00% (702 MHz:   0% 948 MHz:   0% 1188 MHz:   0% 1452 MHz:   0% 1704 MHz:   0% 1968 MHz:   0% 2208 MHz:   0% 2400 MHz:   0% 2568 MHz:   0% 2724 MHz:   0% 2868 MHz:   0% 3000 MHz:   0% 3132 MHz:   0% 3264 MHz: 100% 3360 MHz:   0% 3408 MHz:   0% 3504 MHz:   0% 3528 MHz:   0% 3696 MHz:   0%)
P0-Cluster idle residency:   0.00%
P0-Cluster down residency:   0.00%
P0-Cluster instructions retired: 1.8833e+11
P0-Cluster instructions per clock: 2.87462
CPU 4 frequency: 0 MHz
CPU 4 idle residency:    nan%
CPU 4 active residency:    nan% (702 MHz:   0% 948 MHz:   0% 1188 MHz:   0% 1452 MHz:   0% 1704 MHz:   0% 1968 MHz:   0% 2208 MHz:   0% 2400 MHz:   0% 2568 MHz:   0% 2724 MHz:   0% 2868 MHz:   0% 3000 MHz:   0% 3132 MHz:   0% 3264 MHz:   0% 3360 MHz:   0% 3408 MHz:   0% 3504 MHz:   0% 3528 MHz:   0% 3696 MHz:   0%)
CPU 5 frequency: 702 MHz
CPU 5 idle residency:   0.00%
CPU 5 active residency: 100.00% (702 MHz: 100% 948 MHz:   0% 1188 MHz:   0% 1452 MHz:   0% 1704 MHz:   0% 1968 MHz:   0% 2208 MHz:   0% 2400 MHz:   0% 2568 MHz:   0% 2724 MHz:   0% 2868 MHz:   0% 3000 MHz:   0% 3132 MHz:   0% 3264 MHz:   0% 3360 MHz:   0% 3408 MHz:   0% 3504 MHz:   0% 3528 MHz:   0% 3696 MHz:   0%)
CPU 6 frequency: 0 MHz
CPU 6 idle residency:    nan%
CPU 6 active residency:    nan% (702 MHz:   0% 948 MHz:   0% 1188 MHz:   0% 1452 MHz:   0% 1704 MHz:   0% 1968 MHz:   0% 2208 MHz:   0% 2400 MHz:   0% 2568 MHz:   0% 2724 MHz:   0% 2868 MHz:   0% 3000 MHz:   0% 3132 MHz:   0% 3264 MHz:   0% 3360 MHz:   0% 3408 MHz:   0% 3504 MHz:   0% 3528 MHz:   0% 3696 MHz:   0%)
CPU 7 frequency: 702 MHz
CPU 7 idle residency:   0.00%
CPU 7 active residency: 100.00% (702 MHz: 100% 948 MHz:   0% 1188 MHz:   0% 1452 MHz:   0% 1704 MHz:   0% 1968 MHz:   0% 2208 MHz:   0% 2400 MHz:   0% 2568 MHz:   0% 2724 MHz:   0% 2868 MHz:   0% 3000 MHz:   0% 3132 MHz:   0% 3264 MHz:   0% 3360 MHz:   0% 3408 MHz:   0% 3504 MHz:   0% 3528 MHz:   0% 3696 MHz:   0%)

P1-Cluster Online: 100%
P1-Cluster HW active frequency: 3264 MHz
P1-Cluster HW active residency: 100.00% (702 MHz:   0% 948 MHz:   0% 1188 MHz:   0% 1452 MHz:   0% 1704 MHz:   0% 1968 MHz:   0% 2208 MHz:   0% 2400 MHz:   0% 2568 MHz:   0% 2724 MHz:   0% 2868 MHz:   0% 3000 MHz:   0% 3132 MHz:   0% 3264 MHz: 100% 3360 MHz:   0% 3408 MHz:   0% 3504 MHz:   0% 3528 MHz:   0% 3696 MHz:   0%)
P1-Cluster idle residency:   0.00%
P1-Cluster down residency:   0.00%
P1-Cluster instructions retired: 1.89002e+11
P1-Cluster instructions per clock: 2.88476
CPU 8 frequency: 0 MHz
CPU 8 idle residency:    nan%
CPU 8 active residency:    nan% (702 MHz:   0% 948 MHz:   0% 1188 MHz:   0% 1452 MHz:   0% 1704 MHz:   0% 1968 MHz:   0% 2208 MHz:   0% 2400 MHz:   0% 2568 MHz:   0% 2724 MHz:   0% 2868 MHz:   0% 3000 MHz:   0% 3132 MHz:   0% 3264 MHz:   0% 3360 MHz:   0% 3408 MHz:   0% 3504 MHz:   0% 3528 MHz:   0% 3696 MHz:   0%)
CPU 9 frequency: 702 MHz
CPU 9 idle residency:   0.00%
CPU 9 active residency: 100.00% (702 MHz: 100% 948 MHz:   0% 1188 MHz:   0% 1452 MHz:   0% 1704 MHz:   0% 1968 MHz:   0% 2208 MHz:   0% 2400 MHz:   0% 2568 MHz:   0% 2724 MHz:   0% 2868 MHz:   0% 3000 MHz:   0% 3132 MHz:   0% 3264 MHz:   0% 3360 MHz:   0% 3408 MHz:   0% 3504 MHz:   0% 3528 MHz:   0% 3696 MHz:   0%)
CPU 10 frequency: 702 MHz
CPU 10 idle residency:   0.00%
CPU 10 active residency: 100.00% (702 MHz: 100% 948 MHz:   0% 1188 MHz:   0% 1452 MHz:   0% 1704 MHz:   0% 1968 MHz:   0% 2208 MHz:   0% 2400 MHz:   0% 2568 MHz:   0% 2724 MHz:   0% 2868 MHz:   0% 3000 MHz:   0% 3132 MHz:   0% 3264 MHz:   0% 3360 MHz:   0% 3408 MHz:   0% 3504 MHz:   0% 3528 MHz:   0% 3696 MHz:   0%)
CPU 11 frequency: 0 MHz
CPU 11 idle residency:    nan%
CPU 11 active residency:    nan% (702 MHz:   0% 948 MHz:   0% 1188 MHz:   0% 1452 MHz:   0% 1704 MHz:   0% 1968 MHz:   0% 2208 MHz:   0% 2400 MHz:   0% 2568 MHz:   0% 2724 MHz:   0% 2868 MHz:   0% 3000 MHz:   0% 3132 MHz:   0% 3264 MHz:   0% 3360 MHz:   0% 3408 MHz:   0% 3504 MHz:   0% 3528 MHz:   0% 3696 MHz:   0%)

This does not happen for efficiency:

E-Cluster Online: 100%
E-Cluster HW active frequency: 2424 MHz
E-Cluster HW active residency: 100.00% (912 MHz:   0% 1284 MHz:   0% 1752 MHz:   0% 2004 MHz:   0% 2256 MHz:   0% 2424 MHz: 100%)
E-Cluster idle residency:   0.00%
E-Cluster down residency:   0.00%
E-Cluster instructions retired: 8.44842e+10
E-Cluster instructions per clock: 1.73693
CPU 0 frequency: 912 MHz
CPU 0 idle residency:   0.00%
CPU 0 active residency: 100.00% (912 MHz: 100% 1284 MHz:   0% 1752 MHz:   0% 2004 MHz:   0% 2256 MHz:   0% 2424 MHz:   0%)
CPU 1 frequency: 912 MHz
CPU 1 idle residency:   0.00%
CPU 1 active residency: 100.00% (912 MHz: 100% 1284 MHz:   0% 1752 MHz:   0% 2004 MHz:   0% 2256 MHz:   0% 2424 MHz:   0%)
CPU 2 frequency: 912 MHz
CPU 2 idle residency:   0.00%
CPU 2 active residency: 100.00% (912 MHz: 100% 1284 MHz:   0% 1752 MHz:   0% 2004 MHz:   0% 2256 MHz:   0% 2424 MHz:   0%)
CPU 3 frequency: 912 MHz
CPU 3 idle residency:   0.00%
CPU 3 active residency: 100.00% (912 MHz: 100% 1284 MHz:   0% 1752 MHz:   0% 2004 MHz:   0% 2256 MHz:   0% 2424 MHz:   0%)

@redthing1
Copy link

Seeing this as well

@redthing1
Copy link

@tlkh please check the above linked PR, it solves this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants