Skip to content

Julia

Julia Logo

Julia is a high-level, high-performance dynamic programming language for technical computing. It has syntax that is familiar to users of many other technical computing environments. Designed at MIT to tackle large-scale partial-differential equation simulation and distributed linear algebra, Julia features a robust ecosystem of tools for optimization, statistics, parallel programming, and data visualization.

Loading Your Preferred Julia

Loading the Julia Module

NERSC provides three Julia modules, one per release channel. Load the one you need:

module load julia          # release channel (default)
module load julia/lts      # long-term support channel
module load julia/beta     # beta channel

Channels track a moving target

Channels (release, lts, beta) always point to the latest Julia release within that track. If you need to stay on a specific version number as channels move forward, see Using Your Own Julia Binary below.

Using Your Own Julia Binary

If you have your own Julia installation (for example to pin Julia to a specific version number), we recommend loading the module first so that NERSC-specific local preferences are selected and added to JULIA_LOAD_PATH, then shadow the module's julia binary with your own:

module load julia  # selects preferences, sets JULIA_LOAD_PATH
export PATH=/path/to/your/julia/bin:$PATH  # takes priority

External Julia Installs Risk Broken Configurations

Some packages need to interact with system software (MPI, CUDA) in a very specific way. We therefore strongly recommend loading the Julia module, even if you use your own Julia binary, so that the correct preferences are always in place.

Using Libraries

NERSC-Specific Local Preferences

When you load the Julia module, it automatically selects a pre-generated LocalPreferences.toml tuned to your current programming environment (compiler, MPI library, CUDA version). This configures packages like MPI.jl and CUDA.jl to use the correct system libraries as soon as you install them in your own environment.

The preferences directory is appended to JULIA_LOAD_PATH, so you can always override individual settings with a LocalPreferences.toml in your own project: your project's preferences take priority.

You can check that the settings are correctly applied using each package's versioninfo() function; see the Checking Your Library versioninfo section below.

Load your environment modules before julia

The Julia module detects your programming environment (PE), MPI library, and CUDA version at load time to configure preferences. Load cudatoolkit, your MPI module, and switch your PE before loading julia to ensure the correct libraries are picked up.

Running MPI Programs

NERSC does not pre-install MPI.jl centrally. Install it in your own Julia environment and the module's pre-generated preferences will automatically point it to the correct system MPI libraries.

You can then use Slurm's srun directly:

srun -n N julia prog.jl

Or use the mpiexecjl wrapper provided by MPI.jl:

mpiexecjl -n N julia prog.jl

To install mpiexecjl:

julia> using MPI
julia> MPI.install_mpiexecjl()
[ Info: Installing `mpiexecjl` to `/global/homes/e/elvis/.julia/bin`...
[ Info: Done!

Then add ~/.julia/bin to your PATH:

export PATH=~/.julia/bin:$PATH

Developing GPU Code

Please take a look at our Perlmutter transition guide's section on Julia for further information on developing GPU codes in Julia.

NERSC does not pre-install CUDA.jl centrally. Install it in your own Julia environment and the module's pre-generated preferences will automatically point it to the correct local CUDA runtime.

Checking Your Library versioninfo

You can verify that each library is correctly configured by calling its versioninfo() function. For example:

julia> using LinearAlgebra, MPI, CUDA

julia> BLAS.get_config()
LinearAlgebra.BLAS.LBTConfig
Libraries:
 [ILP64] libopenblas64_.so

julia> MPI.versioninfo()
MPIPreferences:
  binary:  system
  abi:     MPICH
  libmpi:  libmpi_gnu_123.so
  mpiexec: srun

Package versions
  MPI.jl:             0.20.23
  MPIPreferences.jl:  0.1.11

Library information:
  libmpi:  libmpi_gnu_123.so
  libmpi dlpath:  /opt/cray/pe/lib64/libmpi_gnu_123.so
  MPI version:  4.0.0
  Library version:
    MPI VERSION    : CRAY MPICH version 9.0.1.498 (ANL base 4.1.2)
    MPI BUILD INFO : Wed Jul 16  9:39 2025 (git hash 0848216)

julia> CUDA.versioninfo()
CUDA toolchain:
- runtime 12.9, local installation
- driver 580.105.8 for 13.1
- compiler 12.9

CUDA libraries:
- CUBLAS: 12.9.0
- CURAND: 10.3.10
- CUFFT: 11.4.0
- CUSOLVER: 11.7.4
- CUSPARSE: 12.5.9
- CUPTI: 2025.2.0 (API 12.9.0)
- NVML: 13.0.0+580.105.8

Julia packages:
- CUDA: 5.9.7
- GPUArrays: 11.4.1
- GPUCompiler: 1.8.2
- KernelAbstractions: 0.9.40
- CUDA_Driver_jll: 13.1.1+0
- CUDA_Compiler_jll: 0.4.1+1
- CUDA_Runtime_jll: 0.19.2+0
- CUDA_Runtime_Discovery: 1.0.0

Toolchain:
- Julia: 1.12.1
- LLVM: 18.1.7

Preferences:
- CUDA_Runtime_jll.version: 12.9
- CUDA_Runtime_jll.local: true

1 device:
  0: NVIDIA A100-PCIE-40GB (sm_80, 37.870 GiB / 40.000 GiB available)

Share your versioninfo in support tickets

If you're encountering problems with dependencies such as MPI.jl, CUDA.jl, or linear algebra and you've opened a support ticket, please include the relevant output from versioninfo().

Getting Help with Julia

If you have questions or problems using Julia at NERSC, do not hesitate to contact NERSC's online help desk!