本文整理汇总了C++中teuchos::CommandLineProcessor::setOption方法的典型用法代码示例。如果您正苦于以下问题:C++ CommandLineProcessor::setOption方法的具体用法?C++ CommandLineProcessor::setOption怎么用?C++ CommandLineProcessor::setOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类teuchos::CommandLineProcessor
的用法示例。
在下文中一共展示了CommandLineProcessor::setOption方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
Teuchos::GlobalMPISession session(&argc, &argv);
RCP<const Teuchos::Comm<int> > tcomm = Teuchos::DefaultComm<int>::getComm();
int rank = tcomm->getRank();
int nParts = tcomm->getSize();
bool doRemap = false;
string filename = "USAir97";
// Read run-time options.
Teuchos::CommandLineProcessor cmdp (false, false);
cmdp.setOption("file", &filename, "Name of the Matrix Market file to read");
cmdp.setOption("nparts", &nParts, "Number of parts.");
cmdp.setOption("remap", "no-remap", &doRemap, "Remap part numbers.");
cmdp.parse(argc, argv);
meshCoordinatesTest(tcomm);
testFromDataFile(tcomm, nParts, filename, doRemap);
if (rank == 0)
serialTest(nParts, doRemap);
if (rank == 0)
std::cout << "PASS" << std::endl;
}
示例2: mpiSession
int
main (int argc, char* argv[])
{
using KokkosBlas::Impl::testOverScalarsAndLayoutsAndDevices;
using std::cout;
using std::endl;
Teuchos::oblackholestream blackHole;
Teuchos::GlobalMPISession mpiSession (&argc, &argv, &blackHole);
Kokkos::initialize (argc, argv);
#ifdef HAVE_MPI
RCP<const Comm<int> > comm = rcp (new Teuchos::MpiComm<int> (MPI_COMM_WORLD));
#else
RCP<const Comm<int> > comm = rcp (new Teuchos::SerialComm<int> ());
#endif // HAVE_MPI
const int myRank = comm->getRank ();
// Number of columns in the 2-D View(s) to test.
int numCols = 3;
bool oneCol = false;
bool testComplex = true;
Teuchos::CommandLineProcessor cmdp (false, true);
cmdp.setOption ("numCols", &numCols,
"Number of columns in the 2-D View(s) to test");
cmdp.setOption ("oneCol", "noOneCol", &oneCol, "Whether to test the 1-D View "
"(single-column) versions of the kernels");
cmdp.setOption ("testComplex", "noTestComplex", &testComplex,
"Whether to test complex arithmetic");
if (cmdp.parse (argc,argv) != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL) {
if (myRank == 0) {
cout << "TEST FAILED to parse command-line arguments!" << endl;
}
return EXIT_FAILURE;
}
bool curSuccess = true;
bool success = true;
// Always test with numCols=1 first.
curSuccess = testOverScalarsAndLayoutsAndDevices (cout, 1, oneCol, testComplex);
success = curSuccess && success;
if (numCols != 1) {
curSuccess = testOverScalarsAndLayoutsAndDevices (cout, numCols,
oneCol, testComplex);
success = curSuccess && success;
}
if (success) {
if (myRank == 0) {
cout << "End Result: TEST PASSED" << endl;
}
} else {
if (myRank == 0) {
cout << "End Result: TEST FAILED" << endl;
}
}
Kokkos::finalize ();
return EXIT_SUCCESS;
}
示例3: main
int main (int argc, char *argv[]) {
Teuchos::CommandLineProcessor clp;
clp.setDocString("This example program demonstrates symbolic factorization algorithm on Kokkos::Serial execution space.\n");
int fill_level = 0;
clp.setOption("fill-level", &fill_level, "Fill level for incomplete factorization");
int league_size = 1;
clp.setOption("league-size", &league_size, "League size");
bool verbose = false;
clp.setOption("enable-verbose", "disable-verbose", &verbose, "Flag for verbose printing");
string file_input = "test.mtx";
clp.setOption("file-input", &file_input, "Input file (MatrixMarket SPD matrix)");
int treecut = 0;
clp.setOption("treecut", &treecut, "Level to cut tree from bottom");
int minblksize = 0;
clp.setOption("minblksize", &minblksize, "Minimum block size for internal reordering");
int seed = 0;
clp.setOption("seed", &seed, "Seed for random number generator in graph partition");
bool scotch = true;
clp.setOption("enable-scotch", "disable-scotch", &scotch, "Flag for Scotch");
bool camd = true;
clp.setOption("enable-camd", "disable-camd", &camd, "Flag for CAMD");
bool symbolic = true;
clp.setOption("enable-symbolic", "disable-symbolic", &symbolic, "Flag for sybolic factorization");
clp.recogniseAllOptions(true);
clp.throwExceptions(false);
Teuchos::CommandLineProcessor::EParseCommandLineReturn r_parse= clp.parse( argc, argv );
if (r_parse == Teuchos::CommandLineProcessor::PARSE_HELP_PRINTED) return 0;
if (r_parse != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL ) return -1;
int r_val = 0;
{
Kokkos::initialize();
r_val = exampleSymbolicFactor
<value_type,ordinal_type,size_type,exec_space,void>
(file_input, treecut, minblksize, seed,
fill_level, league_size,
scotch, camd, symbolic, verbose);
Kokkos::finalize();
}
return r_val;
}
示例4: main
int main (int argc, char *argv[]) {
Teuchos::CommandLineProcessor clp;
clp.setDocString("Tacho::DenseMatrixBase examples on Pthreads execution space.\n");
int nthreads = 0;
clp.setOption("nthreads", &nthreads, "Number of threads");
int numa = 0;
clp.setOption("numa", &numa, "Number of numa node");
int core_per_numa = 0;
clp.setOption("core-per-numa", &core_per_numa, "Number of cores per numa node");
bool verbose = false;
clp.setOption("enable-verbose", "disable-verbose", &verbose, "Flag for verbose printing");
std::string file_input = "test.mtx";
clp.setOption("file-input", &file_input, "Input file (MatrixMarket SPD matrix)");
int treecut = 0;
clp.setOption("treecut", &treecut, "Level to cut tree from bottom");
int prunecut = 0;
clp.setOption("prunecut", &prunecut, "Level to prune tree from bottom");
int fill_level = -1;
clp.setOption("fill-level", &fill_level, "Fill level");
int rows_per_team = 4096;
clp.setOption("rows-per-team", &rows_per_team, "Workset size");
clp.recogniseAllOptions(true);
clp.throwExceptions(false);
Teuchos::CommandLineProcessor::EParseCommandLineReturn r_parse= clp.parse( argc, argv );
if (r_parse == Teuchos::CommandLineProcessor::PARSE_HELP_PRINTED) return 0;
if (r_parse != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL ) return -1;
int r_val = 0;
{
exec_space::initialize(nthreads, numa, core_per_numa);
#if (defined(HAVE_SHYLUTACHO_SCOTCH) && (defined(HAVE_SHYLUTACHO_CHOLMOD) \
|| defined(HAVE_SHYLUTACHO_AMESOS)))
r_val = exampleIncompleteSymbolicFactorization<exec_space>
(file_input, treecut, prunecut, fill_level, rows_per_team, verbose);
#else
r_val = -1;
std::cout << "Scotch or Cholmod is NOT configured in Trilinos" << std::endl;
#endif
exec_space::finalize();
}
return r_val;
}
开发者ID:uppatispr,项目名称:trilinos-official,代码行数:58,代码来源:Tacho_ExampleIncompleteSymbolicFactorization_Pthreads.cpp
示例5: main
int main (int argc, char *argv[]) {
Teuchos::CommandLineProcessor clp;
clp.setDocString("This example program measure the performance of IChol algorithms on Kokkos::Threads execution space.\n");
int nthreads = 1;
clp.setOption("nthreads", &nthreads, "Number of threads");
int max_task_dependence = 10;
clp.setOption("max-task-dependence", &max_task_dependence, "Max number of task dependence");
int team_size = 1;
clp.setOption("team-size", &team_size, "Team size");
bool team_interface = false;
clp.setOption("enable-team-interface", "disable-team-interface",
&team_interface, "Flag for team interface");
bool verbose = false;
clp.setOption("enable-verbose", "disable-verbose", &verbose, "Flag for verbose printing");
string file_input = "test.mtx";
clp.setOption("file-input", &file_input, "Input file (MatrixMarket SPD matrix)");
int nrhs = 1;
clp.setOption("nrhs", &nrhs, "Number of right hand side");
int nb = nrhs;
clp.setOption("nb", &nb, "Blocksize of right hand side");
int niter = 100;
clp.setOption("niter", &niter, "Number of iterations for testing");
clp.recogniseAllOptions(true);
clp.throwExceptions(false);
Teuchos::CommandLineProcessor::EParseCommandLineReturn r_parse= clp.parse( argc, argv );
if (r_parse == Teuchos::CommandLineProcessor::PARSE_HELP_PRINTED) return 0;
if (r_parse != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL ) return -1;
int r_val = 0;
{
exec_space::initialize(nthreads);
exec_space::print_configuration(cout, true);
r_val = exampleTriSolvePerformance
<value_type,ordinal_type,size_type,exec_space,void>
(file_input, nrhs, nb, niter, nthreads, max_task_dependence, team_size, team_interface, (nthreads != 1), verbose);
exec_space::finalize();
}
return r_val;
}
示例6: main
int main (int argc, char *argv[]) {
Teuchos::CommandLineProcessor clp;
clp.setDocString("This example program demonstrates TriSolveUnblocked algorithm on Kokkos::Serial execution space.\n");
int max_task_dependence = 10;
clp.setOption("max-task-dependence", &max_task_dependence, "Max number of task dependence");
int team_size = 1;
clp.setOption("team-size", &team_size, "Team size");
bool verbose = false;
clp.setOption("enable-verbose", "disable-verbose", &verbose, "Flag for verbose printing");
string file_input = "test.mtx";
clp.setOption("file-input", &file_input, "Input file (MatrixMarket SPD matrix)");
int nrhs = 1;
clp.setOption("nrhs", &nrhs, "Number of right hand side");
clp.recogniseAllOptions(true);
clp.throwExceptions(false);
Teuchos::CommandLineProcessor::EParseCommandLineReturn r_parse= clp.parse( argc, argv );
if (r_parse == Teuchos::CommandLineProcessor::PARSE_HELP_PRINTED) return 0;
if (r_parse != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL ) return -1;
int r_val = 0;
{
Kokkos::initialize();
r_val = exampleTriSolveUnblocked
<value_type,ordinal_type,size_type,exec_space,void>
(file_input, nrhs, max_task_dependence, team_size, verbose);
Kokkos::finalize();
}
return r_val;
}
示例7: main
int main (int argc, char *argv[]) {
Teuchos::CommandLineProcessor clp;
clp.setDocString("Tacho::DenseMatrixBase examples on Pthreads execution space.\n");
int nthreads = 0;
clp.setOption("nthreads", &nthreads, "Number of threads");
int numa = 0;
clp.setOption("numa", &numa, "Number of numa node");
int core_per_numa = 0;
clp.setOption("core-per-numa", &core_per_numa, "Number of cores per numa node");
bool verbose = false;
clp.setOption("enable-verbose", "disable-verbose", &verbose, "Flag for verbose printing");
clp.recogniseAllOptions(true);
clp.throwExceptions(false);
Teuchos::CommandLineProcessor::EParseCommandLineReturn r_parse= clp.parse( argc, argv );
if (r_parse == Teuchos::CommandLineProcessor::PARSE_HELP_PRINTED) return 0;
if (r_parse != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL ) return -1;
int r_val = 0;
{
exec_space::initialize(nthreads, numa, core_per_numa);
r_val = exampleCrsMatrixBase<exec_space>
(verbose);
exec_space::finalize();
}
return r_val;
}
示例8: main
int main(int argc, char *argv[]) {
Teuchos::CommandLineProcessor clp;
clp.setDocString("Intrepid2::DynRankView_PerfTest01.\n");
int nworkset = 8;
clp.setOption("nworkset", &nworkset, "# of worksets");
int C = 4096;
clp.setOption("C", &C, "# of Cells in a workset");
int order = 2;
clp.setOption("order", &order, "cubature order");
bool verbose = true;
clp.setOption("enable-verbose", "disable-verbose", &verbose, "Flag for verbose printing");
clp.recogniseAllOptions(true);
clp.throwExceptions(false);
Teuchos::CommandLineProcessor::EParseCommandLineReturn r_parse= clp.parse( argc, argv );
if (r_parse == Teuchos::CommandLineProcessor::PARSE_HELP_PRINTED) return 0;
if (r_parse != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL ) return -1;
Kokkos::initialize();
if (verbose)
std::cout << "Testing datatype double\n";
const int r_val_double = Intrepid2::Test::ComputeBasis_HGRAD
<double,Kokkos::Cuda>(nworkset,
C,
order,
verbose);
return r_val_double;
}
示例9: main
int main (int argc, char *argv[]) {
Teuchos::CommandLineProcessor clp;
clp.setDocString("This example program measure the performance of task data parallelism (barrier) on Kokkos::Threads execution space.\n");
int nthreads = 0;
clp.setOption("nthreads", &nthreads, "Number of threads");
int numa = 0;
clp.setOption("numa", &numa, "Number of numa node");
int core_per_numa = 0;
clp.setOption("core-per-numa", &core_per_numa, "Number of cores per numa node");
int league_size = 1;
clp.setOption("league-size", &league_size, "League size");
int team_size = 1;
clp.setOption("team-size", &team_size, "Team size");
int ntasks = 100;
clp.setOption("ntasks", &ntasks, "Number of tasks to be spawned");
bool verbose = false;
clp.setOption("enable-verbose", "disable-verbose", &verbose, "Flag for verbose printing");
clp.recogniseAllOptions(true);
clp.throwExceptions(false);
Teuchos::CommandLineProcessor::EParseCommandLineReturn r_parse= clp.parse( argc, argv );
if (r_parse == Teuchos::CommandLineProcessor::PARSE_HELP_PRINTED) return 0;
if (r_parse != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL ) return -1;
int r_val = 0;
{
exec_space::initialize(nthreads, numa, core_per_numa);
exec_space::print_configuration(cout, true);
r_val = exampleKokkosDataData<exec_space,value_type>((ntasks > MAXTASKS ? MAXTASKS : ntasks), league_size, team_size, verbose);
exec_space::finalize();
}
return r_val;
}
示例10: ParameterList
void
setUpCommandLineArguments (Teuchos::CommandLineProcessor& cmdp,
int& nx,
int& ny,
int& nz,
std::string& xmlInputParamsFile,
std::string& solverName,
double& tol,
int& maxNumIters,
bool& verbose,
bool& debug)
{
cmdp.setOption ("nx", &nx, "Number of cells along the x dimension");
cmdp.setOption ("ny", &ny, "Number of cells along the y dimension");
cmdp.setOption ("nz", &nz, "Number of cells along the z dimension");
cmdp.setOption ("inputParams", &xmlInputParamsFile, "XML file of input "
"parameters, which we read if specified and not \"\". "
"If it has a \"meshInput\" parameter, we use its "
"std::string value as the Pamgen mesh specification. "
"Otherwise, we tell Pamgen to make a cube, using "
"nx, ny, and nz.");
cmdp.setOption ("solverName", &solverName, "Name of iterative linear solver "
"to use for solving the linear system. You may use any name "
"that Belos::SolverFactory understands. Examples include "
"\"GMRES\" and \"CG\".");
cmdp.setOption ("tol", &tol, "Tolerance for the linear solve. If not "
"specified, this is read from the input ParameterList (read "
"from the XML file). If specified, this overrides any value "
"in the input ParameterList.");
cmdp.setOption ("maxNumIters", &maxNumIters, "Maximum number of iterations "
"in the linear solve. If not specified, this is read from "
"the input ParameterList (read from the XML file). If "
"specified, this overrides any value in the input "
"ParameterList.");
cmdp.setOption ("verbose", "quiet", &verbose,
"Whether to print verbose status output.");
cmdp.setOption ("debug", "release", &debug,
"Whether to print copious debugging output to stderr.");
}
示例11: main
int main (int argc, char *argv[]) {
Teuchos::CommandLineProcessor clp;
clp.setDocString("This example interface of solver Kokkos::Threads execution space.\n");
int nthreads = 1;
clp.setOption("nthreads", &nthreads, "Number of threads");
int numa = 0;
clp.setOption("numa", &numa, "Number of numa node");
int core_per_numa = 0;
clp.setOption("core-per-numa", &core_per_numa, "Number of cores per numa node");
bool verbose = false;
clp.setOption("enable-verbose", "disable-verbose", &verbose, "Flag for verbose printing");
string file_input = "test.mtx";
clp.setOption("file-input", &file_input, "Input file (MatrixMarket SPD matrix)");
int nrhs = 1;
clp.setOption("nrhs", &nrhs, "Numer of right hand side");
clp.recogniseAllOptions(true);
clp.throwExceptions(false);
Teuchos::CommandLineProcessor::EParseCommandLineReturn r_parse= clp.parse( argc, argv );
if (r_parse == Teuchos::CommandLineProcessor::PARSE_HELP_PRINTED) return 0;
if (r_parse != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL ) return -1;
int r_val = 0;
{
exec_space::initialize(nthreads, numa, core_per_numa);
exec_space::print_configuration(cout, true);
r_val = exampleCholDirectSolver
<value_type,ordinal_type,size_type,exec_space,void>
(file_input,
nrhs,
nthreads,
verbose);
exec_space::finalize();
}
return r_val;
}
示例12: mpiSession
int
main (int argc, char *argv[])
{
using Teuchos::Comm;
using Teuchos::FancyOStream;
using Teuchos::getFancyOStream;
using Teuchos::oblackholestream;
using Teuchos::OSTab;
using Teuchos::ParameterList;
using Teuchos::parameterList;
using Teuchos::RCP;
using Teuchos::rcpFromRef;
using std::cout;
using std::endl;
//
// Typedefs for Tpetra template arguments.
//
typedef double scalar_type;
typedef long int global_ordinal_type;
typedef int local_ordinal_type;
typedef Kokkos::DefaultNode::DefaultNodeType node_type;
//
// Tpetra objects which are the MV and OP template parameters of the
// Belos specialization which we are testing.
//
typedef Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type> MV;
typedef Tpetra::Operator<scalar_type, local_ordinal_type, global_ordinal_type, node_type> OP;
//
// Other typedefs.
//
typedef Teuchos::ScalarTraits<scalar_type> STS;
typedef Tpetra::CrsMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type> sparse_matrix_type;
Teuchos::GlobalMPISession mpiSession (&argc, &argv, &cout);
RCP<const Comm<int> > comm = Tpetra::DefaultPlatform::getDefaultPlatform().getComm();
RCP<node_type> node = Tpetra::DefaultPlatform::getDefaultPlatform().getNode();
RCP<oblackholestream> blackHole (new oblackholestream);
const int myRank = comm->getRank();
// Output stream that prints only on Rank 0.
RCP<FancyOStream> out;
if (myRank == 0) {
out = Teuchos::getFancyOStream (rcpFromRef (cout));
} else {
out = Teuchos::getFancyOStream (blackHole);
}
//
// Get test parameters from command-line processor.
//
// CommandLineProcessor always understands int, but may not
// understand global_ordinal_type. We convert to the latter below.
int numRows = comm->getSize() * 100;
bool tolerant = false;
bool verbose = false;
bool debug = false;
Teuchos::CommandLineProcessor cmdp (false, true);
cmdp.setOption("numRows", &numRows,
"Global number of rows (and columns) in the sparse matrix to generate.");
cmdp.setOption("tolerant", "intolerant", &tolerant,
"Whether to parse files tolerantly.");
cmdp.setOption("verbose", "quiet", &verbose,
"Print messages and results.");
cmdp.setOption("debug", "release", &debug,
"Run debugging checks and print copious debugging output.");
if (cmdp.parse(argc,argv) != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL) {
*out << "\nEnd Result: TEST FAILED" << endl;
return EXIT_FAILURE;
}
// Output stream for verbose output.
RCP<FancyOStream> verbOut = verbose ? out : getFancyOStream (blackHole);
const bool success = true;
// Test whether it's possible to instantiate the solver.
// This is a minimal compilation test.
*verbOut << "Instantiating Block GCRODR solver" << endl;
Belos::BlockGCRODRSolMgr<scalar_type, MV, OP> solver;
//
// Test setting solver parameters. For now, we just use an empty
// (but non-null) parameter list, which the solver should fill in
// with defaults.
//
*verbOut << "Setting solver parameters" << endl;
RCP<ParameterList> solverParams = parameterList ();
solver.setParameters (solverParams);
//
// Create a linear system to solve.
//
*verbOut << "Creating linear system" << endl;
RCP<sparse_matrix_type> A;
RCP<MV> X_guess, X_exact, B;
{
typedef Belos::Tpetra::ProblemMaker<sparse_matrix_type> factory_type;
factory_type factory (comm, node, out, tolerant, debug);
RCP<ParameterList> problemParams = parameterList ();
problemParams->set ("Global number of rows",
static_cast<global_ordinal_type> (numRows));
problemParams->set ("Problem type", std::string ("Nonsymmetric"));
//.........这里部分代码省略.........
示例13: main
int main(int argc,char * argv[])
{
bool status = false;
Kokkos::initialize(argc,argv);
{
// need to protect kokkos and MPI
// calls MPI_Init and MPI_Finalize
Teuchos::GlobalMPISession mpiSession(&argc,&argv);
// build MPI/Serial communicators
#ifdef HAVE_MPI
Epetra_MpiComm Comm_epetra(MPI_COMM_WORLD);
#else
Epetra_SerialComm Comm_epetra;
#endif
Teuchos::RCP<const Teuchos::Comm<int> > Comm = Tpetra::DefaultPlatform::getDefaultPlatform ().getComm ();
Teko::Test::UnitTest::SetComm(Teuchos::rcpFromRef(Comm_epetra));
Teko::Test::UnitTest::SetComm_tpetra(Comm);
Teuchos::CommandLineProcessor clp;
int verbosity = 1;
std::string faillog = "failure.log";
bool isfast = false;
clp.setOption("verb",&verbosity,"How verbose is the output? 1 is normal 10 is a lot.");
clp.setOption("log",&faillog,"File for failure information to go to (also high verbosity text)");
clp.setOption("fast","notfast",&isfast,"Run only fast tests");
clp.parse(argc,argv);
Teuchos::RCP<Teuchos::FancyOStream> termout = Teuchos::getFancyOStream(Teuchos::rcpFromRef(std::cout));
Teuchos::RCP<Teuchos::FancyOStream> failout;
std::ofstream failure;
if(faillog=="stdout") {
failout = termout;
}
else {
failure.open(faillog.c_str());
failout = Teuchos::getFancyOStream(Teuchos::rcpFromRef(failure));
}
termout->setOutputToRootOnly(0);
failout->setOutputToRootOnly(0);
// gdbIn();
Teko_ADD_UNIT_TEST(Teko::Test::tSIMPLEPreconditionerFactory_tpetra,SIMPLEPreconditionerFactory_tpetra);
Teko_ADD_UNIT_TEST(Teko::Test::tDiagonalPreconditionerFactory_tpetra,DiagonalPreconditionerFactory_tpetra);
Teko_ADD_UNIT_TEST(Teko::Test::tLU2x2PreconditionerFactory_tpetra,LU2x2PreconditionerFactory_tpetra);
Teko_ADD_UNIT_TEST(Teko::Test::tLSCStablePreconditionerFactory_tpetra,LSCStablePreconditionerFactory_tpetra);
Teko_ADD_UNIT_TEST(Teko::Test::tLSCStabilized_tpetra,LSCStabilized_tpetra);
Teko_ADD_UNIT_TEST(Teko::Test::tJacobi2x2PreconditionerFactory_tpetra,Jacobi2x2PreconditionerFactory_tpetra);
Teko_ADD_UNIT_TEST(Teko::Test::tBlockJacobiPreconditionerFactory_tpetra,BlockJacobiPreconditionerFactory_tpetra);
Teko_ADD_UNIT_TEST(Teko::Test::tBlockUpperTriInverseOp_tpetra,BlockUpperTriInverseOp_tpetra);
Teko_ADD_UNIT_TEST(Teko::Test::tBlockLowerTriInverseOp_tpetra,BlockLowerTriInverseOp_tpetra);
Teko_ADD_UNIT_TEST(Teko::Test::tTpetraOperatorWrapper,tTpetraOperatorWrapper);
Teko_ADD_UNIT_TEST(Teko::Test::tInterlacedTpetra,InterlacedTpetra);
Teko_ADD_UNIT_TEST(Teko::Test::tBlockingTpetra,BlockingTpetra);
Teko_ADD_UNIT_TEST(Teko::Test::tTpetraThyraConverter,TpetraThyraConverter);
Teko_ADD_UNIT_TEST(Teko::Test::tGraphLaplacian_tpetra,tGraphLaplacian_tpetra);
Teko_ADD_UNIT_TEST(Teko::Test::tParallelInverse_tpetra,tParallelInverse_tpetra);
Teko_ADD_UNIT_TEST(Teko::Test::tExplicitOps_tpetra,tExplicitOps_tpetra);
Teko_ADD_UNIT_TEST(Teko::Test::tLSCHIntegrationTest_tpetra,LSCHIntegrationTest_tpetra);
Teko_ADD_UNIT_TEST(Teko::Test::tLumping_tpetra,Lumping_tpetra);
Teko_ADD_UNIT_TEST(Teko::Test::tAbsRowSum_tpetra,AbsRowSum_tpetra);
Teko_ADD_UNIT_TEST(Teko::Test::tNeumannSeries_tpetra,NeumannSeries_tpetra);
Teko_ADD_UNIT_TEST(Teko::Test::tPCDStrategy_tpetra,PCDStrategy_tpetra);
if(not isfast) {
Teko_ADD_UNIT_TEST(Teko::Test::tLSCIntegrationTest_tpetra,LSCIntegrationTest_tpetra);
Teko_ADD_UNIT_TEST(Teko::Test::tStridedTpetraOperator,tStridedTpetraOperator);
Teko_ADD_UNIT_TEST(Teko::Test::tBlockedTpetraOperator,tBlockedTpetraOperator);
}
status = Teko::Test::UnitTest::RunTests_tpetra(verbosity,*termout,*failout);
if(not status)
*termout << "Teko tests failed" << std::endl;
// release any stored Kokkos memory
Teko::Test::UnitTest::ClearTests();
}
Kokkos::finalize();
return status ? 0 : -1;
}
示例14: main
int main(int argc,char * argv[])
{
typedef panzer::unit_test::CartesianConnManager<int,panzer::Ordinal64> CCM;
typedef panzer::DOFManager<int,panzer::Ordinal64> DOFManager;
using Teuchos::RCP;
using Teuchos::rcp;
Teuchos::GlobalMPISession mpiSession(&argc, &argv);
Kokkos::initialize(argc,argv);
Teuchos::MpiComm<int> comm(MPI_COMM_WORLD);
int np = comm.getSize(); // number of processors
// timings output
std::string timingsFile = "timings.yaml";
// mesh description
int nx = 10, ny = 7, nz = 4;
int px = np, py = 1, pz = 1;
int bx = 1, by = 2, bz = 1;
// parse command line arguments
Teuchos::CommandLineProcessor clp;
clp.setOption("nx",&nx);
clp.setOption("ny",&ny);
clp.setOption("nz",&nz);
clp.setOption("px",&px);
clp.setOption("py",&py);
clp.setOption("pz",&pz);
clp.setOption("timings-file",&timingsFile);
auto cmdResult = clp.parse(argc,argv);
if(cmdResult!=Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL) {
clp.printHelpMessage(argv[0],std::cout);
return -1;
}
// build velocity, temperature and pressure fields
RCP<const panzer::FieldPattern> pattern_U = buildFieldPattern<Intrepid2::Basis_HGRAD_HEX_C2_FEM<PHX::Device::execution_space,double,double>>();
RCP<const panzer::FieldPattern> pattern_P = buildFieldPattern<Intrepid2::Basis_HGRAD_HEX_C1_FEM<PHX::Device::execution_space,double,double>>();
RCP<const panzer::FieldPattern> pattern_T = buildFieldPattern<Intrepid2::Basis_HGRAD_HEX_C1_FEM<PHX::Device::execution_space,double,double>>();
RCP<const panzer::FieldPattern> pattern_B = buildFieldPattern<Intrepid2::Basis_HDIV_HEX_I1_FEM<PHX::Device::execution_space,double,double>>();
RCP<const panzer::FieldPattern> pattern_E = buildFieldPattern<Intrepid2::Basis_HCURL_HEX_I1_FEM<PHX::Device::execution_space,double,double>>();
// repeatedly construct DOFManager timing the buildGlobalUnknowns
for(int repeats=0;repeats<100;repeats++) {
// build the topology
RCP<CCM> connManager = rcp(new CCM);
connManager->initialize(comm,
Teuchos::as<panzer::Ordinal64>(nx),
Teuchos::as<panzer::Ordinal64>(ny),
Teuchos::as<panzer::Ordinal64>(nz),
px,py,pz,bx,by,bz);
// build the dof manager, and assocaite with the topology
RCP<DOFManager> dofManager = rcp(new DOFManager);
dofManager->setConnManager(connManager,*comm.getRawMpiComm());
// add velocity (U) and PRESSURE fields to the MHD element block
dofManager->addField("eblock-0_0_0","UX",pattern_U);
dofManager->addField("eblock-0_0_0","UY",pattern_U);
dofManager->addField("eblock-0_0_0","UZ",pattern_U);
dofManager->addField("eblock-0_0_0","PRESSURE",pattern_P);
dofManager->addField("eblock-0_0_0","B",pattern_B);
dofManager->addField("eblock-0_0_0","E",pattern_E);
// add velocity (U) fields to the solid element block
dofManager->addField("eblock-0_1_0","UX",pattern_U);
dofManager->addField("eblock-0_1_0","UY",pattern_U);
dofManager->addField("eblock-0_1_0","UZ",pattern_U);
// try to get them all synced up
comm.barrier();
{
PANZER_FUNC_TIME_MONITOR("panzer::ScalingTest::buildGlobalUnknowns");
dofManager->buildGlobalUnknowns();
}
}
Teuchos::TimeMonitor::summarize(std::cout,false,true,false);
if ( timingsFile != "" ){
std::ofstream fout(timingsFile.c_str());
Teuchos::RCP<Teuchos::ParameterList> reportParams = parameterList(* (Teuchos::TimeMonitor::getValidReportParameters()));
reportParams->set("Report format", "YAML");
reportParams->set("YAML style", "spacious");
Teuchos::TimeMonitor::report(fout,reportParams);
}
// this confirms the application passes
std::cout << "Scaling test completed" << std::endl;
return 0;
}
示例15: main
int main (int argc, char *argv[]) {
Teuchos::CommandLineProcessor clp;
clp.setDocString("This example program measure the performance of Chol algorithms on Kokkos::Threads execution space.\n");
int nthreads = 1;
clp.setOption("nthreads", &nthreads, "Number of threads");
int max_task_dependence = 10;
clp.setOption("max-task-dependence", &max_task_dependence, "Max number of task dependence");
int team_size = 1;
clp.setOption("team-size", &team_size, "Team size");
int fill_level = 0;
clp.setOption("fill-level", &fill_level, "Fill level");
bool team_interface = true;
clp.setOption("enable-team-interface", "disable-team-interface",
&team_interface, "Flag for team interface");
bool mkl_interface = false;
clp.setOption("enable-mkl-interface", "disable-mkl-interface",
&mkl_interface, "Flag for MKL interface");
int stack_size = 8192;
clp.setOption("stack-size", &stack_size, "Stack size");
bool verbose = false;
clp.setOption("enable-verbose", "disable-verbose", &verbose, "Flag for verbose printing");
string file_input = "test.mtx";
clp.setOption("file-input", &file_input, "Input file (MatrixMarket SPD matrix)");
int treecut = 15;
clp.setOption("treecut", &treecut, "Level to cut tree from bottom");
int minblksize = 0;
clp.setOption("minblksize", &minblksize, "Minimum block size for internal reordering");
int prunecut = 0;
clp.setOption("prunecut", &prunecut, "Leve to prune tree from bottom");
int seed = 0;
clp.setOption("seed", &seed, "Seed for random number generator in graph partition");
int niter = 10;
clp.setOption("niter", &niter, "Number of iterations for testing");
clp.recogniseAllOptions(true);
clp.throwExceptions(false);
Teuchos::CommandLineProcessor::EParseCommandLineReturn r_parse= clp.parse( argc, argv );
if (r_parse == Teuchos::CommandLineProcessor::PARSE_HELP_PRINTED) return 0;
if (r_parse != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL ) return -1;
int r_val = 0;
{
const bool overwrite = true;
const int nshepherds = (team_interface ? nthreads/team_size : nthreads);
const int nworker_per_shepherd = nthreads/nshepherds;
setenv("QT_HWPAR", to_string(nthreads).c_str(), overwrite);
setenv("QT_NUM_SHEPHERDS", to_string(nshepherds).c_str(), overwrite);
setenv("QT_NUM_WORKERS_PER_SHEPHERD", to_string(nworker_per_shepherd).c_str(), overwrite);
setenv("QT_STACK_SIZE", to_string(stack_size).c_str(), overwrite);
exec_space::initialize(nthreads);
exec_space::print_configuration(cout, true);
r_val = exampleCholPerformance
<value_type,ordinal_type,size_type,exec_space,void>
(file_input,
treecut,
minblksize,
prunecut,
seed,
niter,
nthreads,
max_task_dependence,
team_size,
fill_level,
nshepherds,
team_interface,
(nthreads != 1),
mkl_interface,
verbose);
exec_space::finalize();
unsetenv("QT_HWPAR");
unsetenv("QT_NUM_SHEPHERDS");
unsetenv("QT_NUM_WORKERS_PER_SHEPHERD");
unsetenv("QT_STACK_SIZE");
}
return r_val;
}