Skip to content

Commit

Permalink
Making sure to use locality for lookup in localities table
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser committed Oct 20, 2015
1 parent 538136b commit 8b1f280
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/runtime/parcelset/parcelhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,9 @@ namespace hpx { namespace parcelset
if (0 == hpx::threads::get_self_ptr() && !hpx::is_starting())
{
HPX_ASSERT(resolver_);
if (!resolver_->has_resolved_locality(ids[0].get_gid()))
naming::gid_type locality =
naming::get_locality_from_gid(ids[0].get_gid());
if (!resolver_->has_resolved_locality(locality))
{
// reschedule request as an HPX thread to avoid hangs
void (parcelhandler::*put_parcel_ptr) (
Expand Down
17 changes: 11 additions & 6 deletions tests/regressions/agas/register_with_basename_1804.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <hpx/hpx.hpp>
#include <hpx/hpx_init.hpp>
#include <hpx/util/lightweight_test.hpp>

#include <iostream>
#include <vector>
Expand Down Expand Up @@ -40,7 +41,7 @@ HPX_REGISTER_COMPONENT(server_type, test_server);
typedef test_server::call_action call_action;
HPX_REGISTER_ACTION(call_action);

std::string genName(int source, int target)
std::string gen_name(int source, int target)
{
std::string basename = "/0/HPXSimulatorUpdateGroupSdfafafasdasd";

Expand All @@ -49,7 +50,7 @@ std::string genName(int source, int target)
itoa(target);
}

void testBar()
void test()
{
int rank = hpx::get_locality_id();

Expand All @@ -59,7 +60,7 @@ void testBar()
if (i == rank)
continue;

std::string name = genName(i, rank);
std::string name = gen_name(i, rank);
std::cout << "registration: " << name << "\n";

hpx::id_type id = hpx::new_<test_server>(hpx::find_here()).get();
Expand All @@ -71,7 +72,7 @@ void testBar()
if (i == rank)
continue;

std::string name = genName(rank, i);
std::string name = gen_name(rank, i);
std::cout << "lookup: " << name << "\n";
std::vector<hpx::future<hpx::id_type> > ids =
hpx::find_all_from_basename(name, 1);
Expand All @@ -83,7 +84,10 @@ void testBar()

int hpx_main(int argc, char **argv)
{
testBar();
// this test must run using 4 localities
HPX_TEST_EQ(hpx::get_num_localities().get(), 4u);

test();
return hpx::finalize();
}

Expand All @@ -94,5 +98,6 @@ int main(int argc, char **argv)
// all other localities:
std::vector<std::string> config(1, "hpx.run_hpx_main!=1");

return hpx::init(argc, argv, config);
HPX_TEST_EQ(hpx::init(argc, argv, config), 0);
return hpx::util::report_errors();
}

0 comments on commit 8b1f280

Please sign in to comment.