Skip to content

Commit

Permalink
Protect user-level madness init/finalize against the madness backend
Browse files Browse the repository at this point in the history
We should only call that when we run on the PaRSEC backend.
Otherwise we'll pull the rug from under the madness backend.

Signed-off-by: Joseph Schuchart <joseph.schuchart@stonybrook.edu>
  • Loading branch information
devreal committed Oct 29, 2024
1 parent 635cdbc commit 8fd0f17
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion examples/matrixtile.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ inline void allocator_init(int argc, char **argv) {
// initialize MADNESS so that TA allocators can be created
#if defined(TTG_PARSEC_IMPORTED)
madness::ParsecRuntime::initialize_with_existing_context(ttg::default_execution_context().impl().context());
#endif // TTG_PARSEC_IMPORTED
madness::initialize(argc, argv, /* nthread = */ 1, /* quiet = */ true);
#endif // TTG_PARSEC_IMPORTED
}

inline void allocator_fini() {
#if defined(TTG_PARSEC_IMPORTED)
madness::finalize();
#endif // TTG_PARSEC_IMPORTED
}
#else // TILEDARRAY_HAS_DEVICE
template<typename T>
Expand Down
2 changes: 1 addition & 1 deletion examples/spmm/spmm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1887,7 +1887,7 @@ int main(int argc, char **argv) {
}
}

#ifdef BTAS_IS_USABLE
#if defined(BTAS_IS_USABLE) && defined(TTG_PARSEC_IMPORTED)
madness::finalize();
#endif // BTAS_IS_USABLE

Expand Down

0 comments on commit 8fd0f17

Please sign in to comment.