Julia

From Alliance Doc
Jump to navigation Jump to search

Julia is a programming language that was designed from the beginning for performance, ease of use and portability. It is is available as a module on Compute Canada clusters.


This article is a draft

This is not a complete article: This is a draft, a work in progress that is intended to be published into an article, which may or may not be ready for inclusion in the main wiki. It should not necessarily be considered factual or authoritative.




Compiling Packages

Julia should be have properly when compiling packages: files will be added to ~/.julia; but you may run into problems if the package depends on system-provided libraries. For instance, JLD depends on a system-provided HDF5 library. On a desktop, Julia attempts to install such a dependency by spawning yum/apt operations with sudo. This doesn't work on ComputeCanada systems; instead, some extra information must be provided to allow the Pkg build system to find the HDF5 library.

[hahn@gra-login2 ~]$ module load gcc/7.3.0 hdf5 julia/1.0.2
[hahn@gra-login2 ~]$ julia
julia> using Libdl
julia> push!(Libdl.DL_LOAD_PATH, ENV["HDF5_DIR"] * "/lib")
julia> using Pkg
julia> Pkg.add("JLD")
julia> using JLD

This example happens to work on Graham without the Libdl.DL_LOAD_PATH, because Graham happens to have a copy of HDF5 installed system-wide from Centos. It fails on Cedar because Cedar's base image doesn't happen to include HDF5. And the real point is that we should probably want to use the ComputeCanada version anyway, which we load via "module", and works uniformly on all systems. (The HDF5 module provides the HDF5_DIR environment setting, which we use to show Pkg how to find and load via Libdl.)

Package file usage (and storage quotas)

In the example above, installing just the JLD package creates a ~/.julia tree with 18673 files/directories and using 236M of space (4-5% of a standard user quota for /home). It's worth remembering that installing a lot of packages will consume a lot of space.