Skip to content

Commit

Permalink
Merge Pull Request #13670 from trilinos/Trilinos/master_merge_2024121…
Browse files Browse the repository at this point in the history
…3_175815

Automatically Merged using Trilinos Master Merge AutoTester
PR Title: b'Trilinos Master Merge PR Generator: Auto PR created to promote from master_merge_20241213_175815 branch to master'
PR Author: trilinos-autotester
  • Loading branch information
trilinos-autotester authored Dec 14, 2024
2 parents 3e7486f + 436ce06 commit 7f913e3
Show file tree
Hide file tree
Showing 303 changed files with 10,643 additions and 9,014 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/AT2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ jobs:
--workspace-dir /home/runner/_work/Trilinos \
--source-dir ${GITHUB_WORKSPACE} \
--build-dir /home/Trilinos/build \
--dashboard-build-name=PR-${{ github.event.pull_request.number }}_${AT2_IMAGE}_release_static_uvm \
--dashboard-build-name=PR-${{ github.event.pull_request.number }}_${AT2_IMAGE}_release_static \
--ctest-driver /home/runner/_work/Trilinos/Trilinos/cmake/SimpleTesting/cmake/ctest-driver.cmake \
--ctest-drop-site sems-cdash-son.sandia.gov/cdash \
--filename-subprojects ./package_subproject_list.cmake \
Expand Down Expand Up @@ -385,7 +385,7 @@ jobs:
--ctest-driver /home/runner/_work/Trilinos/Trilinos/cmake/SimpleTesting/cmake/ctest-driver.cmake \
--ctest-drop-site sems-cdash-son.sandia.gov/cdash \
--filename-subprojects ./package_subproject_list.cmake \
--filename-packageenables ./packageEnables.cmake \
--skip-create-packageenables \
- name: Summary
if: ${{ !cancelled() }}
shell: bash -l {0}
Expand Down
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@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
uses: github/codeql-action/init@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6
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@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
uses: github/codeql-action/analyze@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6
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@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
uses: github/codeql-action/upload-sarif@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6
with:
sarif_file: results.sarif
6 changes: 6 additions & 0 deletions packages/amesos2/cmake/Amesos2_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,9 @@

/* Define to 1 if SuperLU's *gssvx and *gsisx routines need a GlobalLU_t argument. */
#cmakedefine HAVE_AMESOS2_SUPERLU5_API

#cmakedefine HAVE_AMESOS2_XPETRA
#cmakedefine HAVE_AMESOS2_ZOLTAN2CORE
#ifdef HAVE_AMESOS2_ZOLTAN2CORE
# define HAVE_AMESOS2_ZOLTAN2
#endif
2 changes: 1 addition & 1 deletion packages/amesos2/cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
SET(LIB_REQUIRED_DEP_PACKAGES Teuchos Tpetra TrilinosSS Kokkos)
SET(LIB_OPTIONAL_DEP_PACKAGES Epetra EpetraExt ShyLU_NodeBasker ShyLU_NodeTacho)
SET(TEST_REQUIRED_DEP_PACKAGES)
SET(TEST_OPTIONAL_DEP_PACKAGES ShyLU_NodeBasker ShyLU_NodeTacho Kokkos TrilinosSS)
SET(TEST_OPTIONAL_DEP_PACKAGES ShyLU_NodeBasker ShyLU_NodeTacho Kokkos TrilinosSS Xpetra Zoltan2Core)
# SET(LIB_REQUIRED_DEP_TPLS SuperLU)
SET(LIB_REQUIRED_DEP_TPLS )
SET(LIB_OPTIONAL_DEP_TPLS MPI SuperLU SuperLUMT SuperLUDist LAPACK UMFPACK PARDISO_MKL CSS_MKL ParMETIS METIS Cholmod MUMPS STRUMPACK CUSPARSE CUSOLVER)
Expand Down
20 changes: 14 additions & 6 deletions packages/amesos2/example/GappedMtxGIDs-1proc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,10 @@ int main(int argc, char *argv[]) {
"does not result in the same Map.");
}

