Search Docs by Keyword

Table of Contents

Julia Programming Language

Description

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 simulations and distributed linear algebra, Julia features a robust ecosystem of tools for optimization, statistics, parallel computing, and data visualization. Julia is actively developed by teams at MIT and in industry, along with hundreds of domain-expert scientists and programmers from around the world on JuliaLang.

Installation

Julia can be easily installed by following the instructions on https://julialang.org/downloads/ for a Unix-type system or Windows. You can install Julia locally on the cluster using the command for the Unix-type system. The default location for the installation is $HOME. The command will also add Juliaup initialization in your ~/.bashrc, which will add the executable julia to your $PATH and make it available for you to use using command line interface (CLI).

Adding packages to Julia

One can utilize Julia’s full-featured interactive command-line REPL (read-eval-print loop) to add packages needed for running a Julia program successfully. For example, in order to run a program that solves differential equations numerically in Julia one would need to install DifferentialEquationsSimpleDiffEq, and Plots packages prior to running the differential equations program. This can be achieved in the following manner:

julia> using Pkg
julia> Pkg.add("DifferentialEquations")
julia> Pkg.add("SimpleDiffEq")
julia> Pkg.add("Plots")

Python/Conda in Julia

Similarly, one can install Conda.jl and PyCall.jl packages to enable conda for installing Python packages in Julia and to directly call Python functions from Julia. For example, in order to install Conda, matplotlib (using conda), and PyCall, one can do the following:

julia> Pkg.add("Conda")
julia> using Conda
julia> Conda.add("matplotlib")
julia> ENV["PYTHON"]=""
julia> Pkg.add("PyCall")
julia> Pkg.build("PyCall")

Note: The PYTHON environmental variable above has been set to blank prior to building the PyCall package. This is to override the default behavior of PyCall, which is to use the system’s default Python environment in Linux, and instead install Julia’s “private” version of Python. You can find more details on how to install PyCall at a desired location and call Python functions from a Julia program on PyCall.jl and Python from Julia.

Jupyter notebook in Julia

A Julia kernel can be set up to interact with the Julia language using Jupyter’s graphical notebook. The IJulia package binds the Julia kernel with Jupyter.

In order to install a package, you can bring the Julia package prompt pkg> by typing ] instead of using Pkg. Hence, the IJulia package can be installed as:

julia> ]
(@v1.10) pkg>
add IJulia
(@v1.10) pkg> build IJulia

To come out of the pkg> mode and get back to Julia REPL, press CTRL+C or backspace (see Pkg).

Alternatively, you can execute the using Pkg command to install IJulia as follows:

julia> using Pkg
julia> Pkg.add("IJulia")
julia> Pkg.build("IJulia")

Note: The installation of Julia packages could take significant time. Therefore, we recommend that Julia packages are installed on a compute node via an interactive session.

Examples

To get started with Julia on the Harvard University FAS cluster you can try the examples shown on our User Codes repository.

Resources

The Julia Programming Language
Julia Computing
Julia Documentation
Conda.jl
PyCall.jl

 

© 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.