Skip to content

Commit ddab181

Browse files
committed
SQUASH_ME: OMNIBUS 2
ompi-codegen.patch from dalcinl ompi-abiinfo.patch from dalcinl ompi-status.patch from dalcinl fixes to setting/getting status fields and some more move some deprecated funcs out of libmpi-abi add support for typeclass ops: convert data from internal to abi for user ops split rdma modes out from modes for files the ompi internal rdma and file mode bits overlap, so we need to treat them that way in the bindings generation code too. add SOURCE_ARRAY type to help out MPI_Group_translate_ranks fixes to abi_get_fortran_info for logicals apply patch omp-op-inout.patch from dalcinl apply patch ompi-abi-fortran.patch from dalcinl fix for FD_INOUT fix for isend dst arg needs to go through translation apply patch ompi-query-thread.patch from dalcinl various pt2pt fixes to handle proc_null etc. eventually we'll use separate SOURCE and DEST (or something like that) types. rma: updates to args to handle proc_null etc adjustments for improbe and iprobe fix for status array for MPI_Request_testsome switch to using a malloc wrapper per dalcinl suggestion plug memory leak handling REQUEST_INOUT type patch status out to handle copy in there are many functions where a status is conditionally returned. Trying to treat each of these would be too complex so instead copy contents of the status supplied as input into any temporary status variables then copy back out. handle dargs for darray_create correctly fixes for spawn multiple - array of info args and array of errorcodes disable async NBC-based cleanup for now turn back on async array cleanup stuff and add a check that the returned request isn't complete. Signed-off-by: Howard Pritchard <[email protected]>
1 parent 354fa83 commit ddab181

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+497
-348
lines changed

ompi/datatype/ompi_datatype_internal.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,28 @@
393393
# define OMPI_DATATYPE_MPI_REAL16 OMPI_DATATYPE_MPI_UNAVAILABLE
394394
#endif
395395

396+
/* COMPLEX */
397+
#if !OMPI_SIZEOF_FORTRAN_COMPLEX4
398+
#undef OMPI_DATATYPE_MPI_COMPLEX4
399+
#define OMPI_DATATYPE_MPI_COMPLEX4 OMPI_DATATYPE_MPI_UNAVAILABLE
400+
#endif
401+
402+
#if !OMPI_SIZEOF_FORTRAN_COMPLEX8
403+
#undef OMPI_DATATYPE_MPI_COMPLEX8
404+
#define OMPI_DATATYPE_MPI_COMPLEX8 OMPI_DATATYPE_MPI_UNAVAILABLE
405+
#endif
406+
407+
#if !OMPI_SIZEOF_FORTRAN_COMPLEX16
408+
#undef OMPI_DATATYPE_MPI_COMPLEX16
409+
#define OMPI_DATATYPE_MPI_COMPLEX16 OMPI_DATATYPE_MPI_UNAVAILABLE
410+
#endif
411+
412+
#if !OMPI_SIZEOF_FORTRAN_COMPLEX32
413+
#undef OMPI_DATATYPE_MPI_COMPLEX32
414+
#define OMPI_DATATYPE_MPI_COMPLEX32 OMPI_DATATYPE_MPI_UNAVAILABLE
415+
#endif
416+
417+
396418
/*
397419
* C++ datatypes, these map to C datatypes.
398420
*/

ompi/mpi/bindings/c_header.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ def output_constant(const, use_enum: bool, mangle_name: bool):
279279
output.append("extern int ompi_abi_mpi_win_flavor_dynamic;\n")
280280
output.append("extern int ompi_abi_mpi_win_model_unified;\n")
281281
output.append("extern int ompi_abi_mpi_win_model_separate;\n")
282+
output.append("extern int ompi_abi_mpi_lastusedcode;\n")
282283
output.append("\n")
283284
output.append("int ABI_C_MPI_COMM_NULL_DELETE_FN( MPI_Comm_ABI_INTERNAL comm, int comm_keyval, void* attribute_val_out, void* extra_state );\n")
284285
output.append("int ABI_C_MPI_COMM_NULL_COPY_FN( MPI_Comm_ABI_INTERNAL comm, int comm_keyval, void* extra_state, void* attribute_val_in, void* attribute_val_out, int* flag );\n")

