Skip to content

Commit 7a90e63

Browse files
committed
Add various new types to c_type.py
Signed-off-by: Jake Tronge <[email protected]>
1 parent 107e7f5 commit 7a90e63

File tree

1 file changed

+141
-0
lines changed

1 file changed

+141
-0
lines changed

ompi/mpi/bindings/ompi_bindings/c_type.py

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@ def parameter(self, enable_count=False, **kwargs):
183183
return f'int {self.name}[]'
184184

185185

186+
@Type.add_type('OFFSET')
187+
class TypeOffset(Type):
188+
189+
def type_text(self, enable_count=False):
190+
return 'MPI_Offset'
191+
192+
186193
@Type.add_type('OFFSET_OUT')
187194
class TypeOffsetOut(Type):
188195

@@ -261,6 +268,29 @@ def type_text(self, enable_count=False):
261268
return self.mangle_name('MPI_Op')
262269

263270

271+
@Type.add_type('OP_OUT', abi_type=['ompi'])
272+
class TypeOpOut(Type):
273+
274+
def type_text(self, enable_count=False):
275+
return 'MPI_Op *'
276+
277+
278+
@Type.add_type('OP_OUT', abi_type=['standard'])
279+
class TypeOpOutStandard(Type):
280+
281+
@property
282+
def final_code(self):
283+
return [f'*{self.name} = {ConvertOMPIToStandard.OP}((MPI_Op) *{self.name});']
284+
285+
def type_text(self, enable_count=False):
286+
type_name = self.mangle_name('MPI_Op')
287+
return f'{type_name} *'
288+
289+
@property
290+
def argument(self):
291+
return f'(MPI_Op *) {self.name}'
292+
293+
264294
@Type.add_type('RANK')
265295
class TypeRank(Type):
266296

@@ -340,6 +370,29 @@ def type_text(self, enable_count=False):
340370
return self.mangle_name('MPI_Win')
341371

342372

373+
@Type.add_type('WIN_OUT', abi_type=['ompi'])
374+
class TypeWindowOut(Type):
375+
376+
def type_text(self, enable_count=False):
377+
return 'MPI_Win *'
378+
379+
380+
@Type.add_type('WIN_OUT', abi_type=['standard'])
381+
class TypeWindowOutStandard(StandardABIType):
382+
383+
@property
384+
def final_code(self):
385+
return [f'*{self.name} = {ConvertOMPIToStandard.WIN}((MPI_Win) *{self.name});']
386+
387+
def type_text(self, enable_count=False):
388+
type_name = self.mangle_name('MPI_Win')
389+
return f'{type_name} *'
390+
391+
@property
392+
def argument(self):
393+
return f'(MPI_Win *) {self.name}'
394+
395+
343396
@Type.add_type('REQUEST', abi_type=['ompi'])
344397
class TypeRequest(Type):
345398

@@ -618,6 +671,71 @@ class TypeFileErrhandlerFunction(Type):
618671
pass
619672

620673

674+
@Type.add_type('COPY_FUNCTION', abi_type=['ompi'])
675+
class TypeCopyFunction(Type):
676+
677+
def type_text(self, enable_count=False):
678+
return 'MPI_Copy_function *'
679+
680+
681+
@Type.add_type('COPY_FUNCTION', abi_type=['standard'])
682+
class TypeCopyFunctionStandard(Type):
683+
# TODO: This may require a special function to wrap the callback
684+
pass
685+
686+
687+
@Type.add_type('DELETE_FUNCTION', abi_type=['ompi'])
688+
class TypeDeleteFunction(Type):
689+
690+
def type_text(self, enable_count=False):
691+
return 'MPI_Delete_function *'
692+
693+
694+
@Type.add_type('DELETE_FUNCTION', abi_type=['standard'])
695+
class TypeDeleteFunctionStandard(Type):
696+
# TODO: This may require a special function to wrap the callback
697+
pass
698+
699+
700+
@Type.add_type('USER_FUNCTION', abi_type=['ompi'])
701+
class TypeUserFunction(Type):
702+
703+
def type_text(self, enable_count=False):
704+
return 'MPI_User_function *'
705+
706+
707+
@Type.add_type('USER_FUNCTION', abi_type=['standard'])
708+
class TypeUserFunctionStandard(Type):
709+
# TODO: This may require a special function to wrap the callback
710+
pass
711+
712+
713+
@Type.add_type('COMM_COPY_ATTR_FUNCTION', abi_type=['ompi'])
714+
class TypeCommCopyAttrFunction(Type):
715+
716+
def type_text(self, enable_count=False):
717+
return 'MPI_Comm_copy_attr_function *'
718+
719+
720+
@Type.add_type('COMM_COPY_ATTR_FUNCTION', abi_type=['standard'])
721+
class TypeCommCopyAttrFunctionStandard(Type):
722+
# TODO: This may require a special function to wrap the callback
723+
pass
724+
725+
726+
@Type.add_type('COMM_DELETE_ATTR_FUNCTION', abi_type=['ompi'])
727+
class TypeCommDeleteAttrFunction(Type):
728+
729+
def type_text(self, enable_count=False):
730+
return 'MPI_Comm_delete_attr_function *'
731+
732+
733+
@Type.add_type('COMM_DELETE_ATTR_FUNCTION', abi_type=['standard'])
734+
class TypeCommDeleteAttrFunctionStandard(Type):
735+
# TODO: This may require a special function to wrap the callback
736+
pass
737+
738+
621739
@Type.add_type('ERRHANDLER', abi_type=['ompi'])
622740
class TypeErrhandler(Type):
623741

@@ -671,3 +789,26 @@ def argument(self):
671789

672790
def type_text(self, enable_count=False):
673791
return self.mangle_name('MPI_Group')
792+
793+
794+
@Type.add_type('GROUP_OUT', abi_type=['ompi'])
795+
class TypeGroupOut(Type):
796+
797+
def type_text(self, enable_count=False):
798+
return 'MPI_Group *'
799+
800+
801+
@Type.add_type('GROUP_OUT', abi_type=['standard'])
802+
class TypeGroupOutStandard(Type):
803+
804+
@property
805+
def final_code(self):
806+
return [f'*{self.name} = {ConvertOMPIToStandard.GROUP}((MPI_Group) *{self.name});']
807+
808+
def type_text(self, enable_count=False):
809+
type_name = self.mangle_name('MPI_Group')
810+
return f'{type_name} *'
811+
812+
@property
813+
def argument(self):
814+
return f'(MPI_Group *) {self.name}'

0 commit comments

Comments
 (0)