Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double do_sth(int n){
- double result = 0.;
- hpx::cout << "hpx_thread = " << std::hex
- << hpx::this_thread::get_id()
- << " os_thread = " << std::hex
- << std::this_thread::get_id() << std::endl;
- for(int i = 0; i<n; ++i){
- result = ((result + 1.)*result)/(result - 0.8*result);
- }
- return result;
- }
- int main(int argc, char* argv[])
- {
- namespace po = boost::program_options;
- po::options_description desc_commandline;
- desc_commandline.add_options()
- ("results", "print generated results (default: false)")
- ("m1_nrows", po::value<std::uint64_t>()->default_value(100), "Number of rows of first matrix")
- ("m1_ncols", po::value<std::uint64_t>()->default_value(50), "Number of columns of first matrix")
- ("m2_nrows", po::value<std::uint64_t>()->default_value(50), "Number of rows of second matrix")
- ("m2_ncols", po::value<std::uint64_t>()->default_value(80),"Number of columns of second matrix")
- ("no-header", "do not print out the csv header row")
- ("seed", po::value<unsigned int>()->default_value(42), "Seed for randomness");
- int my_argc = 1;
- char** my_argv = new char*[my_argc];
- my_argv[0] = const_cast<char *>(std::string("parallel_for_").c_str());
- hpx::start(nullptr, my_argc, my_argv);
- hpx::future<double> result_f = hpx::async(&do_sth, 500);
- hpx::cout << "Result = " << result_f.get();
- return hpx::stop();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement