Hi,
I have a tricky problem with Numeric. Some time ago, I have generated
a huge and complex data structure, and stored it using the cPickle
module. Now I want to evaluate it quickly again on a workstation
cluster with 64-Bit Opteron CPUs - I have no more than three days to
do this. Compiling Python and running Numeric has been no problem at
all. However, I get an error message when accessing the data pickled
before. (I can load it regularly on 32 bit computers, but it is a
quite complex data object, so I really don't want to store every
element as ASCII data). The problem seems to be with 64 Bit integers
(with 32-bit-floats, no problem was observed).
This looks like that (from the Unix command shell):
jnix@32bithost: ~> python ~/python/test_npickle.py -dump test.pck
jnix@32bithost: ~> python ~/python/test_npickle.py test.pck
[0 1 2 3 4 5 6 7 8 9]
jnix@32bithost: ~> ssh 64bithost python ~/python/test_npickle.py test.pck
Traceback (most recent call last):
File "/home/jnix/python/test_npickle.py ", line 16, in ?
a = cPickle.load(fi le(filename))
File "/home/jnix/lib/python2.4/SuSE-9.0/x86_64/Numeric/Numeric.py", line 520, in array_construct or
x.shape = shape
ValueError: ('total size of new array must be unchanged', <function array_construct or at 0x2a960b0b18>, ((10,), 'l', '\x00\x00\x00\x 00\x01\x00\x00\ x00\x02\x00\x00 \x00\x03\x00\x0 0\x00\x04\x00\x 00\x00\x05\x00\ x00\x00\x06\x00 \x00\x00\x07\x0 0\x00\x00\x08\x 00\x00\x00\t\x0 0\x00\x00', 1))
also I get:
jnix@32bithost: ~> python -c "import Numeric; print Numeric.arange( 0).itemsize()"
4
jnix@64bithost: ~> python -c "import Numeric; print Numeric.arange( 0).itemsize()"
8
The script used to produce the example above is:
-------------------------------------------------------------------------
#/usr/bin/python
# -*- coding: latin1 -*-
import Numeric
import cPickle
import sys
if len(sys.argv) > 1 and sys.argv[1] == '-dump':
filename = sys.argv[2]
binary=1
a = Numeric.arange( 10)
cPickle.dump(a, file(filename,' w',binary))
else:
filename = sys.argv[1]
a = cPickle.load(fi le(filename))
print a
---------------------------------------------------------------------
So what would you suggest ? Can I hack Numeric to assume non-native
32 bit integer numbers ?
Many thanks for any help,
Johannes 2 1830
"Johannes Nix|Johannes.Ni x"@uni-oldenburg.de wrote: Hi,
I have a tricky problem with Numeric. Some time ago, I have generated a huge and complex data structure, and stored it using the cPickle module. Now I want to evaluate it quickly again on a workstation cluster with 64-Bit Opteron CPUs - I have no more than three days to do this. Compiling Python and running Numeric has been no problem at all. However, I get an error message when accessing the data pickled before. (I can load it regularly on 32 bit computers, but it is a quite complex data object, so I really don't want to store every element as ASCII data). The problem seems to be with 64 Bit integers (with 32-bit-floats, no problem was observed).
This looks like that (from the Unix command shell):
jnix@32bithost: ~> python ~/python/test_npickle.py -dump test.pck jnix@32bithost: ~> python ~/python/test_npickle.py test.pck [0 1 2 3 4 5 6 7 8 9] jnix@32bithost: ~> ssh 64bithost python ~/python/test_npickle.py test.pck Traceback (most recent call last): File "/home/jnix/python/test_npickle.py ", line 16, in ? a = cPickle.load(fi le(filename)) File "/home/jnix/lib/python2.4/SuSE-9.0/x86_64/Numeric/Numeric.py", line 520, in array_construct or x.shape = shape ValueError: ('total size of new array must be unchanged', <function array_construct or at 0x2a960b0b18>, ((10,), 'l', '\x00\x00\x00\x 00\x01\x00\x00\ x00\x02\x00\x00 \x00\x03\x00\x0 0\x00\x04\x00\x 00\x00\x05\x00\ x00\x00\x06\x00 \x00\x00\x07\x0 0\x00\x00\x08\x 00\x00\x00\t\x0 0\x00\x00', 1))
also I get: jnix@32bithost: ~> python -c "import Numeric; print Numeric.arange( 0).itemsize()" 4 jnix@64bithost: ~> python -c "import Numeric; print Numeric.arange( 0).itemsize()" 8
The script used to produce the example above is:
------------------------------------------------------------------------- #/usr/bin/python # -*- coding: latin1 -*-
import Numeric import cPickle import sys
if len(sys.argv) > 1 and sys.argv[1] == '-dump': filename = sys.argv[2] binary=1 a = Numeric.arange( 10) cPickle.dump(a, file(filename,' w',binary))
else: filename = sys.argv[1] a = cPickle.load(fi le(filename)) print a
---------------------------------------------------------------------
So what would you suggest ? Can I hack Numeric to assume non-native 32 bit integer numbers ?
Many thanks for any help,
Johannes
It might be worth posting to the Numeric mailing list, mirrored at http://news.gmane.org/gmane.comp.python.numeric.general
Johannes Nix |J***********@u ni-oldenburg.de> writes: So what would you suggest ? Can I hack Numeric to assume non-native 32 bit integer numbers ?
I think it would be better to fix the pickle/cPickle module to
correctly unpack the 32-bit ints on your 64 bit machine. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Travis Oliphant |
last post by:
Numarray is making great progress and is quite usable for many
purposes. An idea that was championed by some is that the Numeric code
base would stay static and be replaced entirely by Numarray.
However, Numeric is currently used in a large installed base. In
particular SciPy uses Numeric as its core array. While no doubt
numarray arrays will be supported in the future, the speed of the less
bulky Numeric arrays and the typical case...
|
by: Leslie |
last post by:
I have 2 dlls and they reference each other, thus causing the circular
dependence error. I have read about other cases and people say use
Interfaces to solve the problem with the shared methods. My case is getting
the error, not because methods need shared, but because forms need shared.
Example:
A.DLL has form TestA1, TestA2
B.DLL has form TestB
TestA1 navigates to display TestB, thus A.DLL needs to reference B.DLL so
the form will...
|
by: Federico G. Babelis |
last post by:
Hi All:
I have this line of code, but the syntax check in VB.NET 2003 and also in
VB.NET 2005 Beta 2 shows as unknown:
Dim local4 As Byte
Fixed(local4 = AddressOf dest(offset))
CType(local4, Short) = CType(src, Short)
|
by: Ted Theodoropoulos |
last post by:
i posted an earlier thread about exporting data from a subform in an
..ADP to an .MDB file. i had only one gracious response but it
wouldn't work in the given situation. so i thought i would share the
code with you that i wrote to solve the problem. certainly nothing
sophisticated but it would have been very helpful to me had i gotten
ahold of it when i started out to tackle the problem. i welcome any
feedback.
the solution uses a...
|
by: Pipo |
last post by:
Nobody knows how to get the values provided in the client can be read in the
user-control?
If have made a Web Custom Control with 2 textboxes and 1 dropdownlist.
The user fills in my control (the textboxes and the dropdownlist) and lots
more stuff on the page.
When the user wants to save the page he'll click the save button.
The server gets the postback but I can read out the filled in controls (in
my control).
The textboxes text = ""...
| |
by: Siphiuel |
last post by:
Hi everyone.
When using visitor pattern, we have a nasty dependence on the types of
visitable objects that is coded way on top on the visitor hierarchy. i
mean, like this:
class AbstractVisitor
{
public:
virtual void visit(Object_type_1 *);
virtual void visit(Object_type_2 *)
|
by: robert |
last post by:
just a note - some speed comparisons :
0.60627370238398726
0.42836673376223189
0.36965815487747022
0.016557970357098384
0.15692469294117473
0.01951756438393204
|
by: Jon Slaughter |
last post by:
I have created a few classes which depend on other classes but I'm unsure
how to go about including the classes so they are visible to each other.
Can I just require_once at some point before use and make sure the order is
correct? or can I insert the require_once in the class itself(which then I'm
worried about forcing the location)? How does one normally go about this?
Thanks,
Jon
|
by: Daniel Jeffrey |
last post by:
I have created a Resource file that stores common icons used in my projects.
I have a solution that contains 2 projects, and I keep getting errors if I
add the resource file to both projects.
It complains about duplicates etc etc.
I have tried adding it to the Solution, but then it doesn't appear in the
Designer under resources in the Project.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |