From 2b3548af62f9f0b34d81c27ae8c5eba37c8c58ff Mon Sep 17 00:00:00 2001 From: Dominic Marcello Date: Fri, 16 Jun 2017 10:38:04 -0600 Subject: [PATCH] added switch to test set_child_aunt --- src/defs.hpp | 4 +++- src/node_client.hpp | 9 ++++++++- src/node_server.hpp | 3 +-- src/node_server_actions_2.cpp | 18 +++++++++++++++--- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/defs.hpp b/src/defs.hpp index fd541fa59..8730a2fca 100644 --- a/src/defs.hpp +++ b/src/defs.hpp @@ -37,6 +37,8 @@ //#define WD_EOS +#define USE_NIECE_BOOL + #define EXPERIMENT #ifdef RADIATION @@ -64,7 +66,7 @@ #define USE_PPM //#define USE_MINMOD -#if !defined(OCTOTIGER_FORCEINLINE) + #if !defined(OCTOTIGER_FORCEINLINE) # if defined(__NVCC__) || defined(__CUDACC__) # define OCTOTIGER_FORCEINLINE inline # elif defined(_MSC_VER) diff --git a/src/node_client.hpp b/src/node_client.hpp index 47fc7f7cb..094a3e0cf 100644 --- a/src/node_client.hpp +++ b/src/node_client.hpp @@ -22,6 +22,13 @@ class node_server; class analytic_t; +#ifdef USE_NIECE_BOOL +typedef bool set_child_aunt_type; +#else +typedef integer set_child_aunt_type; +#endif + + namespace hpx { using mutex = hpx::lcos::local::spinlock; } @@ -73,7 +80,7 @@ class node_client { hpx::future compare_analytic() const; hpx::future output(std::string dname, std::string fname, int, bool) const; node_client(); - hpx::future set_child_aunt(const hpx::id_type&, const geo::face&) const; + hpx::future set_child_aunt(const hpx::id_type&, const geo::face&) const; hpx::future set_aunt(const hpx::id_type&, const geo::face&) const; hpx::future get_ptr() const; hpx::future form_tree(hpx::id_type&&, hpx::id_type&&, std::vector&& ); diff --git a/src/node_server.hpp b/src/node_server.hpp index 749bf7d46..8e02864c7 100644 --- a/src/node_server.hpp +++ b/src/node_server.hpp @@ -25,7 +25,6 @@ #include #include - #include #include @@ -291,7 +290,7 @@ class node_server: public hpx::components::managed_component_base { void set_aunt(const hpx::id_type&, const geo::face& face); HPX_DEFINE_COMPONENT_DIRECT_ACTION(node_server, set_aunt, set_aunt_action); - integer set_child_aunt(const hpx::id_type&, + set_child_aunt_type set_child_aunt(const hpx::id_type&, const geo::face& face) const; HPX_DEFINE_COMPONENT_DIRECT_ACTION(node_server, set_child_aunt, set_child_aunt_action); diff --git a/src/node_server_actions_2.cpp b/src/node_server_actions_2.cpp index 87802f9ca..b37e94d4b 100644 --- a/src/node_server_actions_2.cpp +++ b/src/node_server_actions_2.cpp @@ -457,7 +457,11 @@ hpx::future node_client::form_tree(hpx::id_type&& id1, hpx::id_type&& id2, } void node_server::form_tree(hpx::id_type self_gid, hpx::id_type parent_gid, std::vector neighbor_gids) { +#ifdef NIECE_BOOL + std::fill(nieces.begin(), nieces.end(), false); +#else std::fill(nieces.begin(), nieces.end(), 0); +#endif for (auto& dir : geo::direction::full_set()) { neighbors[dir] = std::move(neighbor_gids[dir]); @@ -520,12 +524,16 @@ void node_server::form_tree(hpx::id_type self_gid, hpx::id_type parent_gid, std: if (!neighbor.empty()) { nfuts.push_back( neighbor.set_child_aunt(me.get_gid(), f ^ 1).then( - [this, f](hpx::future&& n) + [this, f](hpx::future&& n) { nieces[f] = n.get(); })); } else { +#ifdef USE_NIECE_BOOL + nieces[f] = false; +#else nieces[f] = -2; +#endif } } for (auto& f : nfuts) { @@ -596,11 +604,11 @@ hpx::id_type node_server::get_child_client(const geo::octant& ci) { typedef node_server::set_child_aunt_action set_child_aunt_action_type; HPX_REGISTER_ACTION (set_child_aunt_action_type); -hpx::future node_client::set_child_aunt(const hpx::id_type& aunt, const geo::face& f) const { +hpx::future node_client::set_child_aunt(const hpx::id_type& aunt, const geo::face& f) const { return hpx::async(get_unmanaged_gid(), aunt, f); } -integer node_server::set_child_aunt(const hpx::id_type& aunt, const geo::face& face) const { +set_child_aunt_type node_server::set_child_aunt(const hpx::id_type& aunt, const geo::face& face) const { if (is_refined) { std::array, geo::octant::count() / 2> futs; integer index = 0; @@ -616,7 +624,11 @@ integer node_server::set_child_aunt(const hpx::id_type& aunt, const geo::face& f } } } +#ifdef NIECE_BOOL + return is_refined; +#else return is_refined ? +1 : -1; +#endif } typedef node_server::get_ptr_action get_ptr_action_type;