-1

I'm running a simple hello world program written in C on mpi and the problem I'm having is that i can't seem to execute 10 processes for this simple program.

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

int main(int argc, char *argv[])
{
    int rank; //rank of the process
    int size; //number of processes

    MPI_Init(&argc,&argv); //inititate MPI environment
    MPI_Comm_rank(MPI_COMM_WORLD,&rank);
    MPI_Comm_size(MPI_COMM_WORLD,&size);

    printf("Hello world from process %d of %d\n",rank,size);
    MPI_Finalize();
    return 0;
}

i run it on terminal by:

mpicc -o hello helloworld.c
mpirun --oversubscribe -np 10 hello

Output:

Hello world from process 0 of 10
Hello world from process 2 of 10
Hello world from process 3 of 10
Hello world from process 9 of 10
Hello world from process 7 of 10
Hello world from process 1 of 10
Hello world from process 6 of 10
Hello world from process 5 of 10
Hello world from process 4 of 10
Hello world from process 8 of 10
----------------------------------------------------------------------- 
---
A system call failed during shared memory initialization that should
not have.  It is likely that your MPI job will now either abort or
experience performance degradation.

I realized the maximum i can go with oversubscribe on my dual core mac is 5 which doesn't generate the warning as above but anything more than that gives me the error and I'm not sure why.

Would appreciate some help on this. If so how do i reinstall open mpi?

Maxxx
  • 3,688
  • 6
  • 28
  • 55
  • 1
    This is something you should report directly at https://github.com/open-mpi/ompi/issues Which version of Open MPI are you using ? How did you install it ? (pre-built binary ? `configure` command line ?) – Gilles Gouaillardet Sep 28 '18 at 07:39
  • @GillesGouaillardet I'm using the latest version of Open MPI 3.1.2. I followed the method here https://intothewave.wordpress.com/2011/12/27/install-open-mpi-on-mac-os-x/ – Maxxx Sep 28 '18 at 07:41
  • 1
    Possible duplicate of [Open MPI slots issues](https://stackoverflow.com/questions/52534073/open-mpi-slots-issues) Do not ask the same question twice. – Zulan Sep 28 '18 at 07:43
  • sounds like a race condition. meanwhile, you can `mpirun --mca shmem posix ...` – Gilles Gouaillardet Sep 28 '18 at 07:49
  • @GillesGouaillardet mpirun --mca shmem posix -np 10 hello in full? – Maxxx Sep 28 '18 at 07:51
  • you still need `--oversubscribe` – Gilles Gouaillardet Sep 28 '18 at 07:52
  • @GillesGouaillardet ok that worked but is there an alternative fix to it? Why does it happen without the commands you suggested? – Maxxx Sep 28 '18 at 07:55
  • `export OMPI_MCA_shmem=posix`. still sounds like a race condition to me. – Gilles Gouaillardet Sep 28 '18 at 08:03
  • @GillesGouaillardet do i export OMPI_MCA_shmem=posix in terminal? Sorry I am really new to mpi. What does a race condition mean? – Maxxx Sep 28 '18 at 08:05
  • 1
    Did you try it before asking ? this is a shell script thing, not a MPI one. wikipedia and/or google will tell you more things about race condition I will ever know. – Gilles Gouaillardet Sep 28 '18 at 08:08

2 Answers2

1

This bug is tracked at https://github.com/open-mpi/ompi/issues/5798

Meanwhile, you can

mpirun --mca btl_vader_backing_directory /tmp ...

or

export OMPI_MCA_btl_vader_backing_directory=/tmp
mpirun ...
Gilles Gouaillardet
  • 8,193
  • 11
  • 24
  • 30
0

Had a similar problem on mac even without oversubscribing the slots and the solution I first saw here worked for me. Try:

export TMPDIR=/tmp
Armut
  • 969
  • 8
  • 22