Skip to content

Wrong result with MPI_MIN #7507

@lindsayad

Description

@lindsayad

Hi, I'm on hash c75effb. Test program:

#include <mpi.h>
#include <limits>
#include <iostream>

int
main(int argc, char ** argv)
{
  int rank;
  unsigned long id;

  MPI_Init(&argc, &argv);
  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
  if (rank == 2)
    id = 0;
  else
    id = std::numeric_limits<unsigned long>::max();

  MPI_Allreduce_c(MPI_IN_PLACE, &id, 1, MPI_UNSIGNED_LONG, MPI_MIN, MPI_COMM_WORLD);
  std::cout << "On rank " << rank << " the value of id is " << id << std::endl;

  MPI_Finalize();

  return 0;
}

Result

(moose-python) lindad@rod:/data/lindad/programming/cpp(master)$ mpicxx -g -O0 mpi-min.cpp
(moose-python) lindad@rod:/data/lindad/programming/cpp(master)$ mpiexec -np 4 ./a.out
On rank 0 the value of id is 18446744073709551615
On rank 1 the value of id is 18446744073709551615
On rank 2 the value of id is 18446744073709551615
On rank 3 the value of id is 18446744073709551615

Attached is my config.log

config.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions