Initial commit
This commit is contained in:
Executable
+63
@@ -0,0 +1,63 @@
|
||||
long N = 2000;
|
||||
long iterMax = 100;
|
||||
long chunksize = -1;
|
||||
bool isHelp = false;
|
||||
bool disableCheck = false;
|
||||
boost::program_options::options_description opts("Wavefront Options");
|
||||
opts.add_options()
|
||||
("help", "Print help message.")
|
||||
("itermax", boost::program_options::value<long>(), "Iteration count.")
|
||||
("n", boost::program_options::value<long>(), "Array size (n+1 x n+1).")
|
||||
("chunksize", boost::program_options::value<long>(), "Chunk size.")
|
||||
("disable-check", "Don't check for correctness.");
|
||||
boost::program_options::variables_map vm;
|
||||
auto parsed = boost::program_options::command_line_parser(argc, argv).options(opts).allow_unregistered().run();
|
||||
boost::program_options::store(parsed, vm);
|
||||
boost::program_options::notify(vm);
|
||||
if (vm.count("help")) {
|
||||
std::cerr << opts << std::endl;
|
||||
isHelp = true;
|
||||
} else {
|
||||
if (vm.count("itermax")) {
|
||||
iterMax = vm["itermax"].as<long>();
|
||||
}
|
||||
if (vm.count("n")) {
|
||||
N = vm["n"].as<long>();
|
||||
}
|
||||
if (vm.count("chunksize")) {
|
||||
chunksize = vm["chunksize"].as<long>();
|
||||
}
|
||||
if (vm.count("disable-check")) {
|
||||
disableCheck = true;
|
||||
}
|
||||
}
|
||||
long _2N2 = 2*N-2;
|
||||
if (chunksize <= 0) {
|
||||
chunksize = (_2N2/8)+1;
|
||||
}
|
||||
if (!isHelp) {
|
||||
std::cerr << "itermax = " << iterMax << std::endl;
|
||||
std::cerr << "N = " << N << std::endl;
|
||||
std::cerr << "chunksize = " << chunksize << std::endl;
|
||||
if (disableCheck) {
|
||||
std::cerr << "disableCheck = true" << std::endl;
|
||||
} else {
|
||||
std::cerr << "disableCheck = false" << std::endl;
|
||||
}
|
||||
}
|
||||
wfInput.iterMax.setValue(iterMax);
|
||||
wfInput.N.setValue(N);
|
||||
wfInput._2N2.setValue(_2N2);
|
||||
wfInput.chunksize.setValue(chunksize);
|
||||
#define Idx2D(x, y) (x)*(N+1)+(y)
|
||||
double* mat_a = (double*)malloc(sizeof(double)*(N+1)*(N+1));
|
||||
double* mat_b = (double*)malloc(sizeof(double)*(N+1)*(N+1));
|
||||
//srand(time(NULL));
|
||||
srand(20);
|
||||
for(int i=0; i<N; ++i) {
|
||||
for(int j=0; j<N; ++j) {
|
||||
mat_a[Idx2D(i, j)] = ((double)(rand() % 100) / (double)RAND_MAX) * 1000000.0;
|
||||
mat_b[Idx2D(i, j)] = mat_a[Idx2D(i, j)];
|
||||
}
|
||||
}
|
||||
wfInput.mat_a.setValue(mat_a);
|
||||
Reference in New Issue
Block a user