Commit 31b30dbd authored by Kenneth Moreland's avatar Kenneth Moreland

Update arguments to benchmarks

With the functionality of vtkm::cont::Initialize's argument handling
improved, parse the arguments of benchmarks better.
parent b0303c96
......@@ -569,7 +569,8 @@ struct BenchmarkArrayTransfer
int main(int argc, char* argv[])
{
auto opts = vtkm::cont::InitializeOptions::RequireDevice;
auto opts =
vtkm::cont::InitializeOptions::DefaultAnyDevice | vtkm::cont::InitializeOptions::Strict;
auto config = vtkm::cont::Initialize(argc, argv, opts);
using Benchmarks = vtkm::benchmarking::BenchmarkArrayTransfer;
......
......@@ -578,7 +578,8 @@ public:
int main(int argc, char* argv[])
{
auto opts = vtkm::cont::InitializeOptions::RequireDevice;
auto opts =
vtkm::cont::InitializeOptions::DefaultAnyDevice | vtkm::cont::InitializeOptions::Strict;
auto config = vtkm::cont::Initialize(argc, argv, opts);
try
......
......@@ -178,7 +178,8 @@ struct BenchmarkValueTypeFunctor
int main(int argc, char* argv[])
{
auto opts = vtkm::cont::InitializeOptions::RequireDevice;
auto opts = vtkm::cont::InitializeOptions::RequireDevice |
vtkm::cont::InitializeOptions::ErrorOnBadOption | vtkm::cont::InitializeOptions::AddHelp;
auto config = vtkm::cont::Initialize(argc, argv, opts);
......@@ -186,12 +187,12 @@ int main(int argc, char* argv[])
int numThreads = tbb::task_scheduler_init::automatic;
#endif // TBB
if (config.Arguments.size() == 2)
if (argc == 3)
{
if (std::string(config.Arguments[0]) == "NumThreads")
if (std::string(argv[1]) == "NumThreads")
{
#ifdef VTKM_ENABLE_TBB
std::istringstream parse(config.Arguments[1]);
std::istringstream parse(argv[2]);
parse >> numThreads;
std::cout << "Selected " << numThreads << " TBB threads." << std::endl;
#else
......
This diff is collapsed.
......@@ -931,19 +931,19 @@ public:
int main(int argc, char* argv[])
{
auto opts = vtkm::cont::InitializeOptions::RequireDevice;
auto opts = vtkm::cont::InitializeOptions::DefaultAnyDevice;
auto config = vtkm::cont::Initialize(argc, argv, opts);
int benchmarks = 0;
if (!config.Arguments.size())
if (argc < 2)
{
benchmarks = vtkm::benchmarking::ALL;
}
else
{
for (size_t i = 0; i < config.Arguments.size(); ++i)
for (int i = 1; i < argc; ++i)
{
std::string arg = config.Arguments[i];
std::string arg = argv[i];
std::transform(arg.begin(), arg.end(), arg.begin(), [](char c) {
return static_cast<char>(std::tolower(static_cast<unsigned char>(c)));
});
......@@ -969,7 +969,13 @@ int main(int argc, char* argv[])
}
else
{
std::cout << "Unrecognized benchmark: " << config.Arguments[i] << std::endl;
std::cerr << "Unrecognized benchmark: " << argv[i] << std::endl;
std::cerr << "Usage: " << argv[0] << " [options] [benchmarks]" << std::endl;
std::cerr << "options are:" << std::endl;
std::cerr << config.Usage;
std::cerr << "available benchmarks are:" << std::endl;
std::cerr << " blackscholes, math, fusedmath, interpolate, implicit_function" << std::endl;
std::cerr << "If no benchmarks are specified, all are run." << std::endl;
return 1;
}
}
......
This diff is collapsed.
......@@ -145,7 +145,8 @@ VTKM_MAKE_BENCHMARK(RayTracing, BenchRayTracing);
int main(int argc, char* argv[])
{
auto opts = vtkm::cont::InitializeOptions::RequireDevice;
auto opts =
vtkm::cont::InitializeOptions::DefaultAnyDevice | vtkm::cont::InitializeOptions::Strict;
auto config = vtkm::cont::Initialize(argc, argv, opts);
VTKM_RUN_BENCHMARK(RayTracing, vtkm::ListTagBase<vtkm::Float32>(), config.Device);
......
......@@ -453,19 +453,19 @@ public:
int main(int argc, char* argv[])
{
auto opts = vtkm::cont::InitializeOptions::RequireDevice;
auto opts = vtkm::cont::InitializeOptions::DefaultAnyDevice;
auto config = vtkm::cont::Initialize(argc, argv, opts);
int benchmarks = 0;
if (!config.Arguments.size())
if (argc <= 1)
{
benchmarks = vtkm::benchmarking::ALL;
}
else
{
for (size_t i = 0; i < config.Arguments.size(); ++i)
for (int i = 1; i < argc; ++i)
{
std::string arg = config.Arguments[i];
std::string arg = argv[i];
std::transform(arg.begin(), arg.end(), arg.begin(), [](char c) {
return static_cast<char>(std::tolower(static_cast<unsigned char>(c)));
});
......@@ -483,7 +483,15 @@ int main(int argc, char* argv[])
}
else
{
std::cout << "Unrecognized benchmark: " << config.Arguments[i] << std::endl;
std::cerr << "Unrecognized benchmark: " << argv[i] << std::endl;
std::cerr << "USAGE: " << argv[0] << " [options] [<benchmarks>]" << std::endl;
std::cerr << "Options are: " << std::endl;
std::cerr << config.Usage << std::endl;
std::cerr << "Benchmarks are one or more of the following:" << std::endl;
std::cerr << " CellToPoint\tFind average of point data on each cell" << std::endl;
std::cerr << " PointToCell\tFind average of cell data on each point" << std::endl;
std::cerr << " Classify\tFind Marching Cube case of each cell" << std::endl;
std::cerr << "If no benchmarks are specified, all are run." << std::endl;
return 1;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment