Forcing Modules To Run In Pypy From A Cpython Script (run Pypy On Part Of The Code)?
Is there a way to import modules from a CPython script, but run them in PyPy? The problem is that I have a code that uses lots of SciPy (and NumPy), but there are parts of the code
Solution 1:
Since I stumbled over this question long before the other thread, the reverse mechanism is described briefly here (Can I embed CPython inside PyPy?).
The basic idea is to start a PyPy interpreter alongside the CPython interpreter (or vise versa) and connect them via inter process communication. While you might be tempted to try to do this via pipes or sockets, it is highly recommended to use a higher-level library, such as execnet (which is actually used for this purpose).
If you go for a low-level approach, be sure to decide early if and how you can handle architectures such as multi-thread or multi-process execution, whether you want asynchronous computation or even master-worker setups.
Post a Comment for "Forcing Modules To Run In Pypy From A Cpython Script (run Pypy On Part Of The Code)?"