ompi/mpi/bindings/ompi_bindings/c.py

Lines changed: 56 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ def dump_header(self):
117117
self.dump()
118118

119119
self.define_all('MPI_Datatype', consts.PREDEFINED_DATATYPES)
120-
self.define_all('MPI_Op', consts.COLLECTIVE_OPERATIONS)
121120
self.define_all('MPI_Op', consts.RESERVED_OPS)
122121
self.define_all('MPI_Comm', consts.RESERVED_COMMUNICATORS)
123122
self.define_all('MPI_Errhandler', consts.RESERVED_ERRHANDLERS)
@@ -428,7 +427,7 @@ def generate_message_convert_fn_intern_to_abi(self):
428427
self.generic_convert_reverse(ConvertOMPIToStandard.MESSAGE, 'message', 'MPI_Message', consts.RESERVED_MESSAGES)
429428

430429
def generate_op_convert_fn(self):
431-
self.generic_convert(ConvertFuncs.OP, 'op', 'MPI_Op', consts.COLLECTIVE_OPERATIONS)
430+
self.generic_convert(ConvertFuncs.OP, 'op', 'MPI_Op', consts.RESERVED_OPS)
432431

433432
def generate_op_convert_fn_intern_to_abi(self):
434433
self.generic_convert_reverse(ConvertOMPIToStandard.OP, 'op', 'MPI_Op', consts.RESERVED_OPS)
@@ -538,6 +537,9 @@ def generate_subarray_order_convert_fn(self):
538537
def generate_subarray_distrib_types_convert_fn(self):
539538
self.generic_convert(ConvertFuncs.SUBARRAY_DISTRIB_TYPES, 'dist', 'int', consts.SUBARRAY_DISTRIB_TYPES)
540539

540+
def generate_subarray_dargs_types_convert_fn(self):
541+
self.generic_convert(ConvertFuncs.SUBARRAY_DARGS_TYPES, 'darg', 'int', consts.SUBARRAY_DARGS_TYPES)
542+
541543
def generate_whence_convert_fn(self):
542544
self.generic_convert(ConvertFuncs.WHENCE, 'whence', 'int', consts.WHENCE_VALUES)
543545

@@ -547,9 +549,6 @@ def generate_combiner_convert_fn_intern_to_abi(self):
547549
def generate_typeclass_convert_fn(self):
548550
self.generic_convert(ConvertFuncs.TYPECLASS, 'typeclass', 'int', consts.TYPECLASS_VALUES)
549551

550-
def generate_typeclass_convert_fn(self):
551-
self.generic_convert(ConvertFuncs.TYPECLASS, 'typeclass', 'int', consts.TYPECLASS_VALUES)
552-
553552
def generate_win_lock_convert_fn(self):
554553
self.generic_convert(ConvertFuncs.WIN_LOCK, 'lock_assert', 'int', consts.WIN_LOCK_VALUES)
555554

@@ -590,6 +589,34 @@ def generate_mode_bits_convert_fn_intern_to_abi(self):
590589
self.dump_lines(lines)
591590
self.dump('}')
592591

592+
def generate_rma_mode_bits_convert_fn(self):
593+
self.dump(f'{consts.INLINE_ATTRS} int {ConvertFuncs.RMA_MODE_BITS}(int mode_bits)')
594+
self.dump('{')
595+
lines = []
596+
lines.append('int ret_value = 0;')
597+
for value_name in consts.RMA_MODE_BITS:
598+
intern_name = self.mangle_name(value_name)
599+
lines.append('if (%s & mode_bits ) {' % (intern_name))
600+
lines.append('ret_value |= %s;' % (value_name))
601+
lines.append('}')
602+
lines.append('return ret_value;')
603+
self.dump_lines(lines)
604+
self.dump('}')
605+
606+
def generate_rma_mode_bits_convert_fn_intern_to_abi(self):
607+
self.dump(f'{consts.INLINE_ATTRS} int {ConvertOMPIToStandard.RMA_MODE_BITS}(int mode_bits)')
608+
self.dump('{')
609+
lines = []
610+
lines.append('int ret_value = 0;')
611+
for value_name in consts.RMA_MODE_BITS:
612+
intern_name = self.mangle_name(value_name)
613+
lines.append('if (%s & mode_bits ) {' % (value_name))
614+
lines.append('ret_value |= %s;' % (intern_name))
615+
lines.append('}')
616+
lines.append('return ret_value;')
617+
self.dump_lines(lines)
618+
self.dump('}')
619+
593620

