Next monthly maintenance November 1st [DETAILS]

Search Docs by Keyword

Julia with Jupyter notebooks on the cluster

This page is intended to help you setup julia kernels that you will be able to use later in jupyter notebooks on the cluster.
Important Note:  To learn how to schedule a Jupyter notebook or Jupyter Lab session via our interactive computing portal please follow these instructions. If you prefer you can schedule sessions from the command line as described here.

Setup the necessary Julia packages:

Note: The Julia package setup could take more than 30+ mins and we are in process of improving it.
We recommend doing the setup in an interactive session.

Open the interactive session on a compute node:

Use srun to open an interactive session.

holylogin01>$ salloc -p shared --mem 4000 -t 300
holy7c05314>$

Setup the IJulia package:

Once on the node, you should load the module for Julia and for Python (Anaconda) and install the Julia kernel in your user folder.
Please refer to module-query julia or the portal for information on the different versions of Julia and select the version you would like to use.

holy7c05314>$ module load Anaconda3/2019.10
holy7c05314>$ module load julia/1.3.1-fasrc01 
holy7c05314> module load intel/17.0.4-fasrc01

Now that you have Julia loaded in your environment, you need to install IJulia package, which binds the Julia kernel for Jupyter.

holy7c05314>$ julia
julia> using Pkg

julia> Pkg.add("IJulia")
INFO: Building IJulia
julia> Pkg.add("IJulia")
Installing known registries into `~/.julia`
######################################################################## 100.0%
Added registry `General` to `~/.julia/registries/General`
Resolving package versions...
....
Building Conda ─→ `~/.julia/packages/Conda/x5ml4/deps/build.log`
Building IJulia → `~/.julia/packages/IJulia/IDNmS/deps/build.log`

julia> Pkg.status()
Status `~/.julia/environments/v1.3/Project.toml`
[7073ff75] IJulia v1.23.1

julia> exit()

Note: This can take several minutes. In case you have an issue to add the kernel try to build IJulia Pkg.build(“IJulia”).

Use the notebook:

Step 0:

Create a bash script in your home folder to load the required modules:

cat ~/moduleload.sh
#!/bin/bash

module load julia/1.3.1-fasrc01 intel/17.0.4-fasrc01

Note: Update the version of the Julia and other packages you are using in your notebooks.

Step 1:

Finally, you have all the components you need. You can now start Jupyter, connect to it, and open a Julia notebook.

To learn how to schedule a Jupyter notebook or Jupyter Lab session via our interactive computing portal (VDI) follow these instructions.

While requesting a session in VDI, refer to the script above (~/moduleload.sh) to load the modules before launching a notebook.


Once the Jupyter notebook Home page loads in your browser, you can start a notebook with a Julia kernel by selecting that entry from the list of available kernels. Your Julia notebook will open in a new tab.

© The President and Fellows of Harvard College
Except where otherwise noted, this content is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International license.