Skip to content

Commit

Permalink
Make sure MADNESS is initialized if we use pinning allocators
Browse files Browse the repository at this point in the history
Signed-off-by: Joseph Schuchart <[email protected]>
  • Loading branch information
devreal committed Jul 26, 2024
1 parent 7bd3804 commit f31fedb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions examples/spmm/spmm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1586,6 +1586,12 @@ int main(int argc, char **argv) {
initialize(1, argv, cores);
}

#ifdef BTAS_IS_USABLE
// initialize MADNESS so that TA allocators can be created
madness::ParsecRuntime::initialize_with_existing_context(ttg::default_execution_context().impl().context());
madness::initialize(argc, argv, /* nthread = */ 1, /* quiet = */ true);
#endif // BTAS_IS_USABLE

std::string debugStr(getCmdOption(argv, argv + argc, "-d"));
auto debug = (unsigned int)parseOption(debugStr, 0);

Expand Down Expand Up @@ -1878,6 +1884,10 @@ int main(int argc, char **argv) {
}
}

#ifdef BTAS_IS_USABLE
madness::finalize();
#endif // BTAS_IS_USABLE

ttg_finalize();

return 0;
Expand Down

0 comments on commit f31fedb

Please sign in to comment.