594621
def generate_pointer_convert_fn(self, type_, fn_name, constants):
595622
abi_type = self.mangle_name(type_)
@@ -623,15 +650,11 @@ def generate_status_convert_fn(self):
623650
self.dump(f'{consts.INLINE_ATTRS} void {ConvertFuncs.STATUS}({type_} *out, {abi_type} *inp)')
624651
self.dump('{')
625652
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(' }')
653+
self.dump(f' out->MPI_SOURCE = {ConvertFuncs.SOURCE}(inp->MPI_SOURCE);')
631654
self.dump(f' out->MPI_TAG = {ConvertFuncs.TAG}(inp->MPI_TAG);')
632655
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);')
656+
self.dump(' memcpy(ptr, &inp->MPI_internal[1], sizeof(out->_ucount));')
657+
self.dump(f' out->MPI_ERROR = {ConvertFuncs.ERROR_CLASS}(inp->MPI_ERROR);')
635658
# Ignoring the private fields for now
636659
self.dump('}')
637660

@@ -643,8 +666,8 @@ def generate_status_convert_fn_intern_to_abi(self):
643666
self.dump(' void *ptr = &out->MPI_internal[1];')
644667
self.dump(f' out->MPI_SOURCE = {ConvertOMPIToStandard.SOURCE}(inp->MPI_SOURCE);')
645668
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));')
669+
self.dump(' out->MPI_internal[0] = inp->_cancelled;')
670+
self.dump(' memcpy(ptr, &inp->_ucount, sizeof(inp->_ucount));')
648671
self.dump(f' out->MPI_ERROR = {ConvertOMPIToStandard.ERROR_CLASS}(inp->MPI_ERROR);')
649672
# Ignoring the private fields for now
650673
self.dump('}')
@@ -675,6 +698,21 @@ def dump_code(self):
675698
self.dump(' */')
676699
self.dump('#define OMPI_ABI_HANDLE_BASE_OFFSET 16385')
677700
self.dump('\n')
701+
self.dump('/*')
702+
self.dump(' * helper functions for abi generated routines ')
703+
self.dump(' */')
704+
self.dump(f'{consts.INLINE_ATTRS} void *ompi_abi_malloc(MPI_Count count, size_t elsize)')
705+
self.dump('{')
706+
lines = []
707+
lines.append('void *aptr = NULL;')
708+
lines.append('if (count > 0) {')
709+
lines.append('aptr = (void *)malloc(count * elsize);')
710+
lines.append('assert(NULL != aptr);')
711+
lines.append('}')
712+
lines.append('return aptr;')
713+
lines.append('}')
714+
lines.append('\n')
715+
self.dump_lines(lines)
678716

679717
# Now generate the conversion code - there's a reason for the order here
680718
# some converters depend on others being declared earlier in the include
@@ -733,6 +771,8 @@ def dump_code(self):
733771
self.generate_pvar_class_convert_fn_intern_to_abi()
734772
self.generate_mode_bits_convert_fn()
735773
self.generate_mode_bits_convert_fn_intern_to_abi()
774+
self.generate_rma_mode_bits_convert_fn()
775+
self.generate_rma_mode_bits_convert_fn_intern_to_abi()
736776
self.generate_buffer_convert_fn()
737777
self.generate_buffer_convert_fn_intern_to_abi()
738778

@@ -749,10 +789,12 @@ def dump_code(self):
749789
self.generate_weight_convert_fn()
750790
self.generate_subarray_order_convert_fn()
751791
self.generate_subarray_distrib_types_convert_fn()
792+
self.generate_subarray_dargs_types_convert_fn()
752793
self.generate_root_convert_fn()
753794
self.generate_t_cb_safety_convert_fn()
754795
self.generate_win_lock_convert_fn()
755796
self.generate_whence_convert_fn()
797+
self.generate_typeclass_convert_fn()
756798

757799
#
758800
# the following only need intern to abi converters

0 commit comments

Comments
 (0)