4

I compiled the next code:

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


int main(int argc, char* argv[]) {
    int rank, size, len;
    char host[MPI_MAX_PROCESSOR_NAME];
    MPI_Init(&argc, &argv);
    MPI_Finalize();
    return 0;
}

I did it this way:

mpic++ -o test test.cpp

and then i tried to run the file:

mpirun -np 2 test

but the error occured:

PMIx has detected a temporary directory name that results in a path that is too long for the Unix domain socket:

Temp dir: /var/folders/12/k2b2579s1yz2cfl8ppb1c6m80000gn/T/openmpi-sessions-501@MacBook-Air-Alexander-2_0/22793

Try setting your TMPDIR environmental variable to point to something shorter in length

So I did this:

export TMPDIR=/tmp

Tried to run again: mpirun -np 2 test

But another error occured:

Primary job terminated normally, but 1 process returned

a non-zero exit code Per user-direction, the job has been aborted

-------------------------------------------------------

mpirun detected that one or more processes exited with non-zero status, thus causing the job to be terminated. The first process to do so was:

Process name: [[22798,1],0]

Exit code: 1

Tell me please, what should I do to run this code?

Alex Rozhnov
  • 199
  • 3
  • 12
  • Your MPI installation is broken. How did you install it? What version do you use? See also https://stackoverflow.com/questions/31330511/open-mpi-mpirun-exits-with-error-on-simple-program Also read [ask] - your question title should be improved. – Zulan Jun 15 '17 at 18:46
  • @Zulan: I have installed open-mpi via **brew install open-mpi**. My current version Open MPI v2.1.1. – Alex Rozhnov Jun 15 '17 at 19:08

1 Answers1

5

the initial error was already reported and this is considered as a feature. using a shorted TMPDIR as you did is correct.

you might want to try adding orte_tmpdir_base = /tmp in your openmpi-mca-params.conf and see whether it fixes your problem (so you will not have to set TMPDIR in every terminal)

about the second issue, you are very likely running /usr/bin/test instead of your test program, so you can simply mpirun -np 2 ./test or rename your test program into something that is not in your PATH

Gilles Gouaillardet
  • 8,193
  • 11
  • 24
  • 30