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.

From: Tim Prins (tprins_at_[hidden])
Date: 2007-10-03 19:38:18


Thanks for the report!

I have reproduced this bug and have filed a ticket on this
(https://svn.open-mpi.org/trac/ompi/ticket/1157). You should receive
updates as this bug is worked on.

Thanks,

Tim

Chris Johnson wrote:
> Hi, I'm trying to run an MPI program of mine under OpenMPI 1.2 using
> just one process (mpirun -np 1 ./a.out) and I'm getting some
> unexpected results. The problem is that I'm getting unexpected
> results from an MPI_Gatherv call when the offset for rank is nonzero.
>
> I've worked up a small sample that can reproduce the problem on the
> several machines I've tried. Here, each process creates a tmp array
> of five ints. These tmp arrays are then gathered by rank into a
> buffer, but offset by 10 places. (These 10 places are initialized
> with -1.) When I run with multiple processes, I see the 10 -1s and
> each process's tmp array in the buffer. But when I run with one
> process, the buffer contains funny values. When I run with one
> process under MPICH, the buffer contains the 10 -1s and the rank's
> array, as expected. When the offset is 0, OpenMPI behaves just fine
> with one process.
>
> Here's the sample:
>
> ----------------------------------------------
> #include <stdio.h>
> #include <stdlib.h>
> #include "mpi.h"
>
> #define COUNT 5
> #define OFFSET 10
>
> int main(int argc, char **argv) {
>
> int i;
> int *nitems;
> int *offsets;
> int *buffer;
> int tmp[COUNT];
> int rank;
> int nprocs;
>
> MPI_Init(&argc, &argv);
> MPI_Comm_rank(MPI_COMM_WORLD, &rank);
> MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
>
> for (i = 0; i < COUNT; i++) {
> tmp[i] = i + rank * 100;
> }
>
> if (rank == 0) {
> buffer = malloc(sizeof(int) * (nprocs * COUNT + OFFSET));
> nitems = malloc(sizeof(int) * nprocs);
> offsets = malloc(sizeof(int) * nprocs);
> nitems[0] = COUNT;
> offsets[0] = OFFSET;
> for (i = 1; i < nprocs; i++) {
> nitems[i] = COUNT;
> offsets[i] = offsets[i - 1] + nitems[i - 1];
> }
>
> for (i = 0; i < OFFSET; i++) {
> buffer[i] = -1;
> }
> }
> MPI_Gatherv(tmp, COUNT, MPI_INT, buffer, nitems, offsets, MPI_INT, 0,
> MPI_COMM_WORLD);
>
> if (rank == 0) {
> for (i = 0; i < nprocs * COUNT + OFFSET; i++) {
> printf("buffer[%d]: %d\n", i, buffer[i]);
> }
> free(buffer);
> free(nitems);
> free(offsets);
> }
>
> MPI_Finalize();
>
> return 0;
>
> }
> ----------------------------------------------
>
> For what it's worth, I've started using MPI_IN_PLACE instead of the
> above method. This works around the problem for now, but I'd
> appreciate any insight on how to fix this or confirmation of bug.
> Thanks for your help!
>
> - Chris
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users