我想增加我的HDF5文件的缓存大小,但它似乎并没有工作。 这是我有:如何在使用h5py高级界面时设置缓存设置?
import h5py
with h5py.File("test.h5", 'w') as fid:
# cache settings of file
cacheSettings = list(fid.id.get_access_plist().get_cache())
print cacheSettings
# increase cache
cacheSettings[2] = int(5 * cacheSettings[2])
print cacheSettings
# read cache settings from file
fid.id.get_access_plist().set_cache(*cacheSettings)
print fid.id.get_access_plist().get_cache()
这里是输出:
[0, 521, 1048576, 0.75]
[0, 521, 5242880, 0.75]
(0, 521, 1048576, 0.75)
任何想法,为什么阅读的作品,但设置不?
关闭并重新打开文件似乎也没有帮助。
因此,在该行之后: 'f = h5py.File(fid)'我可以使用高级API来创建数据集吗?: 'dset = f.create_dataset(“zipped_max”,(100,100) ,compression =“gzip”,compression_opts = 9)' – zd5151
是的;这就是物体的美。一旦你有了这个对象,它就拥有了这个类的所有方法,不管对象是如何创建的。 – unutbu
太棒了!我一直在使用高级API,但我意识到我需要退后一步,通过低级API增加缓存大小。谢谢您的回复。 – zd5151