Skip to content

Commit a33ccb8

Browse files
committed
patch status out to handle copy in
there are many functions where a status is conditionally returned. Trying to treat each of these would be too complex so instead copy contents of the status supplied as input into any temporary status variables then copy back out. Signed-off-by: Howard Pritchard <[email protected]>
1 parent eeca33f commit a33ccb8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

ompi/mpi/bindings/ompi_bindings/c_type.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,14 +1327,20 @@ def status_argument(self):
13271327
def init_code(self):
13281328
code = [f'MPI_Status *{self.status_argument} = NULL;']
13291329
if self.count_param is None:
1330-
code.append(f'MPI_Status {self.tmpname} = {{0}};')
1330+
code.append(f'MPI_Status {self.tmpname} = ' + '{0};')
13311331
else:
13321332
code.append(f'MPI_Status *{self.tmpname} = NULL;')
13331333
code.append(self.if_should_set_status())
13341334
if self.count_param is not None:
1335-
code.append(f'{self.tmpname} = ompi_abi_malloc({self.count_param}, sizeof(MPI_Status));')
1335+
code.append(f'{self.tmpname} = (MPI_Status *)ompi_abi_malloc({self.count_param}, sizeof(MPI_Status));')
1336+
code.extend([
1337+
'for (int i = 0; i < %s; ++i) {' % (self.count_param,),
1338+
f'{ConvertFuncs.STATUS}(&{self.tmpname}[i], &{self.name}[i]);',
1339+
'}',
1340+
])
13361341
code.append(f'{self.status_argument} = {self.tmpname};')
13371342
else:
1343+
code.append(f'{ConvertFuncs.STATUS}(&{self.tmpname}, {self.name});')
13381344
code.append(f'{self.status_argument} = &{self.tmpname};')
13391345
code.append('} else {')
13401346
if self.count_param is not None:

0 commit comments

Comments
 (0)