emperor: (Default)
Add MemoryShare This Entry
posted by [personal profile] emperor at 12:33pm on 20/09/2007 under , ,
I have some code that spends a few hours talking to my cattle movement database, and building two dictionaries of movements. I thought it would be good to be able to store the resulting data structures using cPickle, so that in future I could analyse the results on my faster computer, and other suchlike things.

Except I get errors when attempting this:

Looking up movements: . . . . . . . . . . . . . . . . . . . . . done.
Writing data structure to pickle file...Traceback (most recent call last):
  File "./code/python/breeds.py", line 122, in ?
    cPickle.dump(cows,intf,cPickle.HIGHEST_PROTOCOL)
MemoryError



A bit lame (it seems a not unreasonable assumption that if you can hold some data in memory, you can pickle-dump it to file), but there you go. I figure I'll try building a 64-bit python, to give me more address space (it was getting no-where near the available RAM on this system). But, python's configure doesn't have a handy 64-bit switch, nor does it seem to do anything sensible with CFLAGS Indeed, even doing CC="gcc -mcpu=b9 -m64" ./configure didn't quite do what I wanted, and I had to frob LD_LIBRARY_PATH to get any modules built. Indeed, the resulting command-line to run the code with the 64-bit python (and a compiled cx_Oracle module also built 64-bit stylee) ended up being:
LD_LIBRARY_PATH=/opt/local/lib/sparcv9:/export/home/oracle/product/10.1.0/db_2/lib PYTHONPATH=/export/home/matthew/software/cx_Oracle-4.1/build/lib.solaris-2.9-sun4u-2.5:$PYTHONPATH ~/software/Python-2.5.1/python postdoc/code/python/breeds.py

I'm sure it should be easier than that (indeed, 64-bit compilation on solaris often seems to be a bit of pain). I'll find out later whether that's actually worked or not!
There are 3 comments on this entry. (Reply.)
ext_27570: Richard in tricorn hat (Default)
posted by [identity profile] sigisgrim.livejournal.com at 01:35pm on 20/09/2007
I know we talked about this and data structures 18 months ago, but I can't remember the details and I don't think it was a detailed conversation anyway. What is the data structure that is being used for storing the movements and how many records? Could the two dictionaries of movements be held in a database table rather than a flat file and how big are they? Even if you did ultimately need the dictionaries in a flat file it might be easier to export the data from the table to a flat file than what you're doing now.
 
posted by [identity profile] beckyc.livejournal.com at 10:31pm on 22/09/2007
Happy birthday!
emperor: (Default)
posted by [personal profile] emperor at 09:39pm on 23/09/2007
Thank you!

July

SunMonTueWedThuFriSat
    1
 
2
 
3 4
 
5
 
6
 
7
 
8
 
9 10
 
11
 
12
 
13
 
14
 
15
 
16
 
17
 
18
 
19
 
20
 
21
 
22
 
23
 
24
 
25
 
26
 
27
 
28
 
29
 
30
 
31