(array, comm)
| 36 | return MPI._typedict[typecode] |
| 37 | |
| 38 | def _reduce_dims(array, comm): |
| 39 | from mpi4py import MPI |
| 40 | dims = numpy.array([0, 0], dtype=numpy.int32) |
| 41 | if array is not dsa.NoneArray: |
| 42 | shp = numpy.shape(array) |
| 43 | if len(shp) == 0: |
| 44 | dims = numpy.array([1, 0], dtype=numpy.int32) |
| 45 | elif len(shp) == 1: |
| 46 | dims = numpy.array([shp[0], 0], dtype=numpy.int32) |
| 47 | else: |
| 48 | dims = numpy.array(shp, dtype=numpy.int32) |
| 49 | max_dims = numpy.array(dims, dtype=numpy.int32) |
| 50 | mpitype = _lookup_mpi_type(numpy.int32) |
| 51 | comm.Allreduce([dims, mpitype], [max_dims, mpitype], MPI.MAX) |
| 52 | |
| 53 | if max_dims[1] == 0: |
| 54 | max_dims = numpy.array((max_dims[0],)) |
| 55 | size = max_dims[0] |
| 56 | else: |
| 57 | size = max_dims[0]*max_dims[1] |
| 58 | |
| 59 | if max_dims[0] == 1: |
| 60 | max_dims = 1 |
| 61 | |
| 62 | return (max_dims, size) |
| 63 | |
| 64 | def global_func(impl, array, axis, controller) -> Union[numpy.ndarray, dsa.VTKNoneArray, dsa.VTKCompositeDataArray]: |
| 65 | """Helper function for reduction-like operation (e.g., sum, min, max) to the given array, |
no test coverage detected