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

Update to latest version of parsec #508

Merged
merged 1 commit into from
Nov 1, 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
2 changes: 1 addition & 1 deletion external/versions.cmake
Original file line number Diff line number Diff line change
@@ -1 +1 @@
set(MADNESS_TRACKED_PARSEC_TAG 9fc74b6f165605a133125d8a5b62cf55642c1907)
set(MADNESS_TRACKED_PARSEC_TAG 6fd959e4a8d2dad8b701d0b83cd85b372f1a306b)
19 changes: 16 additions & 3 deletions src/madness/world/parsec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,18 @@ namespace madness {
return PARSEC_SUCCESS;
}

static int parsec_madness_taskpool_leave_wait(parsec_taskpool_t* tp, void*_)
static int parsec_madness_taskpool_leave_wait(parsec_taskpool_t* tp, void*_b)
{
assert(tp != NULL);
assert(NULL != tp->tdm.module);
(void)_;

bool restart = *(bool*)_b;

if(!restart) {
/* This is the final taskpool_wait: we don't want to restart the termination
* detection and re-attach to the context. */
return PARSEC_SUCCESS;
}

/* Reset termination detector, so we can start adding tasks again */
tp->tdm.module->monitor_taskpool(tp, parsec_taskpool_termination_detected);
Expand All @@ -156,6 +163,7 @@ namespace madness {
parsec_context_t *ParsecRuntime::ctx = nullptr;
std::optional<bool> ParsecRuntime::made_new_ctx{};
parsec_execution_stream_t *ParsecRuntime::madness_comm_thread_es = nullptr;
bool ParsecRuntime::parsec_restart_taskpool = true;
#ifdef PARSEC_PROF_TRACE
int ParsecRuntime::taskpool_profiling_array[2];
#endif
Expand All @@ -173,6 +181,8 @@ namespace madness {
else {
made_new_ctx = false;
}
parsec_restart_taskpool = true;

tp = PARSEC_OBJ_NEW(parsec_taskpool_t);
tp->taskpool_name = strdup("MADNESS taskpool");
tp->devices_index_mask = PARSEC_DEVICES_ALL;
Expand All @@ -181,6 +191,7 @@ namespace madness {
tp->update_nb_runtime_task = madness_parsec_update_runtime_nb_tasks;
tp->on_enter_wait = parsec_madness_taskpool_enter_wait;
tp->on_leave_wait = parsec_madness_taskpool_leave_wait;
tp->on_leave_wait_data = &parsec_restart_taskpool;

parsec_termdet_open_module(tp, (char*)"local");
tp->tdm.module->monitor_taskpool(tp, parsec_taskpool_termination_detected);
Expand Down Expand Up @@ -208,10 +219,12 @@ namespace madness {


ParsecRuntime::~ParsecRuntime() {
parsec_context_wait(ctx);
parsec_restart_taskpool = false;
parsec_taskpool_wait(tp);
parsec_taskpool_free(tp);
assert(made_new_ctx.has_value());
if (*made_new_ctx) {
parsec_context_wait(ctx);
parsec_fini(&ctx);
if (nullptr != madness_comm_thread_es) {
/* madness_comm_thread_es is just a copy of ES[0]. Resources (including es->profiling_es) are
Expand Down
1 change: 1 addition & 0 deletions src/madness/world/parsec.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace madness{
static parsec_context_t *ctx;
static std::optional<bool> made_new_ctx;
static parsec_taskpool_t *tp;
static bool parsec_restart_taskpool;
static parsec_execution_stream_t *madness_comm_thread_es;
#ifdef PARSEC_PROF_TRACE
static int taskpool_profiling_array[2];
Expand Down
Loading