You appear to have run julia under a different `mpiexec` than the one used by MPI.jl

I’m running MacOS 10.15.6 and I use OpenMPI to run Julia programs. It worked fine with Julia 1.1. Then I uninstalled Julia 1.1, installed Julia 1.5.3, added the MPI.jl package, and now I get the following error whenever I run MPI:

You appear to have run julia under a different `mpiexec` than the one used by MPI.jl

The command I’m running from the terminal is:

mpirun julia test_mpi.jl

I have version 4.0.5 of Open MPI installed:

Dan@Daniels-MacBook-Pro 2DMT % mpirun --version
mpirun (Open MPI) 4.0.5

What I’ve noticed is that every process thinks it’s rank 0 and knows of no other processes, even though there should be 4 (the number of cores on my Macbook.

Does anyone know how I’m running a different version of julia than MPI.jl? I installed MPI.jl the usual way:

Pkg.add("MPI")

I don’t have any other versions of julia installed, as I cleaned my computer of everything julia related before installing julia 1.5.3.

The code I’m running is very simple:

import MPI

MPI.Init()

comm  = MPI.COMM_WORLD
rank  = MPI.Comm_rank(comm)
nproc = MPI.Comm_size(comm)

println("My rank is ",rank," and I am 1 of ",nproc," processes.")

MPI.Barrier(comm)

MPI.Finalize()

Running this code yields the above warning, plus

My rank is 0 and I am 1 of 1 processes

If you want to use system MPI, you need to tell MPI.jl so: Configuration · MPI.jl.

If you want to be sure to use the right mpirun I recommend using the mpiexec wrapper provided by MPI.jl: Configuration · MPI.jl

Thanks for the quick reply. Is there any way to check where MPI.jl is searching for my OpenMPI build? Following your advice, I get the following result:

Dan@Daniels-MacBook-Pro 2DMT % julia --project -e 'ENV["JULIA_MPI_BINARY"]="system"; using Pkg; Pkg.build("MPI"; verbose=true)'
   Building MPI → `~/.julia/packages/MPI/b7MVG/deps/build.log`
[ Info: using system MPI
ERROR: LoadError: libmpi could not be found
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] top-level scope at /Users/Dan/.julia/packages/MPI/b7MVG/deps/build.jl:76
 [3] include(::String) at ./client.jl:457
 [4] top-level scope at none:5
in expression starting at /Users/Dan/.julia/packages/MPI/b7MVG/deps/build.jl:64
┌ Error: Error building `MPI`: 
└ @ Pkg.Operations /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Pkg/src/Operations.jl:949

Ok, solved it. Had to add

export JULIA_MPI_PATH=/opt/openmpi/

To my ~/.profile

I’ve had the same problem, could describe your solution a bit more? Where did you add the line? I’m not sure what’s meant by your ~/.profile.

(base) sam@Sams-MacBook-Pro ~ % julia --project -e 'ENV["JULIA_MPI_BINARY"]="system"; using Pkg; Pkg.build("MPI"; verbose=true)'

   Building MPI → `~/.julia/packages/MPI/biSVL/deps/build.log`
[ Info: using system MPI
ERROR: LoadError: libmpi could not be found
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] top-level scope at /Users/sam/.julia/packages/MPI/biSVL/deps/build.jl:76
 [3] include(::String) at ./client.jl:457
 [4] top-level scope at none:5
in expression starting at /Users/sam/.julia/packages/MPI/biSVL/deps/build.jl:64
┌ Error: Error building `MPI`: 
└ @ Pkg.Operations /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Pkg/src/Operations.jl:949