2016-03-25 8 views
1

Ich versuche, Punktprodukt von sehr großen 2 dask Arrays X (35000 x 7500) und Y (7500 x 10) zu tun. Da das Skalarprodukt auch sehr groß sein wird, ich es bin Speicherung in hdf5Python: Punkt Produkt von DASK-Array

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

Aber der zweite Befehl eine Ausgabe, obwohl seine fast 1 Stunde nicht zu geben. Was ist falsch? Gibt es schnellere Technik? Gibt es ein Problem mit "Chunks" beim Erstellen von X und Y?

Antwort

1

Betrachten Sie die .to_hdf5 Methode oder da.store Funktion.

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

oder

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

Die to_hdf5 Methode ist für Sie wahrscheinlich einfacher. Die da.store-Methode gilt auch für andere Formate.

Die __setitem__ Funktion in H5Py (was Sie verwenden, wenn Sie f['output'] = ... sagen fest einprogrammiert ist NumPy Arrays zu verwenden.

Here is the appropriate section in the documentation.

+0

Sir ich habe Ihre Antwort [hier] (http://stackoverflow.com/questions/34434217/warum-ist-dot-produkt-in-dask-langsamer-als-in-numpy) Also woher weiß ich, welche Art von Chunking für mich am besten ist? – Kavan

+0

Die to_hdf5-Methode wird Ihren Datensatz ähnlich wie Wie dein dask.array ist chunked. Ich empfehle nur, dass das. – MRocklin

+0

Mein X ist float32 und Y float96. Es zeigt mir "TypeError: Nicht unterstützte Float-Größe." Irgendwelche Hinweise? – Kavan

Verwandte Themen