Skip to content

Commit fc151a8

Browse files
committed
Add DATATYPE, STATUS, and GREQUEST_* types
1 parent e673867 commit fc151a8

File tree

1 file changed

+84
-2
lines changed

1 file changed

+84
-2
lines changed

ompi/mpi/bindings/ompi_bindings/c_type.py

Lines changed: 84 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from abc import ABC, abstractmethod
2-
from ompi_bindings.consts import ConvertFuncs
2+
from ompi_bindings.consts import ConvertFuncs, ConvertOMPIToStandard
33

44

55
class Type(ABC):
@@ -260,7 +260,7 @@ def argument(self):
260260

261261

262262
@Type.add_type('DATATYPE', abi_type=['standard'])
263-
class TypeDatatype(StandardABIType):
263+
class TypeDatatypeStandard(StandardABIType):
264264

265265
@property
266266
def init_code(self):
@@ -270,6 +270,29 @@ def type_text(self, enable_count=False):
270270
return self.mangle_name('MPI_Datatype')
271271

272272

273+
@Type.add_type('DATATYPE_OUT', abi_type=['ompi'])
274+
class TypeDatatypeOut(Type):
275+
276+
def type_text(self, enable_count=False):
277+
return 'MPI_Datatype *'
278+
279+
280+
@Type.add_type('DATATYPE_OUT', abi_type=['standard'])
281+
class TypeDatatypeStandard(Type):
282+
283+
@property
284+
def final_code(self):
285+
return [f'*{self.name} = {ConvertOMPIToStandard.DATATYPE}((MPI_Datatype) *{self.name});']
286+
287+
def type_text(self, enable_count=False):
288+
type_name = self.mangle_name('MPI_Datatype')
289+
return f'{type_name} *'
290+
291+
@property
292+
def argument(self):
293+
return f'(MPI_Datatype *) {self.name}'
294+
295+
273296
@Type.add_type('OP', abi_type=['ompi'])
274297
class TypeDatatype(Type):
275298

@@ -468,6 +491,26 @@ def parameter(self, enable_count=False, **kwargs):
468491
return f'{type_name} {self.name}[]'
469492

470493

494+
@Type.add_type('STATUS', abi_type=['ompi'])
495+
class TypeStatus(Type):
496+
497+
def type_text(self, enable_count=False):
498+
return 'const MPI_Status *'
499+
500+
501+
@Type.add_type('STATUS', abi_type=['standard'])
502+
class TypeStatusStandard(StandardABIType):
503+
504+
@property
505+
def init_code(self):
506+
# TODO: Need to ensure this is the correct conversion function for MPI_Status
507+
return [f'{ConvertFuncs.STATUS}({self.name}, &{self.tmpname});']
508+
509+
def typ_text(self, enable_count=False):
510+
type_name = self.mangle_name('MPI_Status')
511+
return f'const {type_name} *'
512+
513+
471514
@Type.add_type('STATUS_OUT', abi_type=['ompi'])
472515
class TypeStatusOut(Type):
473516

@@ -778,6 +821,45 @@ class TypeCommDeleteAttrFunctionStandard(Type):
778821
pass
779822

780823

824+
@Type.add_type('GREQUEST_QUERY_FUNCTION', abi_type=['ompi'])
825+
class TypeGrequestQueryFunction(Type):
826+
827+
def type_text(self, enable_count=False):
828+
return 'MPI_Grequest_query_function *'
829+
830+
831+
@Type.add_type('GREQUEST_QUERY_FUNCTION', abi_type=['standard'])
832+
class TypeGrequestQueryFunctionStandard(Type):
833+
# TODO: This may require a special function to wrap the callback
834+
pass
835+
836+
837+
@Type.add_type('GREQUEST_FREE_FUNCTION', abi_type=['ompi'])
838+
class TypeGrequestFreeFunction(Type):
839+
840+
def type_text(self, enable_count=False):
841+
return 'MPI_Grequest_free_function *'
842+
843+
844+
@Type.add_type('GREQUEST_FREE_FUNCTION', abi_type=['standard'])
845+
class TypeGrequestFreeFunctionStandard(Type):
846+
# TODO: This may require a special function to wrap the callback
847+
pass
848+
849+
850+
@Type.add_type('GREQUEST_CANCEL_FUNCTION', abi_type=['ompi'])
851+
class TypeGrequestCancelFunction(Type):
852+
853+
def type_text(self, enable_count=False):
854+
return 'MPI_Grequest_cancel_function *'
855+
856+
857+
@Type.add_type('GREQUEST_CANCEL_FUNCTION', abi_type=['standard'])
858+
class TypeGrequestCancelFunctionStandard(Type):
859+
# TODO: This may require a special function to wrap the callback
860+
pass
861+
862+
781863
@Type.add_type('ERRHANDLER', abi_type=['ompi'])
782864
class TypeErrhandler(Type):
783865

0 commit comments

Comments
 (0)