SapereAude
SapereAude

Reputation: 337

Why does Scalene produce no results or partial results on my Windows 10 PC?

I just installed Scalene 1.5.45 and have Python 3.12.0 and VS Code 1.94.2 already installed. I am running Windows 10 on a Dell laptop.

I am using the test script below introduced at about 24:30 in this video and have saved it as problem1.py.

import numpy as np

def main():
    for i in range(10):
        x = np.array(range(10**7))
        y = np.array(np.random.uniform(0, 100, size=(10**8)))
main()
print('Done.')

(1) When I open a PowerShell window, cd to the directory containing problem1.py, and run python problem1.py, the code runs fine and outputs "Done.". When I run scalene problem1.py instead, the code again seems to run fine and returns "Done.", but is followed by the message:

Scalene: The specified code did not run for long enough to profile. By default, Scalene only profiles code in the file executed and its subdirectories. To track the time spent in all files, use the --profile-all option. NOTE: The GPU is currently running in a mode that can reduce Scalene's accuracy when reporting GPU utilization. If you have sudo privileges, you can run this command (Linux only) to enable per-process GPU accounting: python3 -m scalene.set_nvidia_gpu_modes

No window with profiling results automatically appears. The code takes maybe 20 seconds or so to complete, so I think it may in fact be running for long enough to profile.

(2) I also encounter a similar issue in VS Code. The code runs as expected when not profiling. However, when I follow the (excellent) instructions given in this GitHub issue — press Ctrl+Shift+P, type "scalene", and select the only option in the drop-down menu — a pop-up window appears in the lower right corner of VS Code titled "Scalene: now profiling". This box sticks around for perhaps 20 seconds and then disappears. Nothing prints to the terminal and no window with results automatically appears.

What could be the possible causes of issues (1) and (2), or how should I troubleshoot them?

(I am posting this question on Stack Overflow with the thought that answers might be useful to other programmers working with Scalene, but if the question should go elsewhere, please let me know with a comment. A copy is currently posted on GitHub.)


Update. While I still do not understand the error-like message quoted above, I went ahead and tried scalene problem1.py --profile-all, and this did bring up a webpage with what appears to be partial profiling results. It is hard to describe the content of this webpage without a screenshot, so I will tentatively include one, and if anyone has objections to this, let me know with a comment.

enter image description here

Notably, lines 1, 2, 5, 7, and 8 of problem1.py do not appear in the above profiling. And the first block that appears to profile "threading" operations is not shown in the video mentioned above. A run on a separate PC with a different history and software yielded identical results. Additionally, similar profiling of other test functions showed the same clipped/fragmented profiling results.

The caveat below still appears in the terminal after running scalene problem1.py --profile-all.

NOTE: The GPU is currently running in a mode that can reduce Scalene's accuracy when reporting GPU utilization. If you have sudo privileges, you can run this command (Linux only) to enable per-process GPU accounting: python3 -m scalene.set_nvidia_gpu_modes

I could not find an equivalent Windows command to address this.

So, with all that said, is there anything that I can do on my Windows machines to make Scalene profile all lines of problem1.py above?

Upvotes: 1

Views: 315

Answers (0)

Related Questions