Skip to content

Commit 7542f49

Browse files
committed
ompi-status.patch from dalcinl
fixes to setting/getting status fields and some more Signed-off-by: Howard Pritchard <[email protected]>
1 parent d9884bb commit 7542f49

File tree

10 files changed

+37
-28
lines changed

10 files changed

+37
-28
lines changed

ompi/mpi/bindings/ompi_bindings/c.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -623,15 +623,11 @@ def generate_status_convert_fn(self):
623623
self.dump(f'{consts.INLINE_ATTRS} void {ConvertFuncs.STATUS}({type_} *out, {abi_type} *inp)')
624624
self.dump('{')
625625
self.dump(' void *ptr = &out->_ucount;')
626-
self.dump(' if(inp->MPI_SOURCE == MPI_ANY_SOURCE_ABI_INTERNAL) {')
627-
self.dump(' out->MPI_SOURCE = MPI_ANY_SOURCE;')
628-
self.dump(' } else {')
629-
self.dump(' out->MPI_SOURCE = inp->MPI_SOURCE;')
630-
self.dump(' }')
626+
self.dump(f' out->MPI_SOURCE = {ConvertFuncs.SOURCE}(inp->MPI_SOURCE);')
631627
self.dump(f' out->MPI_TAG = {ConvertFuncs.TAG}(inp->MPI_TAG);')
632628
self.dump(' out->_cancelled = inp->MPI_internal[0];')
633-
self.dump(' memcpy(ptr, &inp->MPI_internal[1],sizeof(out->_ucount));')
634-
self.dump(f' out->MPI_ERROR = {ConvertFuncs.ERROR_CLASS}(inp->MPI_ERROR);')
629+
self.dump(' memcpy(ptr, &inp->MPI_internal[1], sizeof(out->_ucount));')
630+
self.dump(f' out->MPI_ERROR = {ConvertFuncs.ERROR_CLASS}(inp->MPI_ERROR);')
635631
# Ignoring the private fields for now
636632
self.dump('}')
637633

@@ -643,8 +639,8 @@ def generate_status_convert_fn_intern_to_abi(self):
643639
self.dump(' void *ptr = &out->MPI_internal[1];')
644640
self.dump(f' out->MPI_SOURCE = {ConvertOMPIToStandard.SOURCE}(inp->MPI_SOURCE);')
645641
self.dump(f' out->MPI_TAG = {ConvertOMPIToStandard.TAG}(inp->MPI_TAG);')
646-
self.dump(' out->MPI_internal[0] =inp->_cancelled;')
647-
self.dump(' memcpy(ptr, &inp->_ucount,sizeof(inp->_ucount));')
642+
self.dump(' out->MPI_internal[0] = inp->_cancelled;')
643+
self.dump(' memcpy(ptr, &inp->_ucount, sizeof(inp->_ucount));')
648644
self.dump(f' out->MPI_ERROR = {ConvertOMPIToStandard.ERROR_CLASS}(inp->MPI_ERROR);')
649645
# Ignoring the private fields for now
650646
self.dump('}')

ompi/mpi/bindings/ompi_bindings/c_type.py

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -824,21 +824,14 @@ def type_text(self, enable_count=False):
824824
def argument(self):
825825
return f'(MPI_Op *) (NULL != {self.name} ? &{self.tmpname} : NULL)'
826826

827-
@Type.add_type('RANK')
828-
class TypeRank(Type):
829-
830-
def type_text(self, enable_count=False):
831-
return 'int'
832-
833-
834827
@Type.add_type('TAG', abi_type=['ompi'])
835-
class TypeRank(Type):
828+
class TypeTag(Type):
836829

837830
def type_text(self, enable_count=False):
838831
return 'int'
839832

840833
@Type.add_type('TAG', abi_type=['standard'])
841-
class TypeRankStandard(StandardABIType):
834+
class TypeTagStandard(StandardABIType):
842835

843836
@property
844837
def init_code(self):
@@ -847,6 +840,26 @@ def init_code(self):
847840
def type_text(self, enable_count=False):
848841
return 'int'
849842

843+
@Type.add_type('TAG_OUT', abi_type=['ompi'])
844+
class TypeTagOut(Type):
845+
846+
def type_text(self, enable_count=False):
847+
return 'int *'
848+
849+
@Type.add_type('TAG_OUT', abi_type=['standard'])
850+
class TypeTagOutStandard(StandardABIType):
851+
852+
@property
853+
def final_code(self):
854+
return [f'if (NULL != {self.name}) *{self.name} = {ConvertOMPIToStandard.TAG}(*{self.name});']
855+
856+
def type_text(self, enable_count=False):
857+
return f'int *'
858+
859+
@property
860+
def argument(self):
861+
return f'(int *) {self.name}'
862+
850863
@Type.add_type('ROOT', abi_type=['ompi'])
851864
class TypeRoot(Type):
852865

