Skip to content

Commit

Permalink
Merge Pull Request #13794 from trilinos/Trilinos/master_merge_2025020…
Browse files Browse the repository at this point in the history
…7_175815

Automatically Merged using Trilinos Master Merge AutoTester
PR Title: b'Trilinos Master Merge PR Generator: Auto PR created to promote from master_merge_20250207_175815 branch to master'
PR Author: trilinos-autotester
  • Loading branch information
trilinos-autotester authored Feb 8, 2025
2 parents bd59c87 + 95b49d7 commit 62ff542
Show file tree
Hide file tree
Showing 111 changed files with 1,664 additions and 1,608 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Initialize CodeQL
uses: github/codeql-action/init@17a820bf2e43b47be2c72b39cc905417bc1ab6d0 # v3.28.6
uses: github/codeql-action/init@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
Expand Down Expand Up @@ -108,6 +108,6 @@ jobs:
ninja -j 16
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@17a820bf2e43b47be2c72b39cc905417bc1ab6d0 # v3.28.6
uses: github/codeql-action/analyze@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@17a820bf2e43b47be2c72b39cc905417bc1ab6d0 # v3.28.6
uses: github/codeql-action/upload-sarif@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8
with:
sarif_file: results.sarif
5 changes: 4 additions & 1 deletion cmake/ProjectCompilerPostConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ set(promoted_warnings
sequence-point
sign-compare
strict-aliasing
switch
type-limits
uninitialized
unused-function
Expand All @@ -95,4 +96,6 @@ elseif("${Trilinos_WARNINGS_MODE}" STREQUAL "ERROR")
disable_warnings_for_deprecated_packages()
endif()

disable_warnings("${explicitly_disabled_warnings}")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
disable_warnings("${explicitly_disabled_warnings}")
endif()
31 changes: 28 additions & 3 deletions packages/amesos2/example/SimpleSolve_File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ int main(int argc, char *argv[]) {

Teuchos::oblackholestream blackhole;

bool multi_solve = false;
bool printMatrix = false;
bool printSolution = false;
bool checkSolution = false;
Expand All @@ -83,6 +84,7 @@ int main(int argc, char *argv[]) {
cmdp.setOption("rhs_filename",&rhs_filename,"Filename for Matrix-Market right-hand-side.");
cmdp.setOption("solvername",&solvername,"Name of solver.");
cmdp.setOption("xml_filename",&xml_filename,"XML Filename for Solver parameters.");
cmdp.setOption("multi-solve","no-multi-solve",&multi_solve,"Test multiple numFacto & solve per symbolic.");
cmdp.setOption("print-matrix","no-print-matrix",&printMatrix,"Print the full matrix after reading it.");
cmdp.setOption("print-solution","no-print-solution",&printSolution,"Print solution vector after solve.");
cmdp.setOption("check-solution","no-check-solution",&checkSolution,"Check solution vector after solve.");
Expand All @@ -104,7 +106,7 @@ int main(int argc, char *argv[]) {
const size_t numVectors = 1;

// Read matrix
RCP<const MAT> A = Tpetra::MatrixMarket::Reader<MAT>::readSparseFile(mat_filename, comm);
RCP<MAT> A = Tpetra::MatrixMarket::Reader<MAT>::readSparseFile(mat_filename, comm);

// get the map (Range Map used for both X & B)
RCP<const Map<LO,GO> > rngmap = A->getRangeMap();
Expand Down Expand Up @@ -217,11 +219,34 @@ int main(int argc, char *argv[]) {
stackedTimer = rcp(new Teuchos::StackedTimer("Amesos2 SimpleSolve-File"));
Teuchos::TimeMonitor::setStackedTimer(stackedTimer);
}
solver->symbolicFactorization().numericFactorization().solve();
solver->symbolicFactorization(); comm->barrier();
solver->numericFactorization(); comm->barrier();
solver->solve(); comm->barrier();
if (multi_solve) {
{
// change (1,1) diagonal entry value
Teuchos::Array<GO> gblColIndsBuf (1);
Teuchos::Array<Scalar> valsBuf (1);
valsBuf[0] = 7.0;
gblColIndsBuf[0] = 0;

Teuchos::ArrayView<GO> gblColInds = gblColIndsBuf.view (0, 1);
Teuchos::ArrayView<Scalar> vals = valsBuf.view (0, 1);

A->resumeFill();
A->replaceGlobalValues (0, gblColInds, vals);
A->fillComplete();
}
// perform numeric for the second time
solver->numericFactorization();

// chage RHS, and re-do solve
B->putScalar(10);
solver->solve();
}
if(useStackedTimer) {
stackedTimer->stopBaseTimer();
}

if( printSolution ){
// Print the solution
RCP<Map<LO,GO> > root_map
Expand Down
2 changes: 1 addition & 1 deletion packages/amesos2/src/Amesos2_KLU2_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ KLU2<Matrix,Vector>::loadA_impl(EPhase current_phase)
Kokkos::resize(host_col_ptr_view_, this->globalNumRows_ + 1);
}

local_ordinal_type nnz_ret = 0;
local_ordinal_type nnz_ret = -1;
bool gather_supported = (this->matrixA_->getComm()->getSize() > 1 && (std::is_same<scalar_type, float>::value || std::is_same<scalar_type, double>::value));
{
#ifdef HAVE_AMESOS2_TIMERS
Expand Down
2 changes: 1 addition & 1 deletion packages/amesos2/src/Amesos2_ShyLUBasker_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ ShyLUBasker<Matrix,Vector>::loadA_impl(EPhase current_phase)
Kokkos::resize(colptr_view_, this->globalNumCols_ + 1); //this will be wrong for case of gapped col ids, e.g. 0,2,4,9; num_cols = 10 ([0,10)) but num GIDs = 4...
}

local_ordinal_type nnz_ret = 0;
local_ordinal_type nnz_ret = -1;
bool gather_supported = (this->matrixA_->getComm()->getSize() > 1 && (std::is_same<scalar_type, float>::value || std::is_same<scalar_type, double>::value));
{
#ifdef HAVE_AMESOS2_TIMERS
Expand Down
53 changes: 37 additions & 16 deletions packages/amesos2/src/Amesos2_TpetraCrsMatrix_MatrixAdapter_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,18 @@ namespace Amesos2 {
const EPhase current_phase) const
{
typedef Tpetra::Map< local_ordinal_t, global_ordinal_t, node_t> contiguous_map_type;
auto rowMap = this->mat_->getRowMap();
auto colMap = this->mat_->getColMap();
auto rowComm = rowMap->getComm();
auto colComm = colMap->getComm();

using Teuchos::RCP;
using Teuchos::rcp;
#ifdef HAVE_AMESOS2_TIMERS
auto reindexTimer = Teuchos::TimeMonitor::getNewTimer("Time to re-index matrix gids");
Teuchos::TimeMonitor ReindexTimer(*reindexTimer);
#endif

auto rowMap = this->mat_->getRowMap();
auto colMap = this->mat_->getColMap();
auto rowComm = rowMap->getComm();
auto colComm = colMap->getComm();

GlobalOrdinal indexBase = rowMap->getIndexBase();
GlobalOrdinal numDoFs = this->mat_->getGlobalNumRows();
LocalOrdinal nRows = this->mat_->getLocalNumRows();
Expand All @@ -120,12 +122,17 @@ namespace Amesos2 {
global_ordinal_t frow = tmpMap->getMinGlobalIndex();

// Create new GID list for RowMap
Kokkos::View<global_ordinal_t*, HostExecSpaceType> rowIndexList ("indexList", nRows);
Kokkos::View<global_ordinal_t*, HostExecSpaceType> rowIndexList ("rowIndexList", nRows);
for (local_ordinal_t k = 0; k < nRows; k++) {
rowIndexList(k) = frow+k; // based on index-base of rowMap
}
// Create new GID list for ColMap
Kokkos::View<global_ordinal_t*, HostExecSpaceType> colIndexList ("indexList", nCols);
Kokkos::View<global_ordinal_t*, HostExecSpaceType> colIndexList ("colIndexList", nCols);
// initialize to catch col GIDs that are not in row GIDs
// they will be all assigned to (n+1)th columns
for (local_ordinal_t k = 0; k < nCols; k++) {
colIndexList(k) = numDoFs+indexBase;
}
typedef Tpetra::MultiVector<global_ordinal_t,
local_ordinal_t,
global_ordinal_t,
Expand Down Expand Up @@ -307,9 +314,11 @@ namespace Amesos2 {
recvDispls(p+1) = recvDispls(p) + recvCounts(p);
}
}
// -- convert to global colids & convert to 0-base
// -- convert to global colids & ** convert to base-zero **
KV_GO lclColind_ ("localColind_", lclColind.extent(0));
for (int i = 0; i < int(lclColind.extent(0)); i++) lclColind_(i) = (colMap->getGlobalElement((lclColind(i))) - colIndexBase);
for (int i = 0; i < int(lclColind.extent(0)); i++) {
lclColind_(i) = (colMap->getGlobalElement((lclColind(i))) - colIndexBase);
}
if (column_major || need_to_perm) {
Kokkos::resize(indices_t, indices.extent(0));
Teuchos::gatherv<int, LocalOrdinal> (lclColind_.data(), lclColind_.extent(0), indices_t.data(),
Expand All @@ -326,6 +335,7 @@ namespace Amesos2 {
Teuchos::RCP< Teuchos::Time > gatherTime = Teuchos::TimeMonitor::getNewCounter ("Amesos2::gather(transpose index)");
Teuchos::TimeMonitor GatherTimer(*gatherTime);
#endif
// (note: column idexes are now in base-0)
if (column_major) {
// Map to transpose
Kokkos::resize(transpose_map, ret);
Expand All @@ -347,9 +357,14 @@ namespace Amesos2 {
int i = perm_l2g(row);
for (int k=pointers_t(i); k<pointers_t(i+1); k++) {
int col = indices_t(k);
transpose_map(k) = pointers(1+col);
indices(pointers(1+col)) = row;
pointers(1+col) ++;
if (col < nRows) {
transpose_map(k) = pointers(1+col);
indices(pointers(1+col)) = row;
pointers(1+col) ++;
} else {
// extra columns
transpose_map(k) = -1;
}
}
}
} else if (need_to_perm) {
Expand All @@ -366,9 +381,13 @@ namespace Amesos2 {
int row = perm_g2l(i);
for (int k=pointers_t(i); k<pointers_t(i+1); k++) {
int col = indices_t(k);
transpose_map(k) = pointers(1+row);
indices(pointers(1+row)) = col;
pointers(1+row) ++;
if (col < nRows) {
transpose_map(k) = pointers(1+row);
indices(pointers(1+row)) = col;
pointers(1+row) ++;
} else {
transpose_map(k) = -1;
}
}
}
} else {
Expand Down Expand Up @@ -409,7 +428,9 @@ namespace Amesos2 {
#endif
if (transpose_map.extent(0) > 0) {
for (int k=0; k<ret; k++) {
nzvals(transpose_map(k)) = nzvals_t(k);
if (transpose_map(k) >= 0) {
nzvals(transpose_map(k)) = nzvals_t(k);
}
}
}
}
Expand Down
12 changes: 10 additions & 2 deletions packages/amesos2/test/solvers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -390,14 +390,22 @@ IF (${PACKAGE_NAME}_ENABLE_ShyLU_NodeBasker)
STANDARD_PASS_OUTPUT
)

##Copy shylubasker_test.xml, but do not test
##depends on not included matrices
##Copy shylubasker_test.xml
TRIBITS_COPY_FILES_TO_BINARY_DIR(SolverTestCopyShyLUBaskerFiles
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
SOURCE_FILES shylubasker_test.xml
EXEDEPS Solver_Test
)

##Test only if ShyLU-Basker is enabled
TRIBITS_ADD_TEST(
Solver_Test
NAME ShyLUBasker_Solver_Test
ARGS "--xml-params=shylubasker_test.xml --filedir=${CMAKE_CURRENT_BINARY_DIR}/../matrices/ --multiple-solves --refactor"
STANDARD_PASS_OUTPUT
NUM_MPI_PROCS 2
COMM serial mpi
)
ENDIF()

##### MUMPS Tests ####
Expand Down
28 changes: 14 additions & 14 deletions packages/amesos2/test/solvers/shylubasker_test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<!-- Wathen120 is a bad performance matrix that is symm with nice supernodes -->
<ParameterList name="wathen120.mtx">
<ParameterList name="Basker">
<ParameterList name="ShyLUBasker">

<!-- Test Epetra objects first -->
<ParameterList name="epetra">
Expand Down Expand Up @@ -221,13 +221,13 @@
</ParameterList> <!-- end solver_run_params -->
</ParameterList> <!-- end run-int-long-p#-default -->
</ParameterList> <!-- end tpetra -->
</ParameterList> <!-- end Basker -->
</ParameterList> <!-- end ShyLUBasker -->
</ParameterList> <!-- end wathen120 -->


<!-- Asic_680ks is a key matrix with medium performance first btf blk small -->
<ParameterList name="asic_680ks.mtx">
<ParameterList name="Basker">
<ParameterList name="ShyLUBasker">

<!-- Test Epetra objects first -->
<ParameterList name="epetra">
Expand Down Expand Up @@ -442,12 +442,12 @@
</ParameterList> <!-- end solver_run_params -->
</ParameterList> <!-- end run-int-long-p#-default -->
</ParameterList> <!-- end tpetra -->
</ParameterList> <!-- end Basker -->
</ParameterList> <!-- end ShyLUBasker -->
</ParameterList> <!-- end asic680ks -->

<!-- G2 Very bad matrix sym large supernodes -->
<ParameterList name="G2_circuit.mtx">
<ParameterList name="Basker">
<ParameterList name="ShyLUBasker">

<!-- Test Epetra objects first -->
<ParameterList name="epetra">
Expand Down Expand Up @@ -662,12 +662,12 @@
</ParameterList> <!-- end solver_run_params -->
</ParameterList> <!-- end run-int-long-p#-default -->
</ParameterList> <!-- end tpetra -->
</ParameterList> <!-- end Basker -->
</ParameterList> <!-- end ShyLUBasker -->
</ParameterList> <!-- end G2_circuit -->

<!-- Private Large Power Simulation Matrix, good very btf matrix -->
<ParameterList name="power0.mtx">
<ParameterList name="Basker">
<ParameterList name="ShyLUBasker">

<!-- Test Epetra objects first -->
<ParameterList name="epetra">
Expand Down Expand Up @@ -882,12 +882,12 @@
</ParameterList> <!-- end solver_run_params -->
</ParameterList> <!-- end run-int-long-p#-default -->
</ParameterList> <!-- end tpetra -->
</ParameterList> <!-- end Basker -->
</ParameterList> <!-- end ShyLUBasker -->
</ParameterList> <!-- end power0 -->

<!-- hvdc2, interesting matrix with need for pivoting -->
<ParameterList name="hvdc2.mtx">
<ParameterList name="Basker">
<ParameterList name="ShyLUBasker">

<!-- Test Epetra objects first -->
<ParameterList name="epetra">
Expand Down Expand Up @@ -1102,12 +1102,12 @@
</ParameterList> <!-- end solver_run_params -->
</ParameterList> <!-- end run-int-long-p#-default -->
</ParameterList> <!-- end tpetra -->
</ParameterList> <!-- end Basker -->
</ParameterList> <!-- end ShyLUBasker -->
</ParameterList> <!-- end hvdc2 -->

<!-- amesos_test_mat1 has good tests (limit to 4 threads) -->
<ParameterList name="amesos2_test_mat1.mtx">
<ParameterList name="Basker">
<ParameterList name="ShyLUBasker">

<!-- Test Epetra objects first -->
<ParameterList name="epetra">
Expand Down Expand Up @@ -1272,12 +1272,12 @@
</ParameterList> <!-- end solver_run_params -->
</ParameterList> <!-- end run-int-long-p#-default -->
</ParameterList> <!-- end tpetra -->
</ParameterList> <!-- end Basker -->
</ParameterList> <!-- end ShyLUBasker -->
</ParameterList> <!-- end amesos2_test_mat1 -->

<!-- amesos2_test_mat4 has good tests (limit to 4 threads) -->
<ParameterList name="amesos2_test_mat4.mtx">
<ParameterList name="Basker">
<ParameterList name="ShyLUBasker">

<!-- Test Epetra objects first -->
<ParameterList name="epetra">
Expand Down Expand Up @@ -1442,7 +1442,7 @@
</ParameterList> <!-- end solver_run_params -->
</ParameterList> <!-- end run-int-long-p#-default -->
</ParameterList> <!-- end tpetra -->
</ParameterList> <!-- end Basker -->
</ParameterList> <!-- end ShyLUBasker -->
</ParameterList> <!-- end amesos2_test_mat4 -->
<!-- TO BE CONT... -->
</ParameterList> <!-- end test_parms -->
Loading

0 comments on commit 62ff542

Please sign in to comment.