Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trilinos Master Merge PR Generator: Auto PR created to promote from master_merge_20211026_000551 branch to master #9859

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
d57f6ab
Replace recursive by iterative implementation of heapify
masterleinad Jun 10, 2021
e2359ae
Tpetra: Enable more SYCL tests
masterleinad Jun 10, 2021
f310e12
Improve comments
masterleinad Jul 22, 2021
3b4f116
Mention KokkosKernel issue
masterleinad Jul 22, 2021
b539d1a
Panzer: fix 1D line mesh issue on cuda
rppawlo Oct 6, 2021
54a5a70
MiniTensor: fix or at least work around some __host__ __device__ marking
japlews Oct 12, 2021
0c76505
Merge pull request #9806 from japlews/japlews/minitensor-host-device-…
jhux2 Oct 13, 2021
189fe36
TrilinosCouplings: Adding 2D anisotropic diffusion
csiefer2 Oct 15, 2021
452e80d
Merge Pull Request #9783 from rppawlo/Trilinos/panzer-fix1d-line-mesh
trilinos-autotester Oct 18, 2021
fd27eb3
MueLu: Adding signed SA style dropping option
csiefer2 Oct 19, 2021
13007a8
MueLu: Adding signed SA style dropping option
csiefer2 Oct 19, 2021
2d80622
TrilinosCouplings: Output mods
csiefer2 Oct 19, 2021
a72563a
update config/config.* to build on summit
cwsmith Oct 19, 2021
49eda37
MueLu: Removing printf
csiefer2 Oct 19, 2021
d91d3fc
new version of prolongator constraint satisfication capability
rstumin Oct 19, 2021
0b13a91
Merge Pull Request #9822 from trilinos/Trilinos/csiefer-13007a8
trilinos-autotester Oct 19, 2021
48770fe
Changes to fix errors in LCM
lxmota Oct 20, 2021
0c4bac0
Merge Pull Request #9831 from trilinos/Trilinos/minitensor-lcm
trilinos-autotester Oct 20, 2021
186a40b
First krino commit (#9825)
drnobleabq Oct 20, 2021
7723a6a
fixed some scalar traits type compile errors
rstumin Oct 20, 2021
0187150
packages/framework: Point to top-level ini files
e10harvey Oct 20, 2021
b6b9d46
Merge Pull Request #9266 from masterleinad/Trilinos/enable_more_sycl_…
trilinos-autotester Oct 21, 2021
6870a3e
Tpetra: Fixing stride bug
csiefer2 Oct 21, 2021
cf3ae06
Merge pull request #9834 from e10harvey/TRILFRAME-129
e10harvey Oct 21, 2021
ab51356
Merge Pull Request #9837 from trilinos/Trilinos/csiefer-6870a3e
trilinos-autotester Oct 21, 2021
3d18a53
fixed one more comparison that needed a teuchos scalar traits cast to…
rstumin Oct 21, 2021
b690724
introduced new variable with LocalOrdinal type to remove a casting er…
rstumin Oct 21, 2021
efad248
Merge Pull Request #9826 from cwsmith/Trilinos/cws/zoltanConfigUpdate
trilinos-autotester Oct 22, 2021
77a45dd
one more casting fix
rstumin Oct 22, 2021
511cf50
ML: Fix socket references for Windows builds
sskutnik Oct 22, 2021
71a9276
Fix TeuchosParameterlist Windows build configuration
sskutnik Oct 22, 2021
d3a9411
Fix invalid enum reference for Thyra SpmdVectorDefaultBase
sskutnik Oct 22, 2021
3b37d42
Merge Pull Request #9829 from trilinos/Trilinos/rstumin-d91d3fc
trilinos-autotester Oct 22, 2021
d02666c
shylubasker: remove deprecated code
ndellingwood Oct 22, 2021
9c42161
Merge Pull Request #9849 from sskutnik/Trilinos/fix_ml_socket_windows
trilinos-autotester Oct 23, 2021
f89d494
Merge pull request #9848 from sskutnik/thyra-fix-invalid-enum
jhux2 Oct 23, 2021
113793c
Merge Pull Request #9845 from sskutnik/Trilinos/fix_teuchos_parameter…
trilinos-autotester Oct 23, 2021
06d8083
Belos: Kokkos solvers adapter (#9827)
jennloe Oct 25, 2021
3bae707
Merge pull request #9853 from ndellingwood/shylubasker-rm-deps
hkthorn Oct 25, 2021
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
1 change: 1 addition & 0 deletions PackagesList.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ TRIBITS_REPOSITORY_DEFINE_PACKAGES(
Compadre packages/compadre ST
STK packages/stk PT # Depends on boost
Percept packages/percept PT # Depends on boost
Krino packages/krino PT # Depends on boost
SCORECapf_zoltan SCOREC/zoltan ST
SCORECapf_stk SCOREC/stk ST
SCORECma SCOREC/ma ST
Expand Down
4 changes: 4 additions & 0 deletions packages/belos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ IF (Belos_ENABLE_Tpetra)
ADD_SUBDIRECTORY(tpetra)
ENDIF()

IF (Belos_ENABLE_KokkosKernels)
ADD_SUBDIRECTORY(kokkos)
ENDIF()

IF (Belos_ENABLE_Xpetra)
ADD_SUBDIRECTORY(xpetra)
ENDIF()
Expand Down
3 changes: 3 additions & 0 deletions packages/belos/cmake/Belos_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
/* Define if want to build with EpetraExt enabled */
#cmakedefine HAVE_BELOS_EPETRAEXT

/* Define if want to build with KokkosKernels enabled */
#cmakedefine HAVE_BELOS_KOKKOSKERNELS

/* Define if want to build with ML enabled */
#cmakedefine HAVE_BELOS_ML

Expand Down
2 changes: 1 addition & 1 deletion packages/belos/cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SET(LIB_REQUIRED_DEP_PACKAGES Teuchos)
SET(LIB_OPTIONAL_DEP_PACKAGES Epetra Tpetra Xpetra Thyra AztecOO Triutils)
SET(LIB_OPTIONAL_DEP_PACKAGES Epetra Tpetra Xpetra Thyra AztecOO Triutils KokkosKernels)
SET(TEST_REQUIRED_DEP_PACKAGES)
SET(TEST_OPTIONAL_DEP_PACKAGES Galeri Triutils EpetraExt Ifpack ML AztecOO)
SET(LIB_REQUIRED_DEP_TPLS)
Expand Down
4 changes: 4 additions & 0 deletions packages/belos/kokkos/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ADD_SUBDIRECTORY(src)

TRIBITS_ADD_TEST_DIRECTORIES(test)
TRIBITS_ADD_EXAMPLE_DIRECTORIES(example)
215 changes: 215 additions & 0 deletions packages/belos/kokkos/example/BlockCGKokkosExFile.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
//@HEADER
// ************************************************************************
//
// Belos: Block Linear Solvers Package
// Copyright 2004 Sandia Corporation
//
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
//
// ************************************************************************
//@HEADER
//
// This driver reads a problem from a file, which must be in Matrix Market (*.mtx).
// The problem right-hand side will be generated randomly.
//
// NOTE: No preconditioner is used in this example.
//
#include "BelosConfigDefs.hpp"
#include "BelosLinearProblem.hpp"
#include "BelosBlockCGSolMgr.hpp"
#include "BelosOutputManager.hpp"

#include "Teuchos_CommandLineProcessor.hpp"
#include "Teuchos_ParameterList.hpp"
#include "Teuchos_StandardCatchMacros.hpp"

#include "BelosKokkosAdapter.hpp"
#include "KokkosKernels_IOUtils.hpp"
#ifdef HAVE_MPI
#include <mpi.h>
#endif

int main(int argc, char *argv[]) {

#ifdef HAVE_MPI
MPI_Init(&argc,&argv);
#endif

bool success = true;
Kokkos::initialize();
{

typedef double ST;
typedef int OT;
typedef Kokkos::DefaultExecutionSpace EXSP;
typedef Teuchos::ScalarTraits<ST> SCT;
typedef SCT::magnitudeType MT;
typedef Belos::KokkosMultiVec<ST, EXSP> MV;
typedef Belos::KokkosCrsOperator<ST, OT, EXSP> OP;
typedef Belos::MultiVec<ST> KMV;
typedef Belos::Operator<ST> KOP;
typedef Belos::MultiVecTraits<ST,KMV> MVT;
typedef Belos::OperatorTraits<ST,KMV,KOP> OPT;

using Teuchos::ParameterList;
using Teuchos::RCP;
using Teuchos::rcp;
using Teuchos::rcpFromRef;

bool verbose = true;
try {
int frequency = 25; // frequency of status test output.
int numrhs = 1; // number of right-hand sides to solve for
int maxiters = -1; // maximum number of iterations allowed per linear system
bool expresidual = false; // use explicit residual
std::string filename("bcsstk12.mtx"); // example matrix
MT tol = 1.0e-5; // relative residual tolerance

Teuchos::CommandLineProcessor cmdp(false,true);
cmdp.setOption("verbose","quiet",&verbose,"Print messages and results.");
cmdp.setOption("expres","impres",&expresidual,"Use explicit residual throughout.");
cmdp.setOption("frequency",&frequency,"Solvers frequency for printing residuals (#iters).");
cmdp.setOption("filename",&filename,"Filename for test matrix. Acceptable file extensions: *.hb,*.mtx,*.triU,*.triS");
cmdp.setOption("tol",&tol,"Relative residual tolerance used by Gmres solver.");
cmdp.setOption("num-rhs",&numrhs,"Number of right-hand sides to be solved for.");
cmdp.setOption("max-iters",&maxiters,"Maximum number of iterations per linear system (-1 = adapted to problem/block size).");

if (cmdp.parse(argc,argv) != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL) {
return -1;
}
if (!verbose)
frequency = -1; // reset frequency if test is not verbose

// Read in a matrix Market file and use it to test the Kokkos Operator.
KokkosSparse::CrsMatrix<ST, OT, EXSP> crsMat =
KokkosKernels::Impl::read_kokkos_crst_matrix<KokkosSparse::CrsMatrix<ST, OT, EXSP>>(filename.c_str());
RCP<Belos::KokkosCrsOperator<ST, OT, EXSP>> A =
rcp(new Belos::KokkosCrsOperator<ST,OT,EXSP>(crsMat));
OT numRows = crsMat.numRows();

Teuchos::RCP<MV> X = Teuchos::rcp( new MV(numRows, numrhs) );
X->MvRandom();
Teuchos::RCP<MV> B = Teuchos::rcp( new MV(numRows, numrhs) );
OPT::Apply(*A,*X,*B);
X->MvInit(0.0);

//
// ********Other information used by block solver***********
// *****************(can be user specified)******************
//
const int NumGlobalElements = B->GetGlobalLength();
if (maxiters == -1)
maxiters = NumGlobalElements - 1; // maximum number of iterations to run

ParameterList belosList;
belosList.set( "Maximum Iterations", maxiters ); // Maximum number of iterations allowed
belosList.set( "Convergence Tolerance", tol ); // Relative convergence tolerance requested
belosList.set( "Explicit Residual Test", expresidual); // use explicit residual

if (verbose) {
belosList.set( "Verbosity", Belos::Errors + Belos::Warnings +
Belos::StatusTestDetails + Belos::FinalSummary + Belos::TimingDetails);
if (frequency > 0)
belosList.set( "Output Frequency", frequency );
}
else
belosList.set( "Verbosity", Belos::Errors + Belos::Warnings );

//
// Construct an unpreconditioned linear problem instance.
//
Belos::LinearProblem<ST,KMV,KOP> problem( A, X, B );
bool set = problem.setProblem();
if (set == false) {
std::cout << std::endl << "ERROR: Belos::LinearProblem failed to set up correctly!" << std::endl;
return -1;
}
//
// *******************************************************************
// **************Start the block CG iteration*************************
// *******************************************************************
//
// Create an iterative solver manager.
RCP< Belos::SolverManager<ST,KMV,KOP> > newSolver
= rcp( new Belos::BlockCGSolMgr<ST,KMV,KOP>(rcpFromRef(problem), rcpFromRef(belosList)) );

//
// **********Print out information about problem*******************
//
std::cout << std::endl << std::endl;
std::cout << "Dimension of matrix: " << NumGlobalElements << std::endl;
std::cout << "Number of right-hand sides: " << numrhs << std::endl;
std::cout << "Max number of Gmres iterations: " << maxiters << std::endl;
std::cout << "Relative residual tolerance: " << tol << std::endl;
std::cout << std::endl;
//
// Perform solve
//
Belos::ReturnType ret;
ret = newSolver->solve();

//
// Compute actual residuals.
//
bool badRes = false;
std::vector<ST> actual_resids( numrhs );
std::vector<ST> rhs_norm( numrhs );
MV resid(numRows, numrhs);
OPT::Apply( *A, *X, resid );
MVT::MvAddMv( -1.0, resid, 1.0, *B, resid );
MVT::MvNorm( resid, actual_resids );
MVT::MvNorm( *B, rhs_norm );
std::cout<< "---------- Actual Residuals (normalized) ----------"<<std::endl<<std::endl;
for ( int i=0; i<numrhs; i++) {
ST actRes = actual_resids[i]/rhs_norm[i];
std::cout<<"Problem "<<i<<" : \t"<< actRes <<std::endl;
if (actRes > tol) badRes = true;
}

if (ret!=Belos::Converged || badRes) {
success = false;
std::cout << std::endl << "ERROR: Belos did not converge!" << std::endl;
} else {
success = true;
std::cout << std::endl << "SUCCESS: Belos converged!" << std::endl;
}

}
TEUCHOS_STANDARD_CATCH_STATEMENTS(verbose, std::cerr, success);
}
Kokkos::finalize();
#ifdef HAVE_MPI
MPI_Finalize();
#endif
return success ? EXIT_SUCCESS : EXIT_FAILURE;
}
Loading