Skip to content

Commit b1e7646

Browse files
committed
add support for comm topos
Signed-off-by: Howard Pritchard <[email protected]>
1 parent 8deb23b commit b1e7646

File tree

4 files changed

+33
-1
lines changed

4 files changed

+33
-1
lines changed

ompi/mpi/bindings/ompi_bindings/c.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,9 @@ def generate_typeclass_convert_fn(self):
546546
def generate_win_lock_convert_fn(self):
547547
self.generic_convert(ConvertFuncs.WIN_LOCK, 'lock_assert', 'int', consts.WIN_LOCK_VALUES)
548548

549+
def generate_topo_convert_fn_intern_to_abi(self):
550+
self.generic_convert_reverse(ConvertOMPIToStandard.TOPO, 'status', 'int', consts.TOPO_VALUES)
551+
549552
def generate_mode_bits_convert_fn(self):
550553
self.dump(f'{consts.INLINE_ATTRS} int {ConvertFuncs.MODE_BITS}(int mode_bits)')
551554
self.dump('{')
@@ -741,6 +744,7 @@ def dump_code(self):
741744
#
742745
self.generate_comm_cmp_convert_fn_intern_to_abi()
743746
self.generate_combiner_convert_fn_intern_to_abi()
747+
self.generate_topo_convert_fn_intern_to_abi()
744748

745749
self.dump("""
746750
#if defined(c_plusplus) || defined(__cplusplus)

ompi/mpi/bindings/ompi_bindings/c_type.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2884,3 +2884,24 @@ def init_code(self):
28842884
def type_text(self, enable_count=False):
28852885
return 'int'
28862886

2887+
@Type.add_type('TOPO_OUT', abi_type=['ompi'])
2888+
class TopoOut(Type):
2889+
2890+
def type_text(self, enable_count=False):
2891+
return 'int *'
2892+
2893+
@Type.add_type('TOPO_OUT', abi_type=['standard'])
2894+
class TopoOutStandard(StandardABIType):
2895+
2896+
@property
2897+
def final_code(self):
2898+
return [f'if (NULL != {self.name}) *{self.name} = {ConvertOMPIToStandard.TOPO}(*{self.name});']
2899+
2900+
def type_text(self, enable_count=False):
2901+
return 'int *'
2902+
2903+
@property
2904+
def argument(self):
2905+
return f'{self.name}'
2906+
2907+

ompi/mpi/bindings/ompi_bindings/consts.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,12 @@
493493
'MPI_LOCK_SHARED',
494494
]
495495

496+
TOPO_VALUES = [
497+
'MPI_CART',
498+
'MPI_GRAPH',
499+
'MPI_DIST_GRAPH',
500+
]
501+
496502
# Types
497503

498504
C_OPAQUE_TYPES = {
@@ -603,6 +609,7 @@ class ConvertOMPIToStandard:
603609
SUBARRAY_ORDER = 'ompi_convert_subarray_order_ompi_to_standard'
604610
MODE_BITS = 'ompi_convert_mode_bits_to_standard'
605611
COMBINER = 'ompi_convert_combiner_to_standard'
612+
TOPO = 'ompi_convert_topo_to_standard'
606613

607614

608615
# Inline function attributes

ompi/mpi/c/topo_test.c.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include "ompi/errhandler/errhandler.h"
3030
#include "ompi/memchecker.h"
3131

32-
PROTOTYPE ERROR_CLASS topo_test(COMM comm, INT_OUT status)
32+
PROTOTYPE ERROR_CLASS topo_test(COMM comm, TOPO_OUT status)
3333
{
3434
MEMCHECKER(
3535
memchecker_comm(comm);

0 commit comments

Comments
 (0)