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?

2
  • Your MPI installation is broken. How did you install it? What version do you use? See also stackoverflow.com/questions/31330511/… Also read How to Ask - your question title should be improved. Commented Jun 15, 2017 at 18:46
  • @Zulan: I have installed open-mpi via brew install open-mpi. My current version Open MPI v2.1.1. Commented Jun 15, 2017 at 19:08

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you for your answer, I have compiled and run my code!
May I ask where I can find the 'openmpi-mca-params.conf' file?
It is in the etc sub directory of your install directory

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.