On Wed, 2 May 2018 11:15:09 +0200 Pierre Gubernatis <pierre.guberna...@gmail.com> wrote:

> Hello all... > > I am using a *cartesian grid* of processors which represents a spatial > domain (a cubic geometrical domain split into several smaller > cubes...), and I have communicators to address the procs, as for > example a comm along each of the 3 axes I,J,K, or along a plane > IK,JK,IJ, etc..). > > *I need to cumulate a scalar value (SCAL) through the procs which > belong to a given axis* (let's say the K axis, defined by I=J=0). > > Precisely, the origin proc 0-0-0 has a given value for SCAL (say > SCAL000). I need to update the 'following' proc (0-0-1) by doing SCAL > = SCAL + SCAL000, and I need to *propagate* this updating along the K > axis. At the end, the last proc of the axis should have the total sum > of SCAL over the axis. (and of course, at a given rank k along the > axis, the SCAL value = sum over 0,1, K of SCAL) > > Please, do you see a way to do this ? I have tried many things (with > MPI_SENDRECV and by looping over the procs of the axis, but I get > deadlocks that prove I don't handle this correctly...) > Thank you in any case. Why did you try SENDRECV? As far as I understand your description above data only flows one direction (along K)? There is no MPI collective to support the kind of reduction you describe but it should not be hard to do using normal SEND and RECV. Something like (simplified psuedo code): if (not_first_along_K) MPI_RECV(SCAL_tmp, previous) SCAL += SCAL_tmp if (not_last_along_K) MPI_SEND(SCAL, next) /Peter K _______________________________________________ users mailing list users@lists.open-mpi.org https://lists.open-mpi.org/mailman/listinfo/users