本文整理汇总了C++中teuchos::CommandLineProcessor::throwExceptions方法的典型用法代码示例。如果您正苦于以下问题:C++ CommandLineProcessor::throwExceptions方法的具体用法?C++ CommandLineProcessor::throwExceptions怎么用?C++ CommandLineProcessor::throwExceptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类teuchos::CommandLineProcessor
的用法示例。
在下文中一共展示了CommandLineProcessor::throwExceptions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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
示例2: 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;
}
示例3: 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;
}
示例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");
int mmin = 1000;
clp.setOption("mmin", &mmin, "C(mmin,mmin)");
int mmax = 8000;
clp.setOption("mmax", &mmax, "C(mmax,mmax)");
int minc = 1000;
clp.setOption("minc", &minc, "Increment of m");
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();
host_space::initialize(nthreads, numa, core_per_numa);
r_val = exampleDenseMatrixBase<exec_space>
(mmin, mmax, minc,
verbose);
exec_space::finalize();
host_space::finalize();
}
return r_val;
}
示例5: 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;
}
示例6: 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;
}
示例7: 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");
int nb = nrhs;
clp.setOption("nb", &nb, "Blocksize 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 = exampleTriSolveByBlocks
<value_type,ordinal_type,size_type,exec_space,void>
(file_input, nrhs, nb, 1, max_task_dependence, team_size, verbose);
Kokkos::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 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;
}
示例10: main
int main(int argc, char *argv[]) {
int r_val = 0;
Teuchos::CommandLineProcessor clp;
int nthreads = 1;
clp.setOption("nthreads", &nthreads, "Number of threads");
clp.recogniseAllOptions(true);
clp.throwExceptions(false);
Teuchos::CommandLineProcessor::EParseCommandLineReturn r_parse= clp.parse( argc, argv );
if (r_parse != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL ) {
cout << "Testing Kokkos::Qthread:: Failed in parsing command line input" << endl;
return -1;
}
if (r_parse == Teuchos::CommandLineProcessor::PARSE_HELP_PRINTED) {
return 0;
}
unsigned threads_count = 0;
if (Kokkos::hwloc::available()) {
const unsigned numa_count = Kokkos::hwloc::get_available_numa_count();
const unsigned cores_per_numa = Kokkos::hwloc::get_available_cores_per_numa();
const unsigned threads_per_core = Kokkos::hwloc::get_available_threads_per_core();
const unsigned one = 1u;
threads_count = max(one, numa_count)*max(one, cores_per_numa)*max(one, threads_per_core);
cout << " = Kokkos::hwloc = " << endl
<< "NUMA count = " << numa_count << endl
<< "Cores per NUMA = " << cores_per_numa << endl
<< "Threads per core = " << threads_per_core << endl
<< "Threads count = " << threads_count << endl;
} else {
threads_count = thread::hardware_concurrency();
cout << " = std::thread::hardware_concurrency = " << endl
<< "Threads count = " << threads_count << endl;
}
if (static_cast<unsigned int>(nthreads) > threads_count) {
++r_val;
cout << "Testing Kokkos::Threads:: Failed that the given nthreads is greater than the number of threads counted" << endl;
} else {
Kokkos::Threads::initialize( nthreads );
Kokkos::Threads::print_configuration( cout , true /* detailed */ );
//__TestSuiteDoUnitTests__(float,int,unsigned int,Kokkos::Serial,void);
//__TestSuiteDoUnitTests__(float,long,unsigned long,Kokkos::Serial,void);
__TestSuiteDoUnitTests__(double,int,unsigned int,Kokkos::Threads,void);
// __TestSuiteDoUnitTests__(double,long,unsigned long,Kokkos::Serial,void);
// __TestSuiteDoUnitTests__(complex<float>,int,unsigned int,Kokkos::Serial,void);
// __TestSuiteDoUnitTests__(complex<float>,long,unsigned long,Kokkos::Serial,void);
// __TestSuiteDoUnitTests__(complex<double>,int,unsigned int,Kokkos::Serial,void);
// __TestSuiteDoUnitTests__(complex<double>,long,unsigned long,Kokkos::Serial,void);
Kokkos::Threads::finalize();
}
string eval;
__EVAL_STRING__(r_val, eval);
cout << "Testing Kokkos::Threads::" << eval << endl;
return r_val;
}
示例11: main
int main (int argc, char *argv[]) {
Teuchos::CommandLineProcessor clp;
clp.setDocString("This example program measure the performance of dense Herk 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 max_concurrency = 250000;
clp.setOption("max-concurrency", &max_concurrency, "Max number of concurrent tasks");
int memory_pool_grain_size = 16;
clp.setOption("memory-pool-grain-size", &memory_pool_grain_size, "Memorypool chunk size (12 - 16)");
int mkl_nthreads = 1;
clp.setOption("mkl-nthreads", &mkl_nthreads, "MKL threads for nested parallelism");
bool verbose = false;
clp.setOption("enable-verbose", "disable-verbose", &verbose, "Flag for verbose printing");
int mmin = 1000;
clp.setOption("mmin", &mmin, "C(mmin,mmin)");
int mmax = 8000;
clp.setOption("mmax", &mmax, "C(mmax,mmax)");
int minc = 1000;
clp.setOption("minc", &minc, "Increment of m");
int k = 1024;
clp.setOption("k", &k, "A(mmax,k) or A(k,mmax) according to transpose flags");
int mb = 256;
clp.setOption("mb", &mb, "Blocksize");
bool check = true;
clp.setOption("enable-check", "disable-check", &check, "Flag for check solution");
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);
std::cout << std::endl << "DenseHerkByBlocks:: Upper, ConjTranspose, Variant::One (external)" << std::endl;
r_val = exampleDenseHerkByBlocks
<Uplo::Upper,Trans::ConjTranspose,Variant::One,exec_space>
(mmin, mmax, minc, k, mb,
max_concurrency, memory_pool_grain_size, mkl_nthreads,
check,
verbose);
exec_space::finalize();
}
return r_val;
}
示例12: main
//.........这里部分代码省略.........
"\t\t\tread-encode-sync : Read data through the RPC result - synchronous\n"
"\t\t\tread-encode-async: Read data through the RPC result - asynchronous\n"
"\t\t\tread-rdma-sync : Read data using RDMA (server puts) - synchronous\n"
"\t\t\tread-rdma-async: Read data using RDMA (server puts) - asynchronous");
// Set an enumeration command line option for the NNTI transport
parser.setOption("transport", &transport_index, num_nssi_transports, nssi_transport_vals, nssi_transport_names,
"NSSI transports (not all are available on every platform): \n"
"\t\t\tportals|ptl : Cray or Schutt\n"
"\t\t\tinfiniband|ib : libibverbs\n"
"\t\t\tgemini|gni : Cray libugni (Gemini or Aries)\n"
"\t\t\tbgpdcmf|dcmf : IBM BG/P DCMF\n"
"\t\t\tbgqpami|pami : IBM BG/Q PAMI\n"
"\t\t\tmpi : isend/irecv implementation\n"
);
/* There are also two methods that control the behavior of the
command line processor. First, for the command line processor to
allow an unrecognized a command line option to be ignored (and
only have a warning printed), use:
*/
parser.recogniseAllOptions(true);
/* Second, by default, if the parser finds a command line option it
doesn't recognize or finds the --help option, it will throw an
std::exception. If you want prevent a command line processor from
throwing an std::exception (which is important in this program since
we don't have an try/catch around this) when it encounters a
unrecognized option or help is printed, use:
*/
parser.throwExceptions(false);
/* We now parse the command line where argc and argv are passed to
the parse method. Note that since we have turned off std::exception
throwing above we had better grab the return argument so that
we can see what happened and act accordingly.
*/
Teuchos::CommandLineProcessor::EParseCommandLineReturn parseReturn= parser.parse( argc, argv );
if( parseReturn == Teuchos::CommandLineProcessor::PARSE_HELP_PRINTED ) {
return 0;
}
if( parseReturn != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL ) {
return 1; // Error!
}
// Here is where you would use these command line arguments but for this example program
// we will just print the help message with the new values of the command-line arguments.
//if (rank == 0)
// out << "\nPrinting help message with new values of command-line arguments ...\n\n";
//parser.printHelpMessage(argv[0],out);
}
TEUCHOS_STANDARD_CATCH_STATEMENTS(true,std::cerr,success);
log_debug(args.debug_level, "transport_index=%d", transport_index);
if (transport_index > -1) {
args.transport =nssi_transport_list[transport_index];
args.transport_name=std::string(nssi_transport_names[transport_index]);
示例13: main
int main(int argc, char * argv[])
{
using Teuchos::RCP;
using Teuchos::rcp;
using Teuchos::rcpFromRef;
Teuchos::GlobalMPISession mpiSession(&argc,&argv,&std::cout);
std::string output_file_name = "square_mesh.gen";
int xBlocks=1,yBlocks=1, zBlocks=1;
int xElements=1,yElements=1, zElements=1;
double x0=0.0, xf=1.0;
double y0=0.0, yf=1.0;
double z0=0.0, zf=1.0;
bool threeD = false;
// setup input arguments
{
Teuchos::CommandLineProcessor clp;
clp.throwExceptions(false);
clp.setOption("o", &output_file_name, "Mesh output filename");
clp.setOption("3d", "2d", &threeD, "Cube versus square mesh.");
clp.setOption("x-blocks", &xBlocks, "Number of blocks in 'x' direction");
clp.setOption("y-blocks", &yBlocks, "Number of blocks in 'y' direction");
clp.setOption("z-blocks", &zBlocks, "Number of blocks in 'z' direction");
clp.setOption("x-elmts", &xElements, "Number of elements in 'x' direction in each block");
clp.setOption("y-elmts", &yElements, "Number of elements in 'y' direction in each block");
clp.setOption("z-elmts", &zElements, "Number of elements in 'z' direction in each block");
clp.setOption("x0", &x0, "Location of left edge");
clp.setOption("xf", &xf, "Location of right edge");
clp.setOption("y0", &y0, "Location of left edge");
clp.setOption("yf", &yf, "Location of right edge");
clp.setOption("z0", &z0, "Location of front(?) edge");
clp.setOption("zf", &zf, "Location of back(?) edge");
Teuchos::CommandLineProcessor::EParseCommandLineReturn parse_return = clp.parse(argc,argv,&std::cerr);
if(parse_return==Teuchos::CommandLineProcessor::PARSE_HELP_PRINTED)
return -1;
TEUCHOS_TEST_FOR_EXCEPTION(parse_return != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL,
std::runtime_error, "Failed to parse command line!");
}
RCP<Teuchos::ParameterList> pl = rcp(new Teuchos::ParameterList);
pl->set("X Blocks",xBlocks);
pl->set("Y Blocks",yBlocks);
pl->set("X Elements",xElements);
pl->set("Y Elements",yElements);
pl->set("X0",x0);
pl->set("Y0",y0);
pl->set("Xf",xf);
pl->set("Yf",yf);
if(threeD) {
pl->set("Z Blocks",zBlocks);
pl->set("Z Elements",zElements);
pl->set("Z0",z0);
pl->set("Zf",zf);
}
int numprocs = stk_classic::parallel_machine_size(MPI_COMM_WORLD);
int rank = stk_classic::parallel_machine_rank(MPI_COMM_WORLD);
RCP<panzer_stk_classic::STK_MeshFactory> factory;
if(!threeD)
factory = Teuchos::rcp(new panzer_stk_classic::SquareQuadMeshFactory);
else
factory = Teuchos::rcp(new panzer_stk_classic::CubeHexMeshFactory);
factory->setParameterList(pl);
RCP<panzer_stk_classic::STK_Interface> mesh = factory->buildMesh(MPI_COMM_WORLD);
mesh->writeToExodus(output_file_name);
return 0;
}
示例14: 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");
int max_concurrency = 250000;
clp.setOption("max-concurrency", &max_concurrency, "Max number of concurrent tasks");
int max_task_dependence = 3;
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 nrhs = 1;
clp.setOption("nrhs", &team_size, "# of right hand side");
int mb = 0;
clp.setOption("mb", &mb, "Dense nested blocks size");
int nb = 1;
clp.setOption("nb", &nb, "Column block size 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);
#if (defined(HAVE_SHYLUTACHO_SCOTCH) && defined(HAVE_SHYLUTACHO_CHOLMOD))
r_val = exampleCholSuperNodesByBlocks<exec_space>
(file_input,
treecut, prunecut, fill_level, rows_per_team,
max_concurrency, max_task_dependence, team_size,
nrhs, mb, nb,
verbose);
#else
r_val = -1;
std::cout << "Scotch or Cholmod is NOT configured in Trilinos" << std::endl;
#endif
exec_space::finalize();
}
return r_val;
}
示例15: main
//.........这里部分代码省略.........
"\t\t\tget-sync : Servers pull data from client - synchronous\n"
"\t\t\tget-async: Servers pull data from client - asynchronous\n"
"\t\t\tput-sync : Servers push data from client - synchronous\n"
"\t\t\tput-async: Servers push data from client - asynchronous"
);
// Set an enumeration command line option for the NNTI transport
parser.setOption("transport", &transport_index, num_nssi_transports, nssi_transport_vals, nssi_transport_names,
"NSSI transports (not all are available on every platform): \n"
"\t\t\tportals|ptl : Cray or Schutt\n"
"\t\t\tinfiniband|ib : libibverbs\n"
"\t\t\tgemini|gni : Cray libugni (Gemini or Aries)\n"
"\t\t\tbgpdcmf|dcmf : IBM BG/P DCMF\n"
"\t\t\tbgqpami|pami : IBM BG/Q PAMI\n"
"\t\t\tmpi : isend/irecv implementation\n"
);
/* There are also two methods that control the behavior of the
command line processor. First, for the command line processor to
allow an unrecognized a command line option to be ignored (and
only have a warning printed), use:
*/
parser.recogniseAllOptions(true);
/* Second, by default, if the parser finds a command line option it
doesn't recognize or finds the --help option, it will throw an
std::exception. If you want prevent a command line processor from
throwing an std::exception (which is important in this program since
we don't have an try/catch around this) when it encounters a
unrecognized option or help is printed, use:
*/
parser.throwExceptions(false);
/* We now parse the command line where argc and argv are passed to
the parse method. Note that since we have turned off std::exception
throwing above we had better grab the return argument so that
we can see what happened and act accordingly.
*/
Teuchos::CommandLineProcessor::EParseCommandLineReturn parseReturn= parser.parse( argc, argv );
if( parseReturn == Teuchos::CommandLineProcessor::PARSE_HELP_PRINTED ) {
return 0;
}
if( parseReturn != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL ) {
return 1; // Error!
}
// Here is where you would use these command line arguments but for this example program
// we will just print the help message with the new values of the command-line arguments.
//if (rank == 0)
// out << "\nPrinting help message with new values of command-line arguments ...\n\n";
//parser.printHelpMessage(argv[0],out);
}
TEUCHOS_STANDARD_CATCH_STATEMENTS(true,std::cerr,success);
log_debug(LOG_ALL, "transport_index=%d", transport_index);
if (transport_index > -1) {
args.transport =nssi_transport_list[transport_index];
args.transport_name=std::string(nssi_transport_names[transport_index]);