HISKP-LQCD / sLapH-contractions

Stochastic LapH contraction program
GNU General Public License v3.0
3 stars 3 forks source link

eigenvector I/O is too slow #56

Open kostrzewa opened 6 years ago

kostrzewa commented 6 years ago

eigenvectors are read one eigenvector at a time and vector elements are copied one element at at time into (V[t])(nrow,ncol).

  1. Eigensystem should be read into buffer in one go (per time slice)
  2. Copying should be done one full eigenvector at a time

Does Eigen store row or column major layout by default? Is the data pointer accessible? One could perhaps perform a fast transposition if the reading buffer is taken as the storage buffer for an Eigen matrix.

kostrzewa commented 6 years ago

The eigenvectors on disk are stored in a column-major order (with the N_ev columns corresponding to 3xL^3 complex vectors). Eigen uses column-major order by default too, so it should be possible to rather straightforwardly write into the V[t] matrices one full eigenvector at a time.

kostrzewa commented 6 years ago

The other option would be to directly use Eigen::Map on top of the readin buffer and perform a simple assigment to copy the data into V[t], it would likely be quite efficient.

Something like

Eigen::Map<MatrixXcd> buff_matrix(buffer, row_length, N_ev);
(V[t]).col(ncol) = buff_matrix.col(ncol);