Dear Numpy devels,

First of all, thank you for the great job done so far! We've been
updating our MDP module, and had a chance to appreciate it.

We found an issue in the random module: the random state contains an
array of int32 or int64 depending on the architecture, making
it not portable.

For example, try the following on two machines with different
architecures:

Python 2.4.4 (#2, Jan 13 2007, 17:50:26)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> import platform
>>> import pickle
>>>
>>> platform.architecture()
('32bit', '')
>>>
>>> state = numpy.random.get_state()
>>> pickle.dump(state, file('/tmp/random_state.pic','w'))
>>> numpy.random.permutation(numpy.arange(10))
array([8, 6, 3, 1, 0, 5, 7, 4, 2, 9])
>>>

Python 2.5 (r25:51908, Mar 19 2007, 13:41:07)
[GCC 4.1.0 (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> import platform
>>> import pickle
>>>
>>> platform.architecture()
('64bit', 'ELF')
>>>
>>> state = pickle.load(file('/tmp/random_state.pic','r'))
>>> numpy.random.set_state(state)
>>> numpy.random.permutation(numpy.arange(10))
array([3, 9, 4, 8, 1, 6, 2, 0, 5, 7])
>>>

Is there any known workaround?
Thanks!


--

 Tiziano Zito
 Institute for Theoretical Biology
 Humboldt-Universitaet zu Berlin
 Invalidenstrasse, 43
 10115 Berlin, Germany

 Pietro Berkes
 Gatsby Computational Neuroscience Unit
 Alexandra House, 17 Queen Square
 London WC1N 3AR, United Kingdom

_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to