Skip to content

Commit 4a10921

Browse files
committed
turn back on async array cleanup stuff
and add a check that the returned request isn't complete. Signed-off-by: Howard Pritchard <[email protected]>
1 parent 53dc796 commit 4a10921

File tree

1 file changed

+22
-28
lines changed

1 file changed

+22
-28
lines changed

ompi/mpi/bindings/ompi_bindings/c_type.py

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -674,22 +674,19 @@ class TypeDatatypeArrayAsyncStandard(TypeDatatypeArrayStandard):
674674
def need_async_cleanup(self):
675675
return True
676676

677-
#
678-
# TODO: this code is deactivated till we fix the NBC cleanup callback methods
679-
#
680677
@property
681678
def final_code(self):
682-
return []
683-
# request_tmp_name = util.abi_tmp_name('request')
684-
# code = []
685-
# code.append('if((MPI_SUCCESS == ret_value) && (MPI_REQUEST_NULL != request_tmp)){')
686-
# code.append(f'ompi_coll_base_nbc_request_t* nb_request = (ompi_coll_base_nbc_request_t*){request_tmp_name};')
687-
# code.append(f'nb_request->data.release_arrays[idx++] = (void *){self.tmpname};')
688-
# code.append('nb_request->data.release_arrays[idx] = NULL;')
689-
# code.append('} else {')
690-
# code.append(f'if (NULL != {self.tmpname}) free({self.tmpname});')
691-
# code.append('}')
692-
# return code
679+
request_tmp_name = util.abi_tmp_name('request')
680+
code = []
681+
code.append(f'if((MPI_SUCCESS == ret_value) && (MPI_REQUEST_NULL != {request_tmp_name}) && (!REQUEST_COMPLETE({request_tmp_name})))' + '{')
682+
code.append(f'ompi_coll_base_nbc_request_t* nb_request = (ompi_coll_base_nbc_request_t*){request_tmp_name};')
683+
code.append('assert(nb_request->data.release_arrays[idx] == NULL);')
684+
code.append(f'nb_request->data.release_arrays[idx++] = (void *){self.tmpname};')
685+
code.append('nb_request->data.release_arrays[idx] = NULL;')
686+
code.append('} else {')
687+
code.append(f'if (NULL != {self.tmpname}) free({self.tmpname});')
688+
code.append('}')
689+
return code
693690

694691
@Type.add_type('DATATYPE_ARRAY_OUT', abi_type=['standard'])
695692
class TypeDatatypeArrayOutStandard(StandardABIType):
@@ -754,22 +751,19 @@ class NeighborDatatypeArrayAsyncStandard(NeighborDatatypeArrayStandard):
754751
def need_async_cleanup(self):
755752
return True
756753

757-
#
758-
# TODO: this code is deactivated till we fix the NBC cleanup callback methods
759-
#
760754
@property
761755
def final_code(self):
762-
return []
763-
# request_tmp_name = util.abi_tmp_name('request')
764-
# code = []
765-
# code.append('if((MPI_SUCCESS == ret_value) && (MPI_REQUEST_NULL != request_tmp)){')
766-
# code.append(f'ompi_coll_base_nbc_request_t* nb_request = (ompi_coll_base_nbc_request_t*){request_tmp_name};')
767-
# code.append(f'nb_request->data.release_arrays[idx++] = (void *){self.tmpname};')
768-
# code.append('nb_request->data.release_arrays[idx] = NULL;')
769-
# code.append('} else {')
770-
# code.append(f'if (NULL != {self.tmpname}) free({self.tmpname});')
771-
# code.append('}')
772-
# return code
756+
request_tmp_name = util.abi_tmp_name('request')
757+
code = []
758+
code.append(f'if((MPI_SUCCESS == ret_value) && (MPI_REQUEST_NULL != {request_tmp_name}) && (!REQUEST_COMPLETE({request_tmp_name})))' + '{')
759+
code.append(f'ompi_coll_base_nbc_request_t* nb_request = (ompi_coll_base_nbc_request_t*){request_tmp_name};')
760+
code.append('assert(nb_request->data.release_arrays[idx] == NULL);')
761+
code.append(f'nb_request->data.release_arrays[idx++] = (void *){self.tmpname};')
762+
code.append('nb_request->data.release_arrays[idx] = NULL;')
763+
code.append('} else {')
764+
code.append(f'if (NULL != {self.tmpname}) free({self.tmpname});')
765+
code.append('}')
766+
return code
773767

774768
@Type.add_type('OP', abi_type=['ompi'])
775769
class TypeOp(Type):

0 commit comments

Comments
 (0)