Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] Problem with MPI functions
From: Jeff Squyres (jsquyres) (jsquyres_at_[hidden])
Date: 2013-04-11 08:29:51


Sorry for the delay in replying.

If you have non-contiguous buffers, you might want to investigate using MPI datatypes to describe the memory that you want to send/receive. Google around; you'll find bunches of tutorials on these kinds of things.

However, be aware that for a large 2D array, this generally only works well if your 2D array is uniformly distributed throughout memory.

It would be best if you could actually malloc/new your 2D array as one giant 1D array and then setup the 2nd dimension/row pointers to point to the Right Places in that 1D array. Then you can both treat it as a large, contiguous buffer as well as make your own custom datatypes (e.g., a datatype for columns in the array).

On Apr 2, 2013, at 3:28 AM, Ng Shi Wei <nsw_1216_at_[hidden]> wrote:

> Dear all,
>
> I am new in OpenMPI and writing a parallel processing program using openmpi in C++ language. I would like to use the function MPI_Allreduce() but my sendbuf and recvbuf datatype are pointers/arrays (2D).
>
> Is it possible to pass in and out the pointers/arrays using the MPI_Allreduce() ?
>
> If yes, hope can have some guidelines provided on how to write the command.
>
> Thanks in advance.
>
> Best Regards,
> Shi Wei
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users

-- 
Jeff Squyres
jsquyres_at_[hidden]
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/