Skip to content

Commit

Permalink
fix tridiag solver output
Browse files Browse the repository at this point in the history
  • Loading branch information
RMeli committed Dec 1, 2023
1 parent c7fecdc commit 0bed383
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions include/dlaf/eigensolver/tridiag_solver/impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,17 @@ void TridiagSolver<B, D, T>::call(comm::CommunicatorGrid grid, Matrix<T, Device:
if (evecs.size().isEmpty())
return;

#ifdef DLAF_WITH_HDF5
static size_t num_tridiag_solver_calls = 0;
std::string fname = "tridiag_solver-" + std::to_string(num_tridiag_solver_calls) + ".h5";
std::optional<matrix::internal::FileHDF5> file;

if (getTuneParameters().debug_dump_tridiag_solver_data) {
file = matrix::internal::FileHDF5(grid.fullCommunicator(), fname);
file->write(tridiag, "/input");
}
#endif

// If the matrix is composed by a single tile simply call stedc.
if (evecs.nrTiles().linear_size() == 1) {
if constexpr (D == Device::CPU) {
Expand Down Expand Up @@ -433,6 +444,15 @@ void TridiagSolver<B, D, T>::call(comm::CommunicatorGrid grid, Matrix<T, Device:
dlaf::permutations::permute<Backend::MC, Device::CPU, T, Coord::Col>(grid, row_task_chain, 0, n,
ws_hm.i2, ws_hm.e0, ws_hm.e2);
copy(ws_hm.e2, evecs);

#ifdef DLAF_WITH_HDF5
if (getTuneParameters().debug_dump_tridiag_solver_data) {
file->write(evecs, "/evecs");
file->write(evals, "/evals");
}

num_tridiag_solver_calls++;
#endif
}

// \overload TridiagSolver<B, D, T>::call()
Expand All @@ -443,17 +463,6 @@ void TridiagSolver<B, D, T>::call(comm::CommunicatorGrid grid, Matrix<T, Device:
template <Backend B, Device D, class T>
void TridiagSolver<B, D, T>::call(comm::CommunicatorGrid grid, Matrix<T, Device::CPU>& tridiag,
Matrix<T, D>& evals, Matrix<std::complex<T>, D>& evecs) {
#ifdef DLAF_WITH_HDF5
static size_t num_tridiag_solver_calls = 0;
std::string fname = "tridiag_solver-" + std::to_string(num_tridiag_solver_calls) + ".h5";
std::optional<matrix::internal::FileHDF5> file;

if (getTuneParameters().debug_dump_tridiag_solver_data) {
file = matrix::internal::FileHDF5(grid.fullCommunicator(), fname);
file->write(tridiag, "/input");
}
#endif

Matrix<T, D> real_evecs(evecs.distribution());
TridiagSolver<B, D, T>::call(grid, tridiag, evals, real_evecs);

Expand All @@ -462,15 +471,6 @@ void TridiagSolver<B, D, T>::call(comm::CommunicatorGrid grid, Matrix<T, Device:
for (auto tile_wrt_local : iterate_range2d(dist.localNrTiles())) {
castToComplexAsync<D>(real_evecs.read(tile_wrt_local), evecs.readwrite(tile_wrt_local));
}

#ifdef DLAF_WITH_HDF5
if (getTuneParameters().debug_dump_tridiag_solver_data) {
file->write(evecs, "/evecs");
file->write(evals, "/evals");
}

num_tridiag_solver_calls++;
#endif
}

}

0 comments on commit 0bed383

Please sign in to comment.