if ( myRank == 0 && verbose ) {
*fos << "\nrowMap->describe output:" << endl;
if ( verbose ) {
if ( myRank == 0 ) {
*fos << "\nrowMap->describe output:" << endl;
}
rowMap->describe(*fos, Teuchos::VERB_EXTREME);
}

Expand All @@ -186,16 +188,20 @@ int main(int argc, char *argv[]) {
A = readCrsMatrixFromFile (mtx_name, fos, rowMap, domainMap, rangeMap, convert_mtx_to_zero_base, num_header_lines);
}

if ( myRank == 0 && verbose ) {
*fos << "A->describe" << endl;
if ( verbose ) {
if ( myRank == 0 ) {
*fos << "A->describe" << endl;
}
A->describe(*fos, Teuchos::VERB_EXTREME);
}


RCP<MV> RHS;
RHS = Tpetra::MatrixMarket::Reader<MAT>::readDenseFile (rhs_name, comm, rangeMap);
if ( myRank == 0 && verbose ) {
*fos << "RHS->describe" << endl;
if ( verbose ) {
if ( myRank == 0 ) {
*fos << "RHS->describe" << endl;
}
RHS->describe(*fos, Teuchos::VERB_EXTREME);
}

Expand Down Expand Up @@ -410,6 +416,8 @@ readCrsMatrixFromFile (const std::string& matrixFilename,
for (typename Teuchos::Array<GO>::size_type i=0; i<gblRowInds.size(); i++) {
A->insertGlobalValues (gblRowInds[i], gblColInds(i,1), vals(i,1));
}
} else {
A = Teuchos::rcp(new MAT(rowMap, 0));
}

A->fillComplete (domainMap, rangeMap);
Expand Down
152 changes: 127 additions & 25 deletions packages/amesos2/example/SimpleSolve_File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
#include <Teuchos_oblackholestream.hpp>
#include <Teuchos_VerboseObject.hpp>
#include <Teuchos_CommandLineProcessor.hpp>
#include <Teuchos_StackedTimer.hpp>
#include <Teuchos_ParameterList.hpp>
#include <Teuchos_ParameterXMLFileReader.hpp>

#include <Tpetra_Core.hpp>
#include <Tpetra_Map.hpp>
Expand All @@ -22,8 +25,16 @@
#include <MatrixMarket_Tpetra.hpp>
#include <Tpetra_Import.hpp>

#include "Amesos2.hpp"
#include "Amesos2_Version.hpp"
#include <Amesos2.hpp>
#include <Amesos2_Version.hpp>

#if defined(HAVE_AMESOS2_XPETRA) && defined(HAVE_AMESOS2_ZOLTAN2)
# include <Zoltan2_OrderingProblem.hpp>
# include <Zoltan2_PartitioningProblem.hpp>
# include <Zoltan2_TpetraRowGraphAdapter.hpp>
# include <Zoltan2_TpetraCrsMatrixAdapter.hpp>
# include <Zoltan2_XpetraMultiVectorAdapter.hpp>
#endif


int main(int argc, char *argv[]) {
Expand All @@ -32,7 +43,9 @@ int main(int argc, char *argv[]) {
typedef Tpetra::CrsMatrix<>::scalar_type Scalar;
typedef Tpetra::Map<>::local_ordinal_type LO;
typedef Tpetra::Map<>::global_ordinal_type GO;
typedef Tpetra::Map<>::node_type NO;

typedef Tpetra::RowGraph<LO, GO, NO> Graph;
typedef Tpetra::CrsMatrix<Scalar,LO,GO> MAT;
typedef Tpetra::MultiVector<Scalar,LO,GO> MV;

Expand All @@ -51,24 +64,32 @@ int main(int argc, char *argv[]) {

Teuchos::oblackholestream blackhole;

bool printMatrix = false;
bool printSolution = false;
bool checkSolution = false;
bool printTiming = false;
bool allprint = false;
bool printMatrix = false;
bool printSolution = false;
bool checkSolution = false;
bool printTiming = false;
bool useStackedTimer = false;
bool allprint = false;
bool verbose = (myRank==0);
bool useZoltan2 = false;
bool useParMETIS = false;
std::string mat_filename("arc130.mtx");
std::string rhs_filename("");
std::string solvername("Superlu");
std::string xml_filename("");
Teuchos::CommandLineProcessor cmdp(false,true);
cmdp.setOption("verbose","quiet",&verbose,"Print messages and results.");
cmdp.setOption("filename",&mat_filename,"Filename for Matrix-Market test matrix.");
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("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.");
cmdp.setOption("use-zoltan2","no-zoltan2",&useZoltan2,"Use Zoltan2 (Hypergraph) for repartitioning");
cmdp.setOption("use-parmetis","no-parmetis",&useParMETIS,"Use ParMETIS for repartitioning");
cmdp.setOption("print-timing","no-print-timing",&printTiming,"Print solver timing statistics");
cmdp.setOption("use-stacked-timer","no-stacked-timer",&useStackedTimer,"Use StackedTimer to print solver timing statistics");
cmdp.setOption("all-print","root-print",&allprint,"All processors print to out");
if (cmdp.parse(argc,argv) != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL) {
return -1;
Expand All @@ -78,27 +99,17 @@ int main(int argc, char *argv[]) {
RCP<Teuchos::FancyOStream> fos = Teuchos::fancyOStream(Teuchos::rcpFromRef(out));

// Say hello
out << myRank << " : " << Amesos2::version() << std::endl << std::endl;
out << myRank << " : " << Amesos2::version() << " on " << comm->getSize() << " MPIs" << std::endl << std::endl;

const size_t numVectors = 1;

RCP<MAT> A = Tpetra::MatrixMarket::Reader<MAT>::readSparseFile(mat_filename, comm);
if( printMatrix ){
A->describe(*fos, Teuchos::VERB_EXTREME);
}
else if( verbose ){
std::cout << std::endl << A->description() << std::endl << std::endl;
}
// Read matrix
RCP<const MAT> A = Tpetra::MatrixMarket::Reader<MAT>::readSparseFile(mat_filename, comm);

// get the maps
RCP<const Map<LO,GO> > dmnmap = A->getDomainMap();
// get the map (Range Map used for both X & B)
RCP<const Map<LO,GO> > rngmap = A->getRangeMap();

GO nrows = dmnmap->getGlobalNumElements();
RCP<Map<LO,GO> > root_map
= rcp( new Map<LO,GO>(nrows,myRank == 0 ? nrows : 0,0,comm) );
RCP<MV> Xhat = rcp( new MV(root_map,numVectors) );
RCP<Import<LO,GO> > importer = rcp( new Import<LO,GO>(dmnmap,root_map) );
RCP<const Map<LO,GO> > dmnmap = A->getDomainMap();
GO nrows = A->getGlobalNumRows();

// Create random X
RCP<MV> X = rcp(new MV(dmnmap,numVectors));
Expand All @@ -122,6 +133,69 @@ int main(int argc, char *argv[]) {
B = Tpetra::MatrixMarket::Reader<MAT>::readDenseFile (rhs_filename, comm, rngmap);
}

if (useZoltan2 || useParMETIS) {
#if defined(HAVE_AMESOS2_XPETRA) && defined(HAVE_AMESOS2_ZOLTAN2)
// Specify partitioning parameters
Teuchos::ParameterList zoltan_params;
zoltan_params.set("partitioning_approach", "partition");
//
if (useParMETIS) {
if (comm->getRank() == 0) {
std::cout << "Using Zoltan2(ParMETIS)" << std::endl;
}
zoltan_params.set("algorithm", "parmetis");
zoltan_params.set("symmetrize_input", "transpose");
zoltan_params.set("partitioning_objective", "minimize_cut_edge_weight");
} else {
if (comm->getRank() == 0) {
std::cout << "Using Zoltan2(HyperGraph)" << std::endl;
}
zoltan_params.set("algorithm", "phg");
}

// Create an input adapter for the Tpetra matrix.
Zoltan2::TpetraRowGraphAdapter<Graph>
zoltan_graph(A->getGraph());

// Create and solve partitioning problem
Zoltan2::PartitioningProblem<Zoltan2::TpetraRowGraphAdapter<Graph>>
problem(&zoltan_graph, &zoltan_params);
problem.solve();

// Redistribute matrix
RCP<MAT> zoltan_A;
Zoltan2::TpetraCrsMatrixAdapter<MAT> zoltan_matrix(A);
zoltan_matrix.applyPartitioningSolution (*A, zoltan_A, problem.getSolution());
// Set it as coefficient matrix, and update range map
A = zoltan_A;
rngmap = A->getRangeMap();

// Redistribute RHS
RCP<MV> zoltan_b;
Zoltan2::XpetraMultiVectorAdapter<MV> adapterRHS(rcpFromRef (*B));
adapterRHS.applyPartitioningSolution (*B, zoltan_b, problem.getSolution());
// Set it as RHS
B = zoltan_b;

// Redistribute Sol
RCP<MV> zoltan_x;
Zoltan2::XpetraMultiVectorAdapter<MV> adapterSol(rcpFromRef (*X));
adapterSol.applyPartitioningSolution (*X, zoltan_x, problem.getSolution());
// Set it as Sol
X = zoltan_x;
#else
TEUCHOS_TEST_FOR_EXCEPTION(
useZoltan2, std::invalid_argument,
"Both Xpetra and Zoltan2 are needed to use Zoltan2.");
#endif
}
if( printMatrix ){
A->describe(*fos, Teuchos::VERB_EXTREME);
}
else if( verbose ){
std::cout << std::endl << A->description() << std::endl << std::endl;
}

// Constructor from Factory
RCP<Amesos2::Solver<MAT,MV> > solver;
if( !Amesos2::query(solvername) ){
Expand All @@ -130,11 +204,30 @@ int main(int argc, char *argv[]) {
}

solver = Amesos2::create<MAT,MV>(solvername, A, X, B);
if (xml_filename != "") {
Teuchos::ParameterList test_params =
Teuchos::ParameterXMLFileReader(xml_filename).getParameters();
Teuchos::ParameterList& amesos2_params = test_params.sublist("Amesos2");
*fos << amesos2_params.currentParametersString() << std::endl;
solver->setParameters( Teuchos::rcpFromRef(amesos2_params) );
}

RCP<Teuchos::StackedTimer> stackedTimer;
if(useStackedTimer) {
stackedTimer = rcp(new Teuchos::StackedTimer("Amesos2 SimpleSolve-File"));
Teuchos::TimeMonitor::setStackedTimer(stackedTimer);
}
solver->symbolicFactorization().numericFactorization().solve();
if(useStackedTimer) {
stackedTimer->stopBaseTimer();
}

if( printSolution ){
// Print the solution
RCP<Map<LO,GO> > root_map
= rcp( new Map<LO,GO>(nrows,myRank == 0 ? nrows : 0,0,comm) );
RCP<MV> Xhat = rcp( new MV(root_map,numVectors) );
RCP<Import<LO,GO> > importer = rcp( new Import<LO,GO>(rngmap,root_map) );
if( allprint ){
if( myRank == 0 ) *fos << "Solution :" << std::endl;
Xhat->describe(*fos,Teuchos::VERB_EXTREME);
Expand Down Expand Up @@ -167,11 +260,20 @@ int main(int argc, char *argv[]) {
if (myRank == 0) *fos << std::endl;
}

if( printTiming ){
if(useStackedTimer) {
Teuchos::StackedTimer::OutputOptions options;
options.num_histogram=3;
options.print_warnings = false;
options.output_histogram = true;
options.output_fraction=true;
options.output_minmax = true;
stackedTimer->report(std::cout, comm, options);
} else if( printTiming ){
// Print some timing statistics
solver->printTiming(*fos);
} else {
Teuchos::TimeMonitor::summarize();
}
Teuchos::TimeMonitor::summarize();

// We are done.
return 0;
Expand Down
Loading

0 comments on commit 7f913e3

Please sign in to comment.