Newsgroups: comp.parallel.mpi
From: llewins@msmail4.hac.com (Lloyd J Lewins)
Subject: Re: Can you do mpi_reduce using same send and receive buffers?
Organization: Hughes Aerospace Electronics Co.
Date: Thu, 09 Nov 1995 09:46:47 -0800
Message-ID: <llewins-0911950946470001@x-147-16-95-58.es.hac.com>

> Is it possible to sum a number of elements on different processes
> without using a separate buffer to do so?

No.

> Suppose one has a variable at a buffer buf1 on each process, and wants
> the sum over all processes of buf1 to end up on each process.
> What I'd like to be able to do is something like:
> 
>    mpi_allreduce (buf1, buf1, count, datatype, mpi_sum, comm)
> 

This is an illegal aliasing of arguments (MPI section 2.2)

> Does anybody know if I can in fact use the same buffer for send and receive
> in a reduction operation?  Is there any other way of doing this without 
> incurring the memory allocation penalties of the second approach?

There is some discussion at the MPI Forum of providing new functions which
can be used in the way you suggest. However, the existing MPI-1 functions
cannot.

--------------------------------------------------------------------------
Lloyd J Lewins                                  Mail Stop: RE/R1/B507
Hughes Aerospace and Electronics Co.            P.O. Box 92426
                                                Los Angeles, CA 90009-2426
Email: llewins@msmail4.hac.com                  USA
Tel: 1 (310) 334-1145
Any opinions are not neccessarily mine, let alone my employers!!

