Julia: Difference between revisions

Newer Julia MPI requires different way to set backend MPI info
No edit summary
(Newer Julia MPI requires different way to set backend MPI info)
Line 146: Line 146:


<!--T:26-->
<!--T:26-->
You must make sure Julia's MPI is configured to use our MPI libraries.  To install correctly, run the following:
You must make sure Julia's MPI is configured to use our MPI libraries.  If you are using Julia MPI 0.19 or earlier, run the following:


  <!--T:27-->
  <!--T:27-->
module load StdEnv/2020 julia/1.5.2
module load StdEnv  julia
  export JULIA_MPI_BINARY=system
  export JULIA_MPI_BINARY=system
  export JULIA_MPI_PATH=$EBROOTOPENMPI
  export JULIA_MPI_PATH=$EBROOTOPENMPI
Line 162: Line 162:
import Pkg;
import Pkg;
  Pkg.add("MPI")
  Pkg.add("MPI")
using MPI
 
If you are using Julia MPI 0.20 or later, run the following (note that this appends an <code>[MPIPreferences]</code> section to your .julia/environments/vX.Y/LocalPreferences.toml file, if one already exists, it should be manually removed first):
 
  module load julia
 
  mkdir -p .julia/environments/v${EBVERSIONJULIA%.*}
 
  cat >> .julia/environments/v${EBVERSIONJULIA%.*}/LocalPreferences.toml << EOF
  [MPIPreferences]
  _format = "1.0"
  abi = "OpenMPI"
  binary = "system"
  libmpi = "${EBROOTOPENMPI}/lib64/libmpi.so"
  mpiexec = "${EBROOTOPENMPI}/bin/mpiexec"
  EOF
 
Then start Julia and inside it run:
 
  import Pkg
  Pkg.add("MPIPreferences")
  Pkg.add("MPI")


<!--T:30-->
<!--T:30-->
Line 168: Line 188:


  <!--T:31-->
  <!--T:31-->
module load StdEnv/2020  julia/1.5.2
module load StdEnv julia
  mpirun -np 2 julia hello.jl
  mpirun -np 2 julia hello.jl


cc_staff
40

edits