Coder Social home page Coder Social logo

jitpy's People

Contributors

antocuni avatar arigo avatar fcofdez avatar fijal avatar tomylobo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jitpy's Issues

jitpy on win7 32 bits raising a link error

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.

improving jitpy

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

Jitpy on OSX raises link error

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?

invalid syntax: exec source.compile() in namespace

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)

but it has an error as follows. why is that? cuz am i using 64bit windows?

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

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.