rsnt_translations
56,430
edits
(add MPI example) |
(Marked this version for translation) |
||
Line 97: | Line 97: | ||
starts one main Julia process and 100 worker processes on the nodes specified in the hostfile and runs the program pi_p.jl in parallel. | starts one main Julia process and 100 worker processes on the nodes specified in the hostfile and runs the program pi_p.jl in parallel. | ||
= Running Julia with MPI = | = Running Julia with MPI = <!--T:25--> | ||
<!--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. To install correctly, run the following: | ||
module load StdEnv/2020 julia/1.5.2 | <!--T:27--> | ||
module load StdEnv/2020 julia/1.5.2 | |||
export JULIA_MPI_BINARY=system | export JULIA_MPI_BINARY=system | ||
export JULIA_MPI_PATH=$EBROOTOPENMPI | export JULIA_MPI_PATH=$EBROOTOPENMPI | ||
Line 108: | Line 110: | ||
export JULIA_MPIEXEC=$EBROOTOPENMPI/bin/mpiexec | export JULIA_MPIEXEC=$EBROOTOPENMPI/bin/mpiexec | ||
<!--T:28--> | |||
Then start Julia and inside it run: | Then start Julia and inside it run: | ||
import Pkg; | <!--T:29--> | ||
import Pkg; | |||
Pkg.add("MPI") | Pkg.add("MPI") | ||
using MPI | using MPI | ||
<!--T:30--> | |||
To use afterwards, run (with two processes in this example): | To use afterwards, run (with two processes in this example): | ||
module load StdEnv/2020 julia/1.5.2 | <!--T:31--> | ||
module load StdEnv/2020 julia/1.5.2 | |||
mpirun -np 2 julia hello.jl | mpirun -np 2 julia hello.jl | ||
<!--T:32--> | |||
The hello.jl code here is: | The hello.jl code here is: | ||
using MPI | <!--T:33--> | ||
using MPI | |||
MPI.Init() | MPI.Init() | ||
comm = MPI.COMM_WORLD | comm = MPI.COMM_WORLD |