On 08/22/2014 02:40 PM, Saliya Ekanayake wrote:
Yes, these are all MPI_DOUBLE

well, yeah, but since you are talking about copying into a "direct buffer" there must be something tricker about the layout than just N*M doubles.

sometimes people allocate 2d arrays by allocating one array of N elements, then allocating and storing an array of length M in each of the N slots.

(you can find a dozen of these types of questions on stackoverflow, for example)

if the java interface allows you to describe with an MPI Datatype, or if you were working in C or Fortran, you can construct an HINDEXED type (or with very new MPICH, HINDEXED_BLOCK) and send that instead of copying.

==rob



On Fri, Aug 22, 2014 at 3:38 PM, Rob Latham <r...@mcs.anl.gov
<mailto:r...@mcs.anl.gov>> wrote:



    On 08/22/2014 10:10 AM, Saliya Ekanayake wrote:

        Hi,

        I've a quick question about the usage of Java binding.

        Say there's a 2 dimensional double array (size m x n) that needs
        to be
        sent to another rank. I see two options to get this done,

        1. Copy values to a direct buffer of size m*n and send it
        2. Copy values to a 1D array of size m*n and send it


    i have no idea about the java mpi bindings, but can you describe the
    type with an mpi datatype?

    ==rob


        I guess 2 would internally do the copying to a buffer and use it, so
        suggesting 1. is the best option. Is this the case or is there a
        better
        way to do this?


        Thank you,
        Saliya
        --
        Saliya Ekanayake esal...@gmail.com <mailto:esal...@gmail.com>
        <mailto:esal...@gmail.com <mailto:esal...@gmail.com>>

        http://saliya.org


        _________________________________________________
        users mailing list
        us...@open-mpi.org <mailto:us...@open-mpi.org>
        Subscription:
        http://www.open-mpi.org/__mailman/listinfo.cgi/users
        <http://www.open-mpi.org/mailman/listinfo.cgi/users>
        Link to this post:
        http://www.open-mpi.org/__community/lists/users/2014/08/__25130.php
        <http://www.open-mpi.org/community/lists/users/2014/08/25130.php>


    --
    Rob Latham
    Mathematics and Computer Science Division
    Argonne National Lab, IL USA

    _________________________________________________
    users mailing list
    us...@open-mpi.org <mailto:us...@open-mpi.org>
    Subscription: http://www.open-mpi.org/__mailman/listinfo.cgi/users
    <http://www.open-mpi.org/mailman/listinfo.cgi/users>
    Link to this post:
    http://www.open-mpi.org/__community/lists/users/2014/08/__25135.php
    <http://www.open-mpi.org/community/lists/users/2014/08/25135.php>




--
Saliya Ekanayake esal...@gmail.com <mailto:esal...@gmail.com>
Cell 812-391-4914 Home 812-961-6383
http://saliya.org


_______________________________________________
users mailing list
us...@open-mpi.org
Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users
Link to this post: 
http://www.open-mpi.org/community/lists/users/2014/08/25136.php


--
Rob Latham
Mathematics and Computer Science Division
Argonne National Lab, IL USA

Reply via email to