Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions resolve/LinSolverDirectCuSolverGLU.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include "LinSolverDirectCuSolverGLU.hpp"

#include <algorithm>
#include <cstring> // includes memcpy
#include <vector>

#include <resolve/Profiling.hpp>
#include <resolve/matrix/Csr.hpp>
Expand Down Expand Up @@ -236,10 +234,6 @@ namespace ReSolve
M_col[count++] = U_col[j];
}
}
for (index_type i = 0; i < n; ++i) // this is crucial, turns out somehow the indices are not sorted
{
std::sort(M_col + M_row[i], M_col + M_row[i + 1]);
}
}

void LinSolverDirectCuSolverGLU::combineFactors(matrix::Sparse* L, matrix::Sparse* U)
Expand Down
12 changes: 0 additions & 12 deletions resolve/LinSolverDirectCuSolverRf.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#include "LinSolverDirectCuSolverRf.hpp"

#include <algorithm>
#include <cassert>
#include <cstring> // includes memcpy
#include <vector>

#include <resolve/matrix/Csc.hpp>
#include <resolve/matrix/Csr.hpp>
Expand Down Expand Up @@ -108,16 +106,6 @@ namespace ReSolve

status_cusolverrf_ = cusolverRfSetResetValuesFastMode(handle_cusolverrf_, CUSOLVERRF_RESET_VALUES_FAST_MODE_ON);
error_sum += status_cusolverrf_;
// sort L and U columns
for (index_type i = 0; i < n; ++i)
{
std::sort(L->getColData(memory::HOST) + L->getRowData(memory::HOST)[i],
L->getColData(memory::HOST) + L->getRowData(memory::HOST)[i + 1]);
std::sort(U->getColData(memory::HOST) + U->getRowData(memory::HOST)[i],
U->getColData(memory::HOST) + U->getRowData(memory::HOST)[i + 1]);
}
L->setUpdated(memory::HOST);
U->setUpdated(memory::HOST);
L->syncData(memory::DEVICE);
U->syncData(memory::DEVICE);
status_cusolverrf_ = cusolverRfSetupDevice(n,
Expand Down
11 changes: 11 additions & 0 deletions resolve/LinSolverDirectKLU.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include "LinSolverDirectKLU.hpp"

#include <algorithm>
#include <cassert>
#include <cstring>
#include <vector>

#include <resolve/matrix/Csc.hpp>
#include <resolve/matrix/Csr.hpp>
Expand Down Expand Up @@ -295,6 +297,15 @@ namespace ReSolve
nullptr,
nullptr,
&Common_);
// Sort the column indices in L and U to ensure they are in ordered CSR format
// WARNING: Values are not sorted. We currently don't use values from KLU across solvers. If we ever decide to, we will need to change this.
for (index_type i = 0; i < A_->getNumRows(); ++i)
{
std::sort(L_->getColData(memory::HOST) + L_->getRowData(memory::HOST)[i], // Sort L's column indices from the start of Row i to the start of Row i+1 (non inclusive).
L_->getColData(memory::HOST) + L_->getRowData(memory::HOST)[i + 1]);
std::sort(U_->getColData(memory::HOST) + U_->getRowData(memory::HOST)[i],
U_->getColData(memory::HOST) + U_->getRowData(memory::HOST)[i + 1]);
}

L_->setUpdated(memory::HOST);
U_->setUpdated(memory::HOST);
Expand Down
4 changes: 0 additions & 4 deletions resolve/LinSolverDirectRocSolverRf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -842,10 +842,6 @@ namespace ReSolve
M_col[count++] = U_col[j];
}
}
for (index_type i = 0; i < n; ++i) // this is crucial, turns out somehow the indices are not sorted
{
std::sort(M_col + M_row[i], M_col + M_row[i + 1]);
}
}

/**
Expand Down
Loading