Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synchronize on make_graph_executable #260

Merged
merged 1 commit into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions ttg/ttg/func.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,12 @@ namespace ttg {
template <typename... TTBasePtrs>
inline std::enable_if_t<(std::is_convertible_v<decltype(*(std::declval<TTBasePtrs>())), TTBase &> && ...), bool>
make_graph_executable(TTBasePtrs &&...tts) {
return ttg::make_traverse([](auto &&x) { std::forward<decltype(x)>(x)->make_executable(); })(
std::forward<TTBasePtrs>(tts)...);
auto traverse = ttg::make_traverse([](auto &&x) { std::forward<decltype(x)>(x)->make_executable(); });
auto ret = traverse(std::forward<TTBasePtrs>(tts)...);
// make sure everyone has traversed the TT
auto world = [&](auto&& tt0, auto&&... tts) { return tt0->get_world(); }(std::forward<TTBasePtrs>(tts)...);
TTG_IMPL_NS::make_executable_hook(world);
return ret;
}

/// \brief Connect output terminal to successor input terminal
Expand Down
2 changes: 2 additions & 0 deletions ttg/ttg/madness/fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ namespace ttg_madness {

class WorldImpl;

inline void make_executable_hook(ttg::World&);

inline void ttg_initialize(int argc, char **argv, int num_threads = -1);

inline void ttg_finalize();
Expand Down
2 changes: 2 additions & 0 deletions ttg/ttg/madness/ttg.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ namespace ttg_madness {
#endif
};

inline void make_executable_hook(ttg::World& world) { }

inline void ttg_initialize(int argc, char **argv, int num_threads) {
if (num_threads < 1) num_threads = ttg::detail::num_threads();
::madness::World &madworld = ::madness::initialize(argc, argv, num_threads, /* quiet = */ true);
Expand Down
2 changes: 2 additions & 0 deletions ttg/ttg/parsec/fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ namespace ttg_parsec {

class WorldImpl;

inline void make_executable_hook(ttg::World&);

inline void ttg_initialize(int argc, char **argv, int num_threads = -1, parsec_context_s * = nullptr);

inline void ttg_finalize();
Expand Down
6 changes: 5 additions & 1 deletion ttg/ttg/parsec/ttg.h
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ namespace ttg_parsec {
#endif
};

static void unregister_parsec_tags(void *_)
inline void unregister_parsec_tags(void *_)
{
if(NULL != parsec_ce.tag_unregister) {
parsec_ce.tag_unregister(WorldImpl::parsec_ttg_tag());
Expand Down Expand Up @@ -1035,6 +1035,10 @@ namespace ttg_parsec {
value = result;
}

inline void make_executable_hook(ttg::World& world) {
MPI_Barrier(world.impl().comm());
}

/// broadcast
/// @tparam T a serializable type
template <typename T>
Expand Down
Loading