Browse Source

Added m as a program option

master
Joshua Moerman 11 years ago
parent
commit
1520a4928d
  1. 9
      wavelet/wavelet_parallel_mockup.cpp

9
wavelet/wavelet_parallel_mockup.cpp

@ -10,6 +10,7 @@
static struct { static struct {
unsigned int P; // doesn't need to be global, as we have bsp::nprocs() unsigned int P; // doesn't need to be global, as we have bsp::nprocs()
unsigned int N; unsigned int N;
unsigned int M;
unsigned int iterations; unsigned int iterations;
bool check_results; bool check_results;
} globals; } globals;
@ -49,7 +50,7 @@ static void par_wavelet(){
get_globals(); get_globals();
const wvlt::par::proc_info d(bsp::nprocs(), bsp::pid()); const wvlt::par::proc_info d(bsp::nprocs(), bsp::pid());
const wvlt::par::plan_1D plan(globals.N, globals.N/d.p, 2); const wvlt::par::plan_1D plan(globals.N, globals.N/d.p, globals.M);
// We allocate and push everything up front, since we need it anyways // We allocate and push everything up front, since we need it anyways
// (so peak memory is the same). This saves us 1 bsp::sync() // (so peak memory is the same). This saves us 1 bsp::sync()
@ -139,6 +140,7 @@ int main(int argc, char** argv){
opts.add_options() opts.add_options()
("p", po::value<unsigned int>(), "number of processors") ("p", po::value<unsigned int>(), "number of processors")
("n", po::value<unsigned int>(), "number of elements") ("n", po::value<unsigned int>(), "number of elements")
("m", po::value<unsigned int>()->default_value(1), "the variable m")
("iterations", po::value<unsigned int>()->default_value(5), "number of iterations") ("iterations", po::value<unsigned int>()->default_value(5), "number of iterations")
("help", po::bool_switch(), "show this help") ("help", po::bool_switch(), "show this help")
("show-input", po::bool_switch(), "shows the given input") ("show-input", po::bool_switch(), "shows the given input")
@ -156,8 +158,9 @@ int main(int argc, char** argv){
return 0; return 0;
} }
globals.N = vm["n"].as<unsigned int>();
globals.P = vm["p"].as<unsigned int>(); globals.P = vm["p"].as<unsigned int>();
globals.N = vm["n"].as<unsigned int>();
globals.M = vm["m"].as<unsigned int>();
globals.iterations = vm["iterations"].as<unsigned int>(); globals.iterations = vm["iterations"].as<unsigned int>();
globals.check_results = vm["check"].as<bool>(); globals.check_results = vm["check"].as<bool>();
@ -170,7 +173,7 @@ int main(int argc, char** argv){
} }
if(vm["show-input"].as<bool>()){ if(vm["show-input"].as<bool>()){
std::cout << "n\t" << globals.N << "\np\t" << globals.P << std::endl; std::cout << "n\t" << globals.N << "\np\t" << globals.P << "\nm\t" << globals.M << "\niterations\t" << globals.iterations << std::endl;
} }
// Initialise stuff // Initialise stuff