@@ -540,6 +540,14 @@ def type_text(self, enable_count=False):
540540 def parameter (self , enable_count = False , ** kwargs ):
541541 return f'const { self .type_text (enable_count = enable_count )} { self .name } []'
542542
543+ @Type .add_type ('NEIGHBOR_DATATYPE_ARRAY' , abi_type = ['ompi' ])
544+ class NeighborDatatypeArray (TypeDatatypeArray ):
545+ pass
546+
547+ @Type .add_type ('NEIGHBOR_DATATYPE_ARRAY_ASYNC' , abi_type = ['ompi' ])
548+ class NeighborDatatypeArrayAsync (TypeDatatypeArray ):
549+ pass
550+
543551@Type .add_type ('DATATYPE_ARRAY_OUT' , abi_type = ['ompi' ])
544552class TypeDatatypeArrayOut (Type ):
545553
@@ -690,16 +698,45 @@ def parameter(self, enable_count=False, **kwargs):
690698 def argument (self ):
691699 return f'(MPI_Datatype *) { self .tmpname } '
692700
701+ @Type .add_type ('NEIGHBOR_DATATYPE_ARRAY' , abi_type = ['standard' ])
702+ class NeighborDatatypeArrayStandard (TypeDatatypeArrayStandard ):
703+
704+ @property
705+ def init_code (self ):
706+ code = [f'MPI_Comm comm_{ self .tmpname } = { ConvertFuncs .COMM } (comm);' ]
707+ code .append (f'int indegree_{ self .tmpname } , outdegree_{ self .tmpname } , size_{ self .tmpname } ;' )
708+ code .append (f'mca_topo_base_neighbor_count(comm_{ self .tmpname } , &indegree_{ self .tmpname } , &outdegree_{ self .tmpname } );' )
709+ code .append (f'MPI_Datatype *{ self .tmpname } = NULL;' )
710+ if self .name == "sendtypes" :
711+ code .append (f'size_{ self .tmpname } = outdegree_{ self .tmpname } ;' )
712+ if self .name == "recvtypes" :
713+ code .append (f'size_{ self .tmpname } = indegree_{ self .tmpname } ;' )
714+ code .append ('if(' + f'{ self .name } ' + '!= NULL)' + '{' )
715+ code .append (f'{ self .tmpname } = (MPI_Datatype *)malloc(sizeof(MPI_Datatype) * size_{ self .tmpname } );' )
716+ code .append (f'for(int i=0;i<size_{ self .tmpname } ;i++){{' )
717+ code .append (f'{ self .tmpname } [i] = { ConvertFuncs .DATATYPE } ({ self .name } [i]);' )
718+ code .append (f'}}' )
719+ code .append (f'}}' )
720+ return code
721+
722+ @Type .add_type ('NEIGHBOR_DATATYPE_ARRAY_ASYNC' , abi_type = ['standard' ])
723+ class NeighborDatatypeArrayAsyncStandard (NeighborDatatypeArrayStandard ):
724+
725+ @property
726+ def final_code (self ):
727+ code = ['{' ]
728+ code .append ('}' )
729+ return code
693730
694731@Type .add_type ('OP' , abi_type = ['ompi' ])
695- class TypeDatatype (Type ):
732+ class TypeOp (Type ):
696733
697734 def type_text (self , enable_count = False ):
698735 return 'MPI_Op'
699736
700737
701738@Type .add_type ('OP' , abi_type = ['standard' ])
702- class TypeDatatype (StandardABIType ):
739+ class TypeOpStandard (StandardABIType ):
703740
704741 @property
705742 def init_code (self ):
0 commit comments