|
43 | 43 | #include "opal/mca/installdirs/installdirs.h" |
44 | 44 | #include "opal/mca/pmix/base/base.h" |
45 | 45 | #include "opal/mca/pmix/pmix.h" |
| 46 | +#include "opal/runtime/opal_progress_threads.h" |
46 | 47 |
|
47 | 48 | #include "orte/util/show_help.h" |
48 | 49 | #include "orte/util/proc_info.h" |
@@ -74,6 +75,7 @@ static bool added_num_procs = false; |
74 | 75 | static bool added_app_ctx = false; |
75 | 76 | static bool added_pmix_envs = false; |
76 | 77 | static char *pmixenvars[4]; |
| 78 | +static bool progress_thread_running = false; |
77 | 79 |
|
78 | 80 | static int fork_hnp(void); |
79 | 81 |
|
@@ -164,6 +166,11 @@ static int rte_init(void) |
164 | 166 | /* our name was given to us by the HNP */ |
165 | 167 | } |
166 | 168 |
|
| 169 | + /* get an async event base - we use the opal_async one so |
| 170 | + * we don't startup extra threads if not needed */ |
| 171 | + orte_event_base = opal_progress_thread_init(NULL); |
| 172 | + progress_thread_running = true; |
| 173 | + |
167 | 174 | /* open and setup pmix */ |
168 | 175 | if (NULL == opal_pmix.initialized) { |
169 | 176 | if (OPAL_SUCCESS != (ret = mca_base_framework_open(&opal_pmix_base_framework, 0))) { |
@@ -365,15 +372,22 @@ static int rte_finalize(void) |
365 | 372 | unsetenv("PMIX_SERVER_URI"); |
366 | 373 | unsetenv("PMIX_SECURITY_MODE"); |
367 | 374 | } |
| 375 | + |
| 376 | + /* use the default procedure to finish */ |
| 377 | + if (ORTE_SUCCESS != (ret = orte_ess_base_app_finalize())) { |
| 378 | + ORTE_ERROR_LOG(ret); |
| 379 | + } |
| 380 | + |
368 | 381 | /* mark us as finalized */ |
369 | 382 | if (NULL != opal_pmix.finalize) { |
370 | 383 | opal_pmix.finalize(); |
371 | 384 | (void) mca_base_framework_close(&opal_pmix_base_framework); |
372 | 385 | } |
373 | 386 |
|
374 | | - /* use the default procedure to finish */ |
375 | | - if (ORTE_SUCCESS != (ret = orte_ess_base_app_finalize())) { |
376 | | - ORTE_ERROR_LOG(ret); |
| 387 | + /* release the event base */ |
| 388 | + if (progress_thread_running) { |
| 389 | + opal_progress_thread_finalize(NULL); |
| 390 | + progress_thread_running = false; |
377 | 391 | } |
378 | 392 |
|
379 | 393 | return ret; |
|
0 commit comments