fijal / jitpy Goto Github PK
View Code? Open in Web Editor NEWLibrary to embed PyPy into CPython
License: MIT License
Library to embed PyPy into CPython
License: MIT License
Visual Studio link.exe is raising an error with exit status 1181
I had to change some code on https://github.com/fijal/jitpy/blob/master/jitpy/__init__.py#L41:
if not pypy_home.join('libpypy-c.so').check():
libdir = pypy_home.join('bin')
if not libdir.join('libpypy-c.so').check():
libdir = pypy_home.join('pypy', 'goal')
if not libdir.join('libpypy-c.so').check():
raise Exception("Can't find libpypy-c.so, point PYPY_HOME to "
"directory with libpypy-c.so")
where I think libpypy-c.so
should be libpypy-c.dll
for the windows case.
After that I get an error on https://github.com/fijal/jitpy/blob/master/jitpy/__init__.py#L55
ffi.verify(...)
would need another parameters for windows?
Maybe I'm wrong as I'm far of a good knowledge of c and compilers.
Kind regards.
may I ask which module is this?
Hi,
I really love pypy and jitpy, but for my work, I need to pass complex arguments to pypy functions, not just ints or strings.
So my solution is to convert everything into strings with pickle. Of course it a very dirty hack, but my code still runs many,many times faster than python :-)
It would be great if jitpy could handle all this directly, with some kind of decorator. Unfortunately I don't have enough python/pypy expertise to customize jitpy.
Here is the code I use to send/receive pickled strings.
from jitpy import setup
setup('/opt/pypy-2.5.0-linux/bin')
from jitpy.wrapper import jittify
import pickle
from cffi import FFI
@jittify([str],str)
def func(_pypy_arg):
import pickle
from cffi import FFI
ffi = FFI()
args = pickle.loads( ffi.string(_pypy_arg) )
ret = "Processing "+str(args)+" and we're done..."
return ffi.new("char[]",pickle.dumps(ret))
ffi = FFI()
_ret = func( pickle.dumps(["go",4,"it !!!"]))
print pickle.loads( ffi.string(_ret) )
Best regards,
Yann
It's looking for a .so but on OSX it's a dylib:
Traceback (most recent call last): File "al_csa_numpy.py", line 28, in <module> setup('/Users/rickvipond/Sites/pypy_binaries/pypy2-v5.7.1-osx64/bin/pypy') File "/Users/rickvipond/.virtualenvs/coachfairer/lib/python2.7/site-packages/jitpy/__init__.py", line 48, in setup raise Exception("Can't find libpypy-c.so, point PYPY_HOME to " Exception: Can't find libpypy-c.so, point PYPY_HOME to directory with libpypy-c.so
Changing the code to dylib spawns a new error
/Users/rickvipond/.virtualenvs/coachfairer/lib/python2.7/site-packages/jitpy/__pycache__/_cffi__xb7f78f43x68124feb.c:211:14: fatal error:
'numpy/arrayobject.h' file not found
#include <numpy/arrayobject.h>
^
1 error generated.
Traceback (most recent call last):
File "al_csa_numpy.py", line 28, in <module>
setup('/Users/rickvipond/Sites/pypy_binaries/pypy2-v5.7.1-osx64/bin/')
File "/Users/rickvipond/.virtualenvs/coachfairer/lib/python2.7/site-packages/jitpy/__init__.py", line 113, in setup
""")
File "/Users/rickvipond/.virtualenvs/coachfairer/lib/python2.7/site-packages/cffi/api.py", line 438, in verify
lib = self.verifier.load_library()
File "/Users/rickvipond/.virtualenvs/coachfairer/lib/python2.7/site-packages/cffi/verifier.py", line 114, in load_library
self._compile_module()
File "/Users/rickvipond/.virtualenvs/coachfairer/lib/python2.7/site-packages/cffi/verifier.py", line 211, in _compile_module
outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
File "/Users/rickvipond/.virtualenvs/coachfairer/lib/python2.7/site-packages/cffi/ffiplatform.py", line 20, in compile
outputfilename = _build(tmpdir, ext, compiler_verbose, debug)
File "/Users/rickvipond/.virtualenvs/coachfairer/lib/python2.7/site-packages/cffi/ffiplatform.py", line 56, in _build
raise VerificationError('%s: %s' % (e.__class__.__name__, e))
cffi.error.VerificationError: CompileError: command 'clang' failed with exit status 1
Thoughts?
I'm win10 64bit user and i run your code as below
from jitpy.wrapper import jittify
@jittify([int, float], float)
def func(count, no):
s = 0
for i in range(count):
s += no
return s
func(1000, 1.2)
Traceback (most recent call last):
File "c:\users\owner\appdata\local\programs\python\python36\lib\site-packages\IPython\core\interactiveshell.py", line 3319, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in
from jitpy.wrapper import jittify
File "c:\users\owner\appdata\local\programs\python\python36\lib\site-packages\jitpy\wrapper.py", line 68
exec source.compile() in namespace
^
SyntaxError: invalid syntax
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.