Code Monkey home page Code Monkey logo

nuitka-numba-workaround's People

Contributors

taan-burapol avatar

Watchers

 avatar

nuitka-numba-workaround's Issues

JIT compilation not activated during execution of Numpy-importing functions

Hi, thank you for the great work!
I am trying to compile a script with Nuitka for standalone distribution, and I have 3 functions heavily relying on Numpy that in the Python execution are accelerated with Numba jit compiler (nopython, of course; I tried with forceobj and it was waaaaay slower). I put the three Numpy-Numba functions in a single separate file in the same folder as the main file, and call it with "exec" as in your example scripts (I actually duplicated the "import" statements in a separate file so I can later obfuscate everything with Marshal).
When I compile according to your instructions I obtain execution times similar to vanilla Nuitka-compiled, that is about 6 times slower than Numba jit (3 minutes vs 30 seconds).
For completeness and reproducibility, here is the command I used for compilation:
python -m nuitka myScript.py --follow-imports --standalone --include-module=numba --module-parameter=numba-disable-jit=no --include-data-file=./numba_import.py=numba_import.py --include-data-file=./numba_jit.py=numba_jit.py

As Nuitka was giving a warning about Numba jit being disabled in Nuitka standalone compilation, I added the flag
--module-parameter=numba-disable-jit=no
to the previous command, but in this case the compiled exe is not even running, and I receive errors in the function "error_rewrite" in the file "numba\core\dispatcher.py"

I am running on a Windows 10 system, in a conda environment with Python 3.10.13 and the following packages installed via pip (to avoid MKL bloating):
numpy==1.26.3
scipy==1.11.4
numba==0.59.0
ordered-set==4.1.0
nuitka==2.0.1
simpleitk==2.3.1
numpy-stl==3.1.1

Have you experienced anything similar? Is it possible to run your proposed hybrid compilation approach when imports are required? Or simply something has changed inside Nuitka after your compilation guide?
Thank you in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.