May was the first month I was paid to work on NumPyPy (thanks to all who donated!), here is what I worked on during this period :
- It is now possible to use subarrays.
- It is now possible to pickle ndarrays (including those using subarrays), dtypes and scalars, the pickling protocol is the same as numpy's.
For June, I plan to work on the nditer class, it seems that there's enough work for an entire month.
Cheers
Romain Guillebert
What's numpypy's recommended way for a C/cffi extension to get a pointer to the data?
ReplyDeleteThanks,
Andreas
Excellent work!
ReplyDeleteThanks! But pickling sliced arrays doesn't work yet (tested with nightly build pypy-c-jit-64739-f556942951f9-linux):
ReplyDeleteimport cPickle as pickle
import numpypy as numpy
a = numpy.arange(10.)[::2]
print a # [ 0. 2. 4. 6. 8.]
p = pickle.dumps(a)
print pickle.loads(p) # [ 0. 1. 2. 3. 4.] oops!
@Anonymous
ReplyDeleteThanks for reporting it, it's fixed
Great to hear about the progress, keep up the good work!
ReplyDeleteIt is working very well for me, thanks!
ReplyDeleteNow, is there any way to load the resulting pickle in cPython?
numpy.save and numpy.load do work between pypy and cPython, but my arrays are embedded in larger data structures.
The motivation is that I would like to run a numerical program and store some results, and then load the results and plot them with matplotlib (which does not work on pypy).
Here is the error in cPython:
>>> pickle.load(open('/tmp/x', 'r+b'))
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/pickle.py", line 1378, in load
return Unpickler(file).load()
File "/usr/lib/python2.7/pickle.py", line 858, in load
dispatch[key](self)
File "/usr/lib/python2.7/pickle.py", line 1090, in load_global
klass = self.find_class(module, name)
File "/usr/lib/python2.7/pickle.py", line 1124, in find_class
__import__(module)
ImportError: No module named _numpypy.multiarray
It is working great, thanks!
ReplyDeleteNow, is there any way to load the resulting pickle in cPython?
numpy.save and numpy.load do work between pypy and cPython, but my arrays are embedded in larger data structures.
The motivation is that I would like to run a numerical program and store some results, and then load the results and plot them with matplotlib (which does not work on pypy).
Here is the error in cPython:
>>> pickle.load(open('/tmp/x', 'r+b'))
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/pickle.py", line 1378, in load
return Unpickler(file).load()
File "/usr/lib/python2.7/pickle.py", line 858, in load
dispatch[key](self)
File "/usr/lib/python2.7/pickle.py", line 1090, in load_global
klass = self.find_class(module, name)
File "/usr/lib/python2.7/pickle.py", line 1124, in find_class
__import__(module)
ImportError: No module named _numpypy.multiarray