本文整理汇总了C++中teuchos::CommandLineProcessor::setDocString方法的典型用法代码示例。如果您正苦于以下问题:C++ CommandLineProcessor::setDocString方法的具体用法?C++ CommandLineProcessor::setDocString怎么用?C++ CommandLineProcessor::setDocString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类teuchos::CommandLineProcessor
的用法示例。
在下文中一共展示了CommandLineProcessor::setDocString方法的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");
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 = exampleGraphTools<exec_space>
(file_input, treecut, prunecut, verbose);
#else
r_val = -1;
std::cout << "Scotch or Cholmod is NOT configured in Trilinos" << std::endl;
#endif
exec_space::finalize();
}
return r_val;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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 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 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;
{
exec_space::initialize(nthreads);
exec_space::print_configuration(cout, true);
r_val = exampleTriSolveByBlocks
<value_type,ordinal_type,size_type,exec_space,void>
(file_input, nrhs, nb, nthreads, max_task_dependence, team_size, verbose);
exec_space::finalize();
}
return r_val;
}
示例5: 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;
}
示例6: 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;
}
示例7: main
int main(int argc, char *argv[])
{
bool success = true;
bool verbose = false;
try {
Teuchos::oblackholestream blackHole;
Teuchos::GlobalMPISession mpiSession (&argc, &argv, &blackHole);
Teuchos::RCP<const Teuchos::Comm<int> > comm =
Teuchos::DefaultComm<int>::getComm();
const size_t num_sockets = Kokkos::hwloc::get_available_numa_count();
const size_t num_cores_per_socket =
Kokkos::hwloc::get_available_cores_per_numa();
const size_t num_threads_per_core =
Kokkos::hwloc::get_available_threads_per_core();
// Setup command line options
Teuchos::CommandLineProcessor CLP;
CLP.setDocString(
"This test performance of MP::Vector FEM assembly.\n");
int nGrid = 32;
CLP.setOption("n", &nGrid, "Number of mesh points in the each direction");
int nIter = 10;
CLP.setOption("ni", &nIter, "Number of assembly iterations");
bool print = false;
CLP.setOption("print", "no-print", &print, "Print debugging output");
bool check = false;
int num_cores = num_cores_per_socket * num_sockets;
CLP.setOption("cores", &num_cores,
"Number of CPU cores to use (defaults to all)");
int num_hyper_threads = num_threads_per_core;
CLP.setOption("hyperthreads", &num_hyper_threads,
"Number of hyper threads per core to use (defaults to all)");
int threads_per_vector = 1;
CLP.setOption("threads_per_vector", &threads_per_vector,
"Number of threads to use within each vector");
CLP.setOption("check", "no-check", &check, "Check correctness");
#ifdef KOKKOS_HAVE_SERIAL
bool serial = true;
CLP.setOption("serial", "no-serial", &serial, "Enable Serial device");
#endif
#ifdef KOKKOS_HAVE_PTHREAD
bool threads = true;
CLP.setOption("threads", "no-threads", &threads, "Enable Threads device");
#endif
#ifdef KOKKOS_HAVE_OPENMP
bool openmp = true;
CLP.setOption("openmp", "no-openmp", &openmp, "Enable OpenMP device");
#endif
#ifdef KOKKOS_HAVE_CUDA
bool cuda = true;
CLP.setOption("cuda", "no-cuda", &cuda, "Enable Cuda device");
int cuda_threads_per_vector = 16;
CLP.setOption("cuda_threads_per_vector", &cuda_threads_per_vector,
"Number of Cuda threads to use within each vector");
int cuda_block_size = 256;
CLP.setOption("cuda_block_size", &cuda_block_size,
"Cuda block size");
int num_cuda_blocks = 0;
CLP.setOption("num_cuda_blocks", &num_cuda_blocks,
"Number of Cuda blocks (0 implies the default choice)");
int device_id = -1;
CLP.setOption("device", &device_id, "CUDA device ID. Set to default of -1 to use the default device as determined by the local node MPI rank and --ngpus");
int ngpus = 1;
CLP.setOption("ngpus", &ngpus, "Number of GPUs per node for multi-GPU runs via MPI");
#endif
CLP.parse( argc, argv );
int use_nodes[3];
use_nodes[0] = nGrid; use_nodes[1] = nGrid; use_nodes[2] = nGrid;
typedef int Ordinal;
typedef double Scalar;
const Kokkos::Example::FENL::AssemblyMethod Method =
Kokkos::Example::FENL::FadElementOptimized;
// const Kokkos::Example::FENL::AssemblyMethod Method =
// Kokkos::Example::FENL::Analytic;
#ifdef KOKKOS_HAVE_SERIAL
if (serial) {
typedef Kokkos::Serial Device;
typedef Stokhos::StaticFixedStorage<Ordinal,Scalar,1,Device> Storage;
Kokkos::Serial::initialize();
if (comm->getRank() == 0)
std::cout << std::endl
<< "Serial performance with " << comm->getSize()
<< " MPI ranks" << std::endl;
Kokkos::Example::FENL::DeviceConfig dev_config(1, 1, 1);
mainHost<Storage,Method>(comm, print, nIter, use_nodes, check,
dev_config);
Kokkos::Serial::finalize();
}
#endif
//.........这里部分代码省略.........
示例8: main
//.........这里部分代码省略.........
args.num_trials = 1;
args.num_reqs = 1;
args.result_file_mode = "a";
args.result_file = "";
args.url_file = "";
args.logfile = "";
args.client_flag = true;
args.server_flag = true;
args.num_servers = 1;
args.num_threads = 0;
args.timeout = 500;
args.num_retries = 5;
args.validate_flag = true;
args.kill_server_flag = true;
args.block_distribution = true;
bool success = true;
/**
* We make extensive use of the \ref Teuchos::CommandLineProcessor for command-line
* options to control the behavior of the test code. To evaluate performance,
* the "num-trials", "num-reqs", and "len" options control the amount of data transferred
* between client and server. The "io-method" selects the type of data transfer. The
* server-url specifies the URL of the server. If running as a server, the server-url
* provides a recommended URL when initializing the network transport.
*/
try {
//out << Teuchos::Teuchos_Version() << std::endl << std::endl;
// Creating an empty command line processor looks like:
Teuchos::CommandLineProcessor parser;
parser.setDocString(
"This example program demonstrates a simple data-transfer service "
"built using the NEtwork Scalable Service Interface (Nessie)."
);
/* To set and option, it must be given a name and default value. Additionally,
each option can be given a help std::string. Although it is not necessary, a help
std::string aids a users comprehension of the acceptable command line arguments.
Some examples of setting command line options are:
*/
parser.setOption("delay", &args.delay, "time(s) for client to wait for server to start" );
parser.setOption("timeout", &args.timeout, "time(ms) to wait for server to respond" );
parser.setOption("server", "no-server", &args.server_flag, "Run the server" );
parser.setOption("client", "no-client", &args.client_flag, "Run the client");
parser.setOption("len", &args.len, "The number of structures in an input buffer");
parser.setOption("debug",(int*)(&args.debug_level), "Debug level");
parser.setOption("logfile", &args.logfile, "log file");
parser.setOption("num-trials", &args.num_trials, "Number of trials (experiments)");
parser.setOption("num-reqs", &args.num_reqs, "Number of reqs/trial");
parser.setOption("result-file", &args.result_file, "Where to store results");
parser.setOption("result-file-mode", &args.result_file_mode, "Write mode for the result");
parser.setOption("server-url-file", &args.url_file, "File that has URL client uses to find server");
parser.setOption("validate", "no-validate", &args.validate_flag, "Validate the data");
parser.setOption("num-servers", &args.num_servers, "Number of server processes");
parser.setOption("num-threads", &args.num_threads, "Number of threads used by each server process");
parser.setOption("kill-server", "no-kill-server", &args.kill_server_flag, "Kill the server at the end of the experiment");
parser.setOption("block-distribution", "rr-distribution", &args.block_distribution,
"Use a block distribution scheme to assign clients to servers");
// Set an enumeration command line option for the io_method
parser.setOption("io-method", &args.io_method, num_io_methods, io_method_vals, io_method_names,
"I/O Methods for the example: \n"
示例9: main
int main(int argc, char *argv[])
{
bool success = true;
bool verbose = false;
try {
const size_t num_sockets = Kokkos::hwloc::get_available_numa_count();
const size_t num_cores_per_socket =
Kokkos::hwloc::get_available_cores_per_numa();
const size_t num_threads_per_core =
Kokkos::hwloc::get_available_threads_per_core();
// Setup command line options
Teuchos::CommandLineProcessor CLP;
CLP.setDocString(
"This test performance of MP::Vector multiply routines.\n");
int nGrid = 32;
CLP.setOption("n", &nGrid, "Number of mesh points in the each direction");
int nIter = 10;
CLP.setOption("ni", &nIter, "Number of multiply iterations");
#ifdef KOKKOS_HAVE_PTHREAD
bool threads = true;
CLP.setOption("threads", "no-threads", &threads, "Enable Threads device");
int num_cores = num_cores_per_socket * num_sockets;
CLP.setOption("cores", &num_cores,
"Number of CPU cores to use (defaults to all)");
int num_hyper_threads = num_threads_per_core;
CLP.setOption("hyperthreads", &num_hyper_threads,
"Number of hyper threads per core to use (defaults to all)");
int threads_per_vector = 1;
CLP.setOption("threads_per_vector", &threads_per_vector,
"Number of threads to use within each vector");
#endif
#ifdef KOKKOS_HAVE_CUDA
bool cuda = true;
CLP.setOption("cuda", "no-cuda", &cuda, "Enable Cuda device");
int cuda_threads_per_vector = 16;
CLP.setOption("cuda_threads_per_vector", &cuda_threads_per_vector,
"Number of Cuda threads to use within each vector");
int cuda_block_size = 0;
CLP.setOption("cuda_block_size", &cuda_block_size,
"Cuda block size (0 implies the default choice)");
int num_cuda_blocks = 0;
CLP.setOption("num_cuda_blocks", &num_cuda_blocks,
"Number of Cuda blocks (0 implies the default choice)");
int device_id = 0;
CLP.setOption("device", &device_id, "CUDA device ID");
#endif
CLP.parse( argc, argv );
typedef int Ordinal;
typedef double Scalar;
#ifdef KOKKOS_HAVE_PTHREAD
if (threads) {
typedef Kokkos::Threads Device;
typedef Stokhos::StaticFixedStorage<Ordinal,Scalar,1,Device> Storage;
Kokkos::Threads::initialize(num_cores*num_hyper_threads);
std::cout << std::endl
<< "Threads performance with " << num_cores*num_hyper_threads
<< " threads:" << std::endl;
Kokkos::DeviceConfig dev_config(num_cores,
threads_per_vector,
num_hyper_threads / threads_per_vector);
mainHost<Storage>(nGrid, nIter, dev_config);
Kokkos::Threads::finalize();
}
#endif
#ifdef KOKKOS_HAVE_CUDA
if (cuda) {
typedef Kokkos::Cuda Device;
typedef Stokhos::StaticFixedStorage<Ordinal,Scalar,1,Device> Storage;
Kokkos::Cuda::host_mirror_device_type::initialize();
Kokkos::Cuda::initialize(Kokkos::Cuda::SelectDevice(device_id));
cudaDeviceProp deviceProp;
cudaGetDeviceProperties(&deviceProp, device_id);
std::cout << std::endl
<< "CUDA performance for device " << device_id << " ("
<< deviceProp.name << "):"
<< std::endl;
Kokkos::DeviceConfig dev_config(
num_cuda_blocks,
cuda_threads_per_vector,
cuda_threads_per_vector == 0 ? 0 : cuda_block_size / cuda_threads_per_vector);
mainCuda<Storage>(nGrid,nIter,dev_config);
Kokkos::Cuda::host_mirror_device_type::finalize();
Kokkos::Cuda::finalize();
}
#endif
//.........这里部分代码省略.........
示例10: 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 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);
exec_space::initialize(nthreads);
exec_space::print_configuration(cout, true);
// r_val = exampleICholPerformance
// <value_type,ordinal_type,size_type,exec_space,void>
// (file_input, niter, nthreads, max_task_dependence, team_size, team_interface, (nthreads != 1), verbose);
exec_space::finalize();
unsetenv("QT_HWPAR");
unsetenv("QT_NUM_SHEPHERDS");
unsetenv("QT_NUM_WORKERS_PER_SHEPHERD");
}
return r_val;
}
示例11: cmdLineProc
/// \brief Parse command-line options for this test
///
/// \param argc [in] As usual in C(++)
/// \param argv [in] As usual in C(++)
/// \param allowedToPrint [in] Whether this (MPI) process is allowed
/// to print to stdout/stderr. Different per (MPI) process.
/// \param printedHelp [out] Whether this (MPI) process printed the
/// "help" display (summary of command-line options)
///
/// \return Encapsulation of command-line options
static DistTsqrTestParameters
parseOptions (int argc,
char* argv[],
const bool allowedToPrint,
bool& printedHelp)
{
using std::cerr;
using std::endl;
printedHelp = false;
// Command-line parameters, set to their default values.
DistTsqrTestParameters params;
try {
Teuchos::CommandLineProcessor cmdLineProc (/* throwExceptions=*/ true,
/* recognizeAllOptions=*/ true);
cmdLineProc.setDocString (docString);
cmdLineProc.setOption ("verify",
"noverify",
¶ms.verify,
"Test accuracy");
cmdLineProc.setOption ("benchmark",
"nobenchmark",
¶ms.benchmark,
"Test performance");
cmdLineProc.setOption ("implicit",
"noimplicit",
¶ms.testFactorImplicit,
"Test DistTsqr\'s factor() and explicit_Q()");
cmdLineProc.setOption ("explicit",
"noexplicit",
¶ms.testFactorExplicit,
"Test DistTsqr\'s factorExplicit()");
cmdLineProc.setOption ("print-matrices",
"no-print-matrices",
¶ms.printMatrices,
"Print global test matrices and computed results to stderr");
cmdLineProc.setOption ("debug",
"nodebug",
¶ms.debug,
"Print debugging information");
cmdLineProc.setOption ("human-readable",
"machine-readable",
¶ms.humanReadable,
"If set, make output easy to read by humans "
"(but hard to parse)");
cmdLineProc.setOption ("ncols",
¶ms.numCols,
"Number of columns in the test matrix");
cmdLineProc.setOption ("ntrials",
¶ms.numTrials,
"Number of trials (only used when \"--benchmark\"");
cmdLineProc.setOption ("real",
"noreal",
¶ms.testReal,
"Test real arithmetic routines");
#ifdef HAVE_TSQR_COMPLEX
cmdLineProc.setOption ("complex",
"nocomplex",
¶ms.testComplex,
"Test complex arithmetic routines");
#endif // HAVE_TSQR_COMPLEX
cmdLineProc.parse (argc, argv);
}
catch (Teuchos::CommandLineProcessor::UnrecognizedOption& e) {
if (allowedToPrint)
cerr << "Unrecognized command-line option: " << e.what() << endl;
throw e;
}
catch (Teuchos::CommandLineProcessor::HelpPrinted& e) {
printedHelp = true;
}
// Validate command-line options. We provide default values
// for unset options, so we don't have to validate those.
if (params.numCols <= 0)
throw std::invalid_argument ("Number of columns must be positive");
else if (params.benchmark && params.numTrials < 1)
throw std::invalid_argument ("\"--benchmark\" option requires numTrials >= 1");
return params;
}
示例12: main
int main(int argc, char **argv)
{
try {
// Setup command line options
Teuchos::CommandLineProcessor CLP;
CLP.setDocString(
"This example generates partitions the Cijk tensor for a lexicographic tree basis.\n");
int d = 3;
CLP.setOption("dimension", &d, "Stochastic dimension");
int p = 5;
CLP.setOption("order", &p, "Polynomial order");
double drop = 1.0e-12;
CLP.setOption("drop", &drop, "Drop tolerance");
bool symmetric = true;
CLP.setOption("symmetric", "asymmetric", &symmetric, "Use basis polynomials with symmetric PDF");
int level = 1;
CLP.setOption("level", &level, "Level to partition");
bool save_3tensor = false;
CLP.setOption("save_3tensor", "no-save_3tensor", &save_3tensor,
"Save full 3tensor to file");
std::string file_3tensor = "Cijk.dat";
CLP.setOption("filename_3tensor", &file_3tensor,
"Filename to store full 3-tensor");
// Parse arguments
CLP.parse( argc, argv );
// Basis
Array< RCP<const Stokhos::OneDOrthogPolyBasis<int,double> > > bases(d);
const double alpha = 1.0;
const double beta = symmetric ? 1.0 : 2.0 ;
for (int i=0; i<d; i++) {
bases[i] = Teuchos::rcp(new Stokhos::JacobiBasis<int,double>(
p, alpha, beta, true));
}
typedef Stokhos::LexographicLess< Stokhos::MultiIndex<int> > less_type;
typedef Stokhos::TotalOrderBasis<int,double,less_type> basis_type;
RCP<const basis_type> basis = Teuchos::rcp(new basis_type(bases, drop));
// Build LTB Cijk
typedef Stokhos::LTBSparse3Tensor<int,double> Cijk_LTB_type;
typedef Cijk_LTB_type::CijkNode node_type;
Teuchos::RCP<Cijk_LTB_type> Cijk =
computeTripleProductTensorLTB(*basis, symmetric);
int sz = basis->size();
std::cout << "basis size = " << sz
<< " num nonzero Cijk entries = " << Cijk->num_entries()
<< std::endl;
// Setup partitions
Teuchos::Array< Teuchos::RCP<const node_type> > node_stack;
Teuchos::Array< int > index_stack;
node_stack.push_back(Cijk->getHeadNode());
index_stack.push_back(0);
Teuchos::RCP<const node_type> node;
int child_index;
Teuchos::Array< Teuchos::RCP<const node_type> > partition_stack;
int my_level = 0;
while (node_stack.size() > 0) {
node = node_stack.back();
child_index = index_stack.back();
// Leaf -- If we got here, just push this node into the partitions
if (node->is_leaf) {
partition_stack.push_back(node);
node_stack.pop_back();
index_stack.pop_back();
--my_level;
}
// Put nodes into partition if level matches
else if (my_level == level) {
partition_stack.push_back(node);
node_stack.pop_back();
index_stack.pop_back();
--my_level;
}
// More children to process -- process them first
else if (child_index < node->children.size()) {
++index_stack.back();
node = node->children[child_index];
node_stack.push_back(node);
index_stack.push_back(0);
++my_level;
}
// No more children
else {
node_stack.pop_back();
index_stack.pop_back();
--my_level;
}
}
// Print statistics
int max_i_size = 0, max_j_size = 0, max_k_size = 0;
//.........这里部分代码省略.........
示例13: logfile
int
main (int argc, char *argv[])
{
int rc;
// command-line arguments
int retries = 0;
int sig = 0;
int timeout = 1000;
log_level debug_level = LOG_ERROR;
string logfile("");
nssi_service svc;
char my_url[NSSI_URL_LEN];
std::string server_url("");
char server_str[NSSI_URL_LEN];
std::string contact_file(""); /* the file where the server's url should be written */
try {
Teuchos::CommandLineProcessor parser;
// init parser
parser.setDocString("Kill an NSSI server");
parser.setOption("verbose", (int *)(&debug_level), "Debug level.");
parser.setOption("logfile", &logfile, "Path to file for debug statements");
parser.setOption("server-url", &server_url, "URL of NSSI service");
parser.setOption("contact-file", &contact_file, "Where to read the server's URL");
parser.setOption("timeout", &timeout, "Timout for contacting services (ms)");
parser.setOption("retries", &retries, "Number of times to retry before exiting");
parser.setOption("sig", &sig, "Signal to use for the kill command");
parser.recogniseAllOptions();
parser.throwExceptions();
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!
}
}
catch (...) {
exit(-1);
}
/* initialize the logger */
logger_init(debug_level, logfile.c_str());
if (server_url.c_str()[0]=='\0') {
sleep(1);
log_debug(debug_level, "reading URL from file");
read_contact_info(contact_file.c_str(), server_str, NSSI_URL_LEN);
} else {
log_debug(debug_level, "using URL from command-line");
strcpy(server_str, server_url.c_str());
}
nssi_rpc_init(NSSI_DEFAULT_TRANSPORT, NSSI_DEFAULT_ENCODE, NULL);
nssi_get_url(NSSI_DEFAULT_TRANSPORT, my_url, NSSI_URL_LEN);
// sleep(1);
log_info(debug_level, "\nTrying to get service at %s", server_str);
rc=nssi_get_service(NSSI_DEFAULT_TRANSPORT, server_str, timeout, &svc);
if (rc != NSSI_OK) {
log_error(admin_debug_level, "could not get svc description: %s",
nssi_err_str(rc));
return rc;
}
rc = kill_svc(&svc, sig, timeout);
if (rc == NSSI_ETIMEDOUT) {
fprintf(stderr, "Timed out trying to kill (%s)\n",
server_url.c_str());
return rc;
}
else if (rc != NSSI_OK) {
log_error(admin_debug_level, "failed to kill service: %s",
nssi_err_str(rc));
return rc;
}
nssi_rpc_fini(NSSI_DEFAULT_TRANSPORT);
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
int main (int argc, char *argv[]) {
Teuchos::CommandLineProcessor clp;
clp.setDocString("This example program show blockwise information on Kokkos::Serial execution space.\n");
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 fill_level = 0;
clp.setOption("fill-level", &fill_level, "Fill level");
int league_size = 1;
clp.setOption("league-size", &league_size, "League size");
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, "Level to prune the tree from bottom");
int seed = 0;
clp.setOption("seed", &seed, "Seed for random number generator in graph partition");
int histogram_size = 0;
clp.setOption("histogram-size", &histogram_size, "Histogram 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;
{
Kokkos::initialize();
r_val = exampleStatByBlocks
<value_type,ordinal_type,size_type,exec_space,void>
(file_input,
treecut,
minblksize,
prunecut,
seed,
fill_level,
league_size,
histogram_size,
verbose);
Kokkos::finalize();
}
return r_val;
}