Jim,

if i understand correctly, George point is that OpenMPI is currently correct with respect to the MPI standard : MPI_DATATYPE_NULL is *not* a predefined datatype, hence it is not (expected to be) a committed datatype, and hence it cannot be used in MPI_Alltoallw (regardless the corresponding count is zero).

an other way to put this is mpich could/should have failed and/or you were lucky it worked.

George and Jeff,

do you feel any need to ask MPI Forum to clarify this point ?


Cheers,

Gilles

On 1/13/2016 12:14 PM, Jim Edwards wrote:
Sorry there was a mistake in that code,
stypes and rtypes should be of type MPI_Datatype not integer
however the result is the same.

*** An error occurred in MPI_Alltoallw

*** reported by process [204406785,1]

*** on communicator MPI_COMM_WORLD

*** MPI_ERR_TYPE: invalid datatype




On Tue, Jan 12, 2016 at 7:55 PM, Jim Edwards <jedwa...@ucar.edu <mailto:jedwa...@ucar.edu>> wrote:

    Maybe the example is too simple.  Here is another one which
    when run on two tasks sends two integers from each task to
    task 0.   Task 1 receives nothing.  This works with mpich and impi
    but fails with openmpi.

    #include <stdio.h>
    #include <mpi.h>

     my_mpi_test(int rank, int ntasks)
    {
      MPI_Datatype stype, rtype;
      int sbuf[2];
      int rbuf[4];

      int slen[ntasks], sdisp[ntasks], stypes[ntasks], rlen[ntasks],
    rdisp[ntasks], rtypes[ntasks];
      sbuf[0]=rank;
    sbuf[1]=ntasks+rank;
      slen[0]=2;
      slen[1]=0;
    stypes[0]=MPI_INT;
    stypes[1]=MPI_DATATYPE_NULL;
      sdisp[0]=0;
      sdisp[1]=4;
      if(rank==0){
        rlen[0]=2;
        rlen[1]=2;
    rtypes[0]=MPI_INT;
    rtypes[1]=MPI_INT;
        rdisp[0]=0;
        rdisp[1]=8;
      }else{
        rlen[0]=0;
        rlen[1]=0;
    rtypes[0]=MPI_DATATYPE_NULL;
    rtypes[1]=MPI_DATATYPE_NULL;
        rdisp[0]=0;
        rdisp[1]=0;
      }

    MPI_Alltoallw(sbuf, slen, sdisp, stypes, rbuf, rlen, rdisp,
    rtypes, MPI_COMM_WORLD);
      if(rank==0){
        printf("%d %d %d %d\n",rbuf[0],rbuf[1],rbuf[2],rbuf[3]);
      }

    int main(int argc, char **argv)
    {
      int rank, ntasks;
      MPI_Init(&argc, &argv);

    MPI_Comm_rank(MPI_COMM_WORLD,&rank);
      MPI_Comm_size(MPI_COMM_WORLD, &ntasks);
      printf("rank %d ntasks %d\n",rank, ntasks);

      my_mpi_test(rank,ntasks);


      MPI_Finalize();
    }






--
Jim Edwards

CESM Software Engineer
National Center for Atmospheric Research
Boulder, CO


_______________________________________________
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/2016/01/28258.php

Reply via email to