julia --project -e 'ENV["JULIA_MPI_BINARY"]="system"; using Pkg; Pkg.build("MPI"; verbose=true)'
All these led to same error: “libmpi could not be found”
A similar issue appears here
(~/t/error-building-mpi-libmpi-could-not-be-found/63785
replace ~ by the webpage domain. I can only post two links as being a new user;-) )
I was wondering if anyone could help with building MPI in Julia? Thanks in advance.
Thanks a lot!
I have now figured it out and it worked.
I did not change any of these other environmental variables but did the following
go to a terminal
type emacs ~/.julia/prefs/MPI.toml
set path = “/usr/local/Cellar/open-mpi/4.1.1_2”
It seems that the way of setting the path is different from the ways in the two links in my original post which were in the files ~/.bash_profile or ~/.profile
Thanks for this, this was bugging me for ages (on Mac M1, julia 1.8). I found I also had to set the library path for it to not throw the error about libmpi. For me, I had MPI installed via homebrew, and the following steps worked (in case anyone else had similar issues):
export JULIA_MPI_PATH=/opt/homebrew/Cellar/open-mpi/4.1.4
export JULIA_MPI_LIBRARY=/opt/homebrew/Cellar/open-mpi/4.1.4/lib/libmpi
julia -e 'ENV["JULIA_MPI_BINARY"]="system"; using Pkg; Pkg.build("MPI"; verbose=true)'
This resulted in the MPI.toml file (you can find in .julia/prefs) being (automatically) set up as:
and I was able to run mpiexec/mpirun as expected with julia.
Also note, if I did the above, but with e.g. “/opt/homebrew/lib” it did not work, even though there are libmpi.dylib files there. The issue, I believe, is these are aliases, and if you do ‘show original’ it takes you to the path I used above.