Newsgroups: comp.parallel.mpi
From: kalns@pit-bull.msu.edu (Edgar T. Kalns)
Subject: MPI_Scatterv and overlapping datatypes
Organization: Michigan State University, CPS Department
Date: 31 Mar 1995 20:01:46 GMT
Message-ID: <3lhn3a$mao@msunews.cl.msu.edu>

Summary of question: 

        How to perform MPI_SCATTERV with a sendtype that 
        specifies overlapping locations in sendbuf?

Details:

        p. 104 of 5/5/94 standard:
        The outcome of an MPI_Scatterv is as if the root executed n send ops:

        MPI_Send(sendbuf + displs[i] * extent(sendtype),sendcounts[i],...);
                                                                    ^^^^^^^^^^^^^
        Is it possible to cajole the extent(sendtype) so that 
        *arbitrary* displacements in sendbuf can be specified in 
        MPI_Scatterv?  Obviously, this can be done using pt-to-pt routines.

Simple example:

        assume comm. size is 4.
        int	s_buf[8] = {0, 1, 2, 3, 4, 5, 6, 7}  /* data at root */
   
        want each process to have a "scatter" of s_buf as follows:
        rank 0: r_buf[2] = {0, 4}
        rank 1: r_buf[2] = {1, 5}
        rank 2: r_buf[2] = {2, 6}
        rank 3: r_buf[2] = {3, 7}

Scatter pattern is easy to specify:

        MPI_Type_vector( 2, 1, 4, MPI_INT, &s_type ); 
        
        however, MPI_Type_extent( s_type, &extent ) returns an extent of 20;
        so using Scatterv is not possible for the above scatter pattern.
        
Thanks,
Edgar Kalns
kalns@cps.msu.edu




