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

Scalene produces no results or partial results on my Windows 10 PC. #868

Open
6nc0r6-1mp6r0 opened this issue Oct 14, 2024 · 0 comments
Open

Comments

@6nc0r6-1mp6r0
Copy link

6nc0r6-1mp6r0 commented Oct 14, 2024

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?

(A copy of this question is currently posted on Stack Overflow.)


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?

@6nc0r6-1mp6r0 6nc0r6-1mp6r0 changed the title Scalene fails to run or display results in both PowerShell and VS Code Scalene produces no results or partial results on my Windows 10 PC. Oct 15, 2024
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

No branches or pull requests

1 participant