@@ -1310,8 +1323,8 @@ def init_code(self):
13101323
mangle_type = self.mangle_name('MPI_Status')
13111324
code = [f'MPI_Status *{self.status_argument} = NULL;']
13121325
code.append(f'MPI_Status {self.tmpname};')
1313-
code.append(f'{ConvertFuncs.STATUS}(&{self.tmpname}, ({mangle_type} *){self.name});')
13141326
code.append(self.if_should_set_status())
1327+
code.append(f'{ConvertFuncs.STATUS}(&{self.tmpname}, ({mangle_type} *){self.name});')
13151328
code.append(f'{self.status_argument} = &{self.tmpname};')
13161329
code.append('} else {')
13171330
code.append(f'{self.status_argument} = MPI_STATUS_IGNORE;')

ompi/mpi/c/irsend.c.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include "ompi/runtime/ompi_spc.h"
3838

3939
PROTOTYPE ERROR_CLASS Irsend(BUFFER_CONST buf, COUNT count, DATATYPE type, INT dest,
40-
TAG tag, COMM comm, REQUEST_INOUT request)
40+
INT tag, COMM comm, REQUEST_INOUT request)
4141
{
4242
int rc;
4343

ompi/mpi/c/send.c.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
#include "ompi/memchecker.h"
3636
#include "ompi/runtime/ompi_spc.h"
3737

38-
PROTOTYPE ERROR_CLASS send(BUFFER_CONST buf, COUNT count, DATATYPE type, RANK dest,
39-
TAG tag, COMM comm)
38+
PROTOTYPE ERROR_CLASS send(BUFFER_CONST buf, COUNT count, DATATYPE type, INT dest,
39+
INT tag, COMM comm)
4040
{
4141
int rc = MPI_SUCCESS;
4242

ompi/mpi/c/status_get_error.c.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include "ompi/errhandler/errhandler.h"
1919
#include "ompi/memchecker.h"
2020

21-
PROTOTYPE ERROR_CLASS status_get_error(STATUS status, INT_OUT error)
21+
PROTOTYPE ERROR_CLASS status_get_error(STATUS status, ERROR_CODE_OUT error)
2222
{
2323
int rc = MPI_SUCCESS;
2424

ompi/mpi/c/status_get_source.c.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include "ompi/errhandler/errhandler.h"
1919
#include "ompi/memchecker.h"
2020

21-
PROTOTYPE ERROR_CLASS status_get_source(STATUS status, INT_OUT source)
21+
PROTOTYPE ERROR_CLASS status_get_source(STATUS status, SOURCE_OUT source)
2222
{
2323
int rc = MPI_SUCCESS;
2424

ompi/mpi/c/status_get_tag.c.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "ompi/memchecker.h"
2121

2222

23-
PROTOTYPE ERROR_CLASS status_get_tag(STATUS status, INT_OUT tag)
23+
PROTOTYPE ERROR_CLASS status_get_tag(STATUS status, TAG_OUT tag)
2424
{
2525
int rc = MPI_SUCCESS;
2626

ompi/mpi/c/status_set_error.c.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include "ompi/errhandler/errhandler.h"
1818
#include "ompi/memchecker.h"
1919

20-
PROTOTYPE ERROR_CLASS status_set_error(STATUS_INOUT status, INT error)
20+
PROTOTYPE ERROR_CLASS status_set_error(STATUS_INOUT status, ERROR_CODE error)
2121
{
2222
MEMCHECKER(
2323
if(status != MPI_STATUSES_IGNORE) {

ompi/mpi/c/status_set_source.c.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include "ompi/errhandler/errhandler.h"
1818
#include "ompi/memchecker.h"
1919

20-
PROTOTYPE ERROR_CLASS status_set_source(STATUS_INOUT status, INT source)
20+
PROTOTYPE ERROR_CLASS status_set_source(STATUS_INOUT status, SOURCE source)
2121
{
2222
MEMCHECKER(
2323
if(status != MPI_STATUSES_IGNORE) {

ompi/mpi/c/status_set_tag.c.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include "ompi/errhandler/errhandler.h"
1919
#include "ompi/memchecker.h"
2020

21-
PROTOTYPE ERROR_CLASS status_set_tag(STATUS_INOUT status, INT tag)
21+
PROTOTYPE ERROR_CLASS status_set_tag(STATUS_INOUT status, TAG tag)
2222
{
2323
MEMCHECKER(
2424
if(status != MPI_STATUSES_IGNORE) {

0 commit comments

Comments
 (0)