如何繞過h5py中的磁盤I/O?目前,我必須做這樣的事情:將hdf5文件作爲二進制blob /字符串傳遞給h5py?
msg = socket.recv()
fp = open("tmp.hdf5", 'wb')
fp.write(msg)
fp.close()
f = h5py.File('tmp.hdf5', 'r')
... # alter the file
fp = open("tmp.hdf5", 'rb')
msg = fp.read()
msg = f.toString()
socket.send(data)
我想要做這樣的事情:
msg = socket.recv()
f = h5py.File(msg, driver='core')
... # alter the file
msg = f.toString()
socket.send(msg)
我在這裏的問題是速度 - 磁盤I/O過於龐大的一個瓶頸。有沒有簡單的方法來創建h5py File對象字符串,然後將該文件作爲字符串提取?我願意像Cython一樣,如果它涉及到...
您是否找到解決方案?我現在面臨同樣的問題...... :) – AME 2012-08-16 11:38:17
可能太晚了,但看到接受的答案。 tmpfs將數據放入RAM而不是放在磁盤上。 – KarlC 2013-10-31 14:59:57