2016-03-25 77 views
1

我正在嘗試做非常大的2個dask數組X(35000 x 7500)和Y(7500 x 10)的點積。由於點積也將是非常大的,我將它存儲在HDF5Python:dask數組的點積

f = h5py.File('output.hdf5') 
f['output'] = X.dot(Y) 

但第二個命令不給任何輸出,即使它幾乎1小時。哪裏不對?有更快的技術嗎?在創建X和Y時是否存在「塊」問題?

回答

1

考慮.to_hdf5方法或da.store函數。

>>> X.dot(Y).to_hdf5('output.hdf5', 'output') 

>>> output = f.create_dataset('/output', X.dot(Y).shape, X.dot(Y).dtype) 
>>> da.store(X.dot(Y), output) 

to_hdf5方法對您來說可能更容易。 da.store方法也適用於其他格式。

__setitem__功能H5Py(當你說f['output'] = ...你所使用的是硬編碼使用NumPy的陣列。

Here is the appropriate section in the documentation.

+0

先生,我看到你的答案[這裏](http://stackoverflow.com/questions/34434217/why-is-dot-product-in-dask-slow-in-numpy)。那麼我怎麼知道什麼類型的組塊最適合我? – Kavan

+0

to_hdf5方法會將你的數據集塊化爲類似於 – MRocklin

+0

我的X是float32和Y float96,它向我顯示「TypeError:Unsupported float size」。任何線索? – Kavan