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

computing-pi.md: example of JIT compilation not replicated #14

Open
wmotion opened this issue Jul 2, 2023 · 1 comment
Open

computing-pi.md: example of JIT compilation not replicated #14

wmotion opened this issue Jul 2, 2023 · 1 comment

Comments

@wmotion
Copy link

wmotion commented Jul 2, 2023

I could not replicate the example proposed in https://esciencecenter-digital-skills.github.io/parallel-python-workbench/instructor/computing-pi.html#just-in-time-compilation-speedup

Calling the numbified function with an integer argument, then with a float, and again with a float produces comparable average elapsed times: 257 ns, 306 ns, 307 ns. (N = 10^6)

See screenshot below:

image

The explanation of the JIT compilation should be adjusted if this analysis is confirmed or its unexpected behaviour explained.

With numba 0.57.0, python 3.8.16

@wmotion
Copy link
Author

wmotion commented Jul 4, 2023

This behaviour occurred also during the type-along in the edition of 4 July. As triaged then, this is strange also because sum_range_numba contains range(N) which should throw a fatal error when N is passed as a float. The computation proceeds instead, hence XPASS.

(We ought to check the function output to observe how Numba deals with this whole situation, that is, if it preserves correctness.)

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