Hi list,
Whenever I try to use threading or multiprocessing on OS X (10.6.4), I get
segmentation faults. I don't get these with Ubuntu 10.04. It happens when I
invoke a readWhere method, but not when I read an entire column like a =
data.root.mytable[:]['polar_angle']. Strange...
Setup OS X:
ports installed:
hdf5-18 @1.8.5_0 (active)
py26-tables @2.2_0 (active)
py26-numpy @1.4.1_1+gcc44 (active)
py26-numexpr @1.4_0 (active)
py26-cython @0.12.1_0 (active)
Setup Ubuntu 10.04:
apt-get installed:
python-numpy (1.3.0-3build1)
libhdf5-serial-1.8.4 (1.8.4-5)
python-tables (2.1.2-3build1)
I realize this is a bit of a mess (differing versions, two platforms) but I
believe my script is self-contained, shares nothing between threads and should
just work. Here it is:
from threading import Thread
from multiprocessing import Process
import tables
import random
from math import pi
class MyTable(tables.IsDescription):
polar_angle = tables.Float32Col()
def fill_table():
data = tables.openFile('mytest.h5', 'w')
data.createTable('/', 'mytable', MyTable)
rows = [(random.uniform(-pi, pi),) for x in range(100000)]
data.root.mytable.append(rows)
data.close()
def f():
data = tables.openFile('mytest.h5', 'r')
print data
print 'yes'
a = data.root.mytable.readWhere('polar_angle < .5 * pi')
print 'ok'
data.close()
if __name__ == '__main__':
fill_table()
for i in range(3):
f()
ts = []
for i in range(5):
t = Thread(target=f)
t.start()
ts.append(t)
for t in ts:
t.join()
ps = []
for i in range(5):
p = Process(target=f)
p.start()
ps.append(p)
for p in ps:
p.join()
If anyone can solve this riddle, I'll be thankful for it. (I really want to run
a simulation on all my cores...).
Thanks,
David
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users