Skip to content

Commit c42d916

Browse files
committed
pml/ob1: Add checks arronud accelerator init/fini
There was previously no validation that accelerator initialization succeeded and the finalize was entered regardless. Signed-off-by: William Zhang <wilzhang@amazon.com>
1 parent 5655ed0 commit c42d916

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

ompi/mca/pml/ob1/pml_ob1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ int mca_pml_ob1_enable(bool enable)
197197
mca_pml_ob1.free_list_inc,
198198
NULL, 0, NULL, NULL, NULL);
199199

200-
mca_pml_ob1_accelerator_init();
200+
mca_pml_ob1.accelerator_enabled = (0 == mca_pml_ob1_accelerator_init()) ? true : false;
201201

202202
mca_pml_ob1.enabled = true;
203203

ompi/mca/pml/ob1/pml_ob1.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ struct mca_pml_ob1_t {
8686
char* allocator_name;
8787
mca_allocator_base_module_t* allocator;
8888
unsigned int unexpected_limit;
89+
/* Accelerator support initialized */
90+
bool accelerator_enabled;
8991
};
9092
typedef struct mca_pml_ob1_t mca_pml_ob1_t;
9193

ompi/mca/pml/ob1/pml_ob1_component.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,9 @@ int mca_pml_ob1_component_fini(void)
363363
OBJ_DESTRUCT(&mca_pml_ob1.lock);
364364
OBJ_DESTRUCT(&mca_pml_ob1.send_ranges);
365365

366-
mca_pml_ob1_accelerator_fini();
366+
if (mca_pml_ob1.accelerator_enabled) {
367+
mca_pml_ob1_accelerator_fini();
368+
}
367369

368370
if( NULL != mca_pml_ob1.allocator ) {
369371
(void)mca_pml_ob1.allocator->alc_finalize(mca_pml_ob1.allocator);

0 commit comments

Comments
 (0)