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

#210: Belos: replace hb reader tpetra #214

Draft
wants to merge 16 commits into
base: NGA-FY23-develop
Choose a base branch
from
Draft
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
8 changes: 4 additions & 4 deletions packages/belos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,19 @@ ADD_SUBDIRECTORY(src)

TRIBITS_ADD_TEST_DIRECTORIES(test)

IF (Belos_ENABLE_Epetra)
IF (${PACKAGE_NAME}_ENABLE_Epetra)
ADD_SUBDIRECTORY(epetra)
ENDIF()

IF (Belos_ENABLE_Tpetra)
IF (${PACKAGE_NAME}_ENABLE_Tpetra)
ADD_SUBDIRECTORY(tpetra)
ENDIF()

IF (Belos_ENABLE_KokkosKernels)
IF (${PACKAGE_NAME}_ENABLE_KokkosKernels)
ADD_SUBDIRECTORY(kokkos)
ENDIF()

IF (Belos_ENABLE_Xpetra)
IF (${PACKAGE_NAME}_ENABLE_Xpetra)
ADD_SUBDIRECTORY(xpetra)
ENDIF()

Expand Down
21 changes: 10 additions & 11 deletions packages/belos/tpetra/example/BlockCG/BlockCGTpetraExFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,6 @@
// NOTE: No preconditioner is used in this example.
//

// Tpetra
#include <Tpetra_Map.hpp>
#include <Tpetra_Core.hpp>
#include <Tpetra_Vector.hpp>
#include <Tpetra_CrsMatrix.hpp>
// I/O for Harwell-Boeing files
#define HIDE_TPETRA_INOUT_IMPLEMENTATIONS
#include <Tpetra_MatrixIO.hpp>

// Teuchos
#include <Teuchos_RCP.hpp>
#include <Teuchos_Comm.hpp>
Expand All @@ -66,13 +57,21 @@
#include "Teuchos_StandardCatchMacros.hpp"
#include "Teuchos_CommandLineProcessor.hpp"

// Tpetra
#include <Tpetra_Map.hpp>
#include <Tpetra_Core.hpp>
#include <Tpetra_Vector.hpp>
#include <Tpetra_CrsMatrix.hpp>
// I/O for Harwell-Boeing files
#define HIDE_TPETRA_INOUT_IMPLEMENTATIONS
#include <Tpetra_MatrixIO.hpp>

// Belos
#include "BelosConfigDefs.hpp"
#include "BelosBlockCGSolMgr.hpp"
#include "BelosLinearProblem.hpp"
#include "BelosTpetraAdapter.hpp"


template <typename ScalarType>
int run(int argc, char *argv[]) {

Expand Down Expand Up @@ -114,7 +113,7 @@ int run(int argc, char *argv[]) {
Teuchos::CommandLineProcessor cmdp(false,true);
cmdp.setOption("verbose","quiet",&verbose,"Print messages and results.");
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("filename",&filename,"Filename for Harwell-Boeing test matrix.");
cmdp.setOption("tol",&tol,"Relative residual tolerance used by CG solver.");
cmdp.setOption("num-rhs",&numrhs,"Number of right-hand sides to be solved for.");
cmdp.setOption("block-size",&blockSize,"Block size used by CG.");
Expand Down
37 changes: 16 additions & 21 deletions packages/belos/tpetra/example/BlockCG/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@


ASSERT_DEFINED(${PACKAGE_NAME}_ENABLE_Triutils)
IF (${PACKAGE_NAME}_ENABLE_Triutils)
TRIBITS_ADD_EXECUTABLE_AND_TEST(
BlockCG_Tpetra_File_Ex
SOURCES BlockCGTpetraExFile.cpp
COMM serial mpi
)

TRIBITS_ADD_EXECUTABLE_AND_TEST(
BlockCG_Tpetra_File_Ex
SOURCES BlockCGTpetraExFile.cpp
COMM serial mpi
)
TRIBITS_ADD_EXECUTABLE_AND_TEST(
PseudoBlockCG_Tpetra_File_Ex
SOURCES PseudoBlockCGTpetraExFile.cpp
COMM serial mpi
)

TRIBITS_ADD_EXECUTABLE_AND_TEST(
PseudoBlockCG_Tpetra_File_Ex
SOURCES PseudoBlockCGTpetraExFile.cpp
COMM serial mpi
)

ASSERT_DEFINED(Anasazi_SOURCE_DIR)
TRIBITS_COPY_FILES_TO_BINARY_DIR(Tpetra_CopyExampleBlockCGFiles
SOURCE_DIR ${Anasazi_SOURCE_DIR}/testmatrices
SOURCE_FILES bcsstk14.hb
EXEDEPS BlockCG_Tpetra_File_Ex
)

ENDIF(${PACKAGE_NAME}_ENABLE_Triutils)
ASSERT_DEFINED(Anasazi_SOURCE_DIR)
TRIBITS_COPY_FILES_TO_BINARY_DIR(Tpetra_CopyExampleBlockCGFiles
SOURCE_DIR ${Anasazi_SOURCE_DIR}/testmatrices
SOURCE_FILES bcsstk14.hb
EXEDEPS BlockCG_Tpetra_File_Ex
)
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
#include <Teuchos_Comm.hpp>
#include <Teuchos_CommHelpers.hpp>
#include <Teuchos_DefaultComm.hpp>
#include "Teuchos_ParameterList.hpp"
#include "Teuchos_StandardCatchMacros.hpp"
#include "Teuchos_CommandLineProcessor.hpp"
#include <Teuchos_ParameterList.hpp>
#include <Teuchos_StandardCatchMacros.hpp>
#include <Teuchos_CommandLineProcessor.hpp>

// Belos
#include "BelosConfigDefs.hpp"
Expand Down Expand Up @@ -114,7 +114,7 @@ int run(int argc, char *argv[]) {
Teuchos::CommandLineProcessor cmdp(false,true);
cmdp.setOption("verbose","quiet",&verbose,"Print messages and results.");
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("filename",&filename,"Filename for Harwell-Boeing test matrix.");
cmdp.setOption("tol",&tol,"Relative residual tolerance used by CG solver.");
cmdp.setOption("num-rhs",&numrhs,"Number of right-hand sides to be solved for.");
cmdp.setOption("block-size",&blockSize,"Block size used by CG.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,24 @@
#include <Tpetra_Core.hpp>
#include <Tpetra_Vector.hpp>
#include <Tpetra_CrsMatrix.hpp>
// I/O for Harwell-Boeing files
#define HIDE_TPETRA_INOUT_IMPLEMENTATIONS
#include <Tpetra_MatrixIO.hpp>

// Teuchos
#include <Teuchos_RCP.hpp>
#include <Teuchos_Comm.hpp>
#include <Teuchos_CommHelpers.hpp>
#include <Teuchos_DefaultComm.hpp>
#include "Teuchos_ParameterList.hpp"
#include "Teuchos_StandardCatchMacros.hpp"
#include "Teuchos_CommandLineProcessor.hpp"
#include <Teuchos_ParameterList.hpp>
#include <Teuchos_StandardCatchMacros.hpp>
#include <Teuchos_CommandLineProcessor.hpp>

// Belos
#include "BelosConfigDefs.hpp"
#include "BelosBlockGmresSolMgr.hpp"
#include "BelosLinearProblem.hpp"
#include "BelosTpetraTestFramework.hpp"

#include "BelosTpetraAdapter.hpp"

template <typename ScalarType>
int run(int argc, char *argv[]) {
Expand Down Expand Up @@ -117,7 +119,7 @@ int run(int argc, char *argv[]) {
cmdp.setOption("verbose","quiet",&verbose,"Print messages and results.");
cmdp.setOption("debug","nondebug",&debug,"Print debugging information from solver.");
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("filename",&filename,"Filename for Harwell-Boeing test matrix.");
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("block-size",&blockSize,"Block size used by GMRES.");
Expand All @@ -138,8 +140,8 @@ int run(int argc, char *argv[]) {
}

// Get the problem
Belos::Tpetra::HarwellBoeingReader<tcrsmatrix_t> reader( comm );
RCP<tcrsmatrix_t> A = reader.readFromFile( filename );
RCP<tcrsmatrix_t> A;
Tpetra::Utils::readHBMatrix(filename, comm, A);
RCP<const tmap_t> Map = A->getDomainMap();

// Create initial vectors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@
#include <Teuchos_Comm.hpp>
#include <Teuchos_CommHelpers.hpp>
#include <Teuchos_DefaultComm.hpp>
#include "Teuchos_ParameterList.hpp"
#include <Teuchos_ParameterList.hpp>
#include <Teuchos_TypeNameTraits.hpp>
#include <Teuchos_oblackholestream.hpp>
#include "Teuchos_StandardCatchMacros.hpp"
#include "Teuchos_CommandLineProcessor.hpp"
#include <Teuchos_StandardCatchMacros.hpp>
#include <Teuchos_CommandLineProcessor.hpp>

// Belos
#include "BelosTpetraAdapter.hpp"
Expand Down
42 changes: 19 additions & 23 deletions packages/belos/tpetra/example/BlockGmres/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,39 +1,35 @@

ASSERT_DEFINED(${PACKAGE_NAME}_ENABLE_Galeri)
ASSERT_DEFINED(${PACKAGE_NAME}_ENABLE_Triutils)

IF (${PACKAGE_NAME}_ENABLE_Triutils)
TRIBITS_ADD_EXECUTABLE(
BlockGmres_Tpetra_File_Ex
SOURCES BlockGmresTpetraExFile.cpp
COMM serial mpi
)

TRIBITS_ADD_EXECUTABLE(
BlockGmres_Tpetra_File_Ex
SOURCES BlockGmresTpetraExFile.cpp
COMM serial mpi
)

TRIBITS_ADD_EXECUTABLE(
PseudoBlockGmres_Tpetra_File_Ex
SOURCES PseudoBlockGmresTpetraExFile.cpp
COMM serial mpi
)

TRIBITS_COPY_FILES_TO_BINARY_DIR(Tpetra_CopyExampleBlockGmresFiles
SOURCE_DIR ${Belos_SOURCE_DIR}/tpetra/example/BlockGmres
SOURCE_FILES orsirr1.hb identity.mtx
EXEDEPS BlockGmres_Tpetra_File_Ex
)
TRIBITS_ADD_EXECUTABLE(
PseudoBlockGmres_Tpetra_File_Ex
SOURCES PseudoBlockGmresTpetraExFile.cpp
COMM serial mpi
)

ENDIF(${PACKAGE_NAME}_ENABLE_Triutils)
TRIBITS_COPY_FILES_TO_BINARY_DIR(Tpetra_CopyExampleBlockGmresFiles
SOURCE_DIR ${Belos_SOURCE_DIR}/tpetra/testmatrices
SOURCE_FILES orsirr1.hb identity.mtx
EXEDEPS BlockGmres_Tpetra_File_Ex
)

ASSERT_DEFINED(${PACKAGE_NAME}_ENABLE_Galeri)
IF (${PACKAGE_NAME}_ENABLE_Galeri AND ${PACKAGE_NAME}_ENABLE_Xpetra)

TRIBITS_ADD_EXECUTABLE_AND_TEST(
Tpetra_BlockGmres_Galeri_Ex
SOURCES BlockGmresTpetraGaleriEx.cpp
COMM serial mpi
ARGS "--verbose --nx=10 --ortho=DGKS"
"--verbose --nx=10 --ortho=ICGS"
"--verbose --nx=10 --ortho=IMGS"
"--verbose --nx=10 --ortho=ICGS"
"--verbose --nx=10 --ortho=IMGS"
STANDARD_PASS_OUTPUT
)

ENDIF (${PACKAGE_NAME}_ENABLE_Galeri AND ${PACKAGE_NAME}_ENABLE_Xpetra)
ENDIF ()
2 changes: 0 additions & 2 deletions packages/belos/tpetra/example/BlockGmres/Dummy

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,29 @@
// NOTE: No preconditioner is used in this example.
//

// Tpetra
#include <Tpetra_Map.hpp>
#include <Tpetra_Core.hpp>
#include <Tpetra_Vector.hpp>
#include <Tpetra_CrsMatrix.hpp>

// Teuchos
#include <Teuchos_RCP.hpp>
#include <Teuchos_Comm.hpp>
#include <Teuchos_CommHelpers.hpp>
#include <Teuchos_DefaultComm.hpp>
#include "Teuchos_ParameterList.hpp"
#include "Teuchos_StandardCatchMacros.hpp"
#include "Teuchos_CommandLineProcessor.hpp"
#include <Teuchos_ParameterList.hpp>
#include <Teuchos_StandardCatchMacros.hpp>
#include <Teuchos_CommandLineProcessor.hpp>

// Tpetra
#include <Tpetra_Map.hpp>
#include <Tpetra_Core.hpp>
#include <Tpetra_Vector.hpp>
#include <Tpetra_CrsMatrix.hpp>
// I/O for Harwell-Boeing files
#define HIDE_TPETRA_INOUT_IMPLEMENTATIONS
#include <Tpetra_MatrixIO.hpp>

// Belos
#include "BelosConfigDefs.hpp"
#include "BelosPseudoBlockGmresSolMgr.hpp"
#include "BelosLinearProblem.hpp"
#include "BelosTpetraTestFramework.hpp"
#include "BelosTpetraAdapter.hpp"


template <typename ScalarType>
Expand Down Expand Up @@ -114,7 +117,7 @@ int run(int argc, char *argv[]) {
Teuchos::CommandLineProcessor cmdp(false,true);
cmdp.setOption("verbose","quiet",&verbose,"Print messages and results.");
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("filename",&filename,"Filename for Harwell-Boeing test matrix.");
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("block-size",&blockSize,"Block size used by GMRES.");
Expand All @@ -133,9 +136,9 @@ int run(int argc, char *argv[]) {
std::cout << Belos::Belos_Version() << std::endl << std::endl;
}

// Get the problem
Belos::Tpetra::HarwellBoeingReader<tcrsmatrix_t> reader( comm );
RCP<tcrsmatrix_t> A = reader.readFromFile( filename );
// Get the problem
RCP<tcrsmatrix_t> A;
Tpetra::Utils::readHBMatrix(filename, comm, A);
RCP<const tmap_t> Map = A->getDomainMap();

// Create initial vectors
Expand Down
Loading
Loading