Created
February 24, 2016 14:44
-
-
Save ltroska/080e7a41572c454a1a65 to your computer and use it in GitHub Desktop.
gather segfault
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <hpx/hpx_init.hpp> | |
#include <hpx/hpx.hpp> | |
#include <hpx/lcos/gather.hpp> | |
char const* gather_basename = "/test/gather/"; | |
HPX_REGISTER_GATHER(double, test_gather); | |
int hpx_main(int argc, char* argv[]) | |
{ | |
for (uint i = 0; i < 10; i++) | |
{ | |
hpx::future<double> value = hpx::make_ready_future(static_cast<double>(hpx::get_locality_id())); | |
if (hpx::get_locality_id() == 0) | |
{ | |
hpx::future<std::vector<double> > overall_result = | |
hpx::lcos::gather_here(gather_basename, std::move(value), hpx::get_num_localities_sync()); | |
std::vector<double> sol = overall_result.get(); | |
for (int i = 0; i < sol.size(); i++) | |
{ | |
std::cout << "got residual " << sol[i] << " from " << i << std::endl; | |
} | |
} | |
else | |
{ | |
hpx::lcos::gather_there(gather_basename, std::move(value)).wait(); | |
} | |
} | |
return hpx::finalize(); | |
} | |
int main(int argc, char* argv[]) | |
{ | |
return hpx::init(argc, argv); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment