Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |  

This web mail archive is frozen.

This page is part of a frozen web archive of this mailing list.

You can still navigate around this archive, but know that no new mails have been added to it since July of 2016.

Click here to be taken to the new web archives of this list; it includes all the mails that are in this frozen archive plus all new mails that have been sent to the list since it was migrated to the new archives.

Subject: Re: [OMPI users] Bug MPI_Iscatter
From: George Bosilca (bosilca_at_[hidden])
Date: 2013-11-21 18:34:58


Pierre,
There are several issues with the code you provided.

1. You can’t use an MPI_DATATYPE_NULL as the send datatype, not even when count is zero. At least the root must provide a real datatype. In fact the type signature of the send message (datatype and count) should match the type signature of the receiving datatype.

2. I know your count is zero, and no data will be transmitted but your code is difficult to read and understand.

3. MPI_Iscatter is a collective communication. As such all processes in the associated communicator (MPI_COMM_WORLD in your case) must participate to the collective. Thus, calling MPI_Iscatter only where tasked > 0 is incorrect (you explicitly excluded 0).

4. From the MPI standard perspective your example is not correct, as you are not allowed to call MPI_Finalize while there are messages pending. Now, Open MPI tolerate this, but it is clearly not standard behavior.

#include <mpi.h>

int main(int argc, char** argv)
{
    int taskid, ntasks;
    MPI_Init(&argc, &argv);
    MPI_Request rq;
    MPI_Comm_rank(MPI_COMM_WORLD,&taskid);
    MPI_Comm_size(MPI_COMM_WORLD,&ntasks);
    double r;
    int l = 0;

    MPI_Iscatter(NULL, 0, MPI_DOUBLE, &r, l, MPI_DOUBLE, 0, MPI_COMM_WORLD, &rq);
    MPI_Wait(&rq, MPI_STATUS_IGNORE);

    MPI_Finalize();
}

  George.

On Nov 21, 2013, at 23:19 , Pierre Jolivet <jolivet_at_[hidden]> wrote:

> Hello,
> The following code doesn’t execute properly :
> #include <mpi.h>
>
> int main(int argc, char** argv) {
> int taskid, ntasks;
> MPI_Init(&argc, &argv);
> MPI_Request rq;
>
> MPI_Comm_rank(MPI_COMM_WORLD,&taskid);
> MPI_Comm_size(MPI_COMM_WORLD,&ntasks);
> double* r;
> int l = 0;
> if(taskid > 0)
> MPI_Iscatter(NULL, 0, MPI_DATATYPE_NULL, r, l, MPI_DOUBLE, 0, MPI_COMM_WORLD, &rq);
> MPI_Finalize();
> }
>
> Outcome:
> *** An error occurred in MPI_Type_extent
> *** MPI_ERR_TYPE: invalid datatype
>
> Hotfix: change MPI_DATATYPE_NULL to something else.
>
> Thanks for a quick fix.
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users