Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Julia is developed to work within parallel computing environments within asynchronous tasks, multi-threading, distributing computing as well as on GPUs.

For getting started with Multi-Threading and using multicores, you need to explicitly inform Julia how many cores to use, for example:

...

Code Block
[@m001 testing]$ export JULIA_NUM_THREADS=16
[@m001 testing]$ julia num_of_threads.jl
Num of Threads: 16
# Only 8 cores will actually be used.

MPI

ARCC has performed some basic testing with the MPI package on Beartooth. The process we used to set up the environment was:

Expand
titleMPI Setup Example Process
Code Block
# 1: Load the julia module
# 2: Start julia from the command-line:
[@blog1 testing]$ julia
julia> import Pkg; Pkg.add("MPI")
julia> import Pkg; Pkg.add("MPIPreferences")

# 3: Press Ctrl-D to exit.
# 4: Load the openmpi module.

# 5: From the command-line run the following, which should generate the indicated output:
[@blog1 testing]$ julia --project -e 'using MPIPreferences; MPIPreferences.use_system_binary()'
┌ Info: MPI implementation identified
│   libmpi = "libmpi"
│   version_string = "Open MPI v4.1.4, package: Open MPI powerman@bmgt1 Distribution, ident: 4.1.4, repo rev: v4.1.4, May 26, 2022\0"
│   impl = "OpenMPI"
│   version = v"4.1.4"
└   abi = "OpenMPI"
┌ Info: MPIPreferences changed
│   binary = "system"
│   libmpi = "libmpi"
│   abi = "OpenMPI"
└   mpiexec = "mpiexec"

# 6: Copy the Hello World example: 01-hello.jl
# 7: Create an interactive seesion:
[@blog1 testing]$ salloc -A <your-project> -t 30:00 -N 2 --tasks-per-node=3

# 8: Run the source
[@m001 testing]$ srun julia 01-hello.jl
Hello world, I am 3 of 6
Hello world, I am 4 of 6
Hello world, I am 5 of 6
Hello world, I am 0 of 6
Hello world, I am 2 of 6
Hello world, I am 1 of 6

We have observed the following warning the first (and only) time running MPI related code:

Code Block
┌ Warning: The call to compilecache failed to create a usable precompiled cache file for MPI [da04e1cc-30fd-572f-bb4f-1f8673147195]
│   exception = Required dependency MPIPreferences [3da0fdf6-3ccc-4f1b-acd9-58baa6c99267] failed to load from a cache file.
└ @ Base loading.jl:1349
┌ Warning: The call to compilecache failed to create a usable precompiled cache file for MPI [da04e1cc-30fd-572f-bb4f-1f8673147195]
│   exception = Required dependency MPIPreferences [3da0fdf6-3ccc-4f1b-acd9-58baa6c99267] failed to load from a cache file.
└ @ Base loading.jl:1349

Note: Every time your wish to run/test your MPI related Julia code you will need to module load the openmpi module alongside julia.