Julia: Difference between revisions

Jump to navigation Jump to search
Focus on Julia 1.6 first since that is the latest version
No edit summary
(Focus on Julia 1.6 first since that is the latest version)
Line 7: Line 7:


<!--T:2-->
<!--T:2-->
[https://julialang.org Julia] is a programming language that was designed from the beginning for performance, ease of use and portability. It is is available as a [[Utiliser_des_modules/en | module]] on Compute Canada clusters.
[https://julialang.org Julia] is a programming language that was designed for performance, ease of use and portability. It is is available as a [[Utiliser_des_modules/en | module]] on Compute Canada clusters.


= Compiling packages = <!--T:3-->
= Compiling packages = <!--T:3-->


<!--T:4-->
<!--T:4-->
When compiling packages for Julia, files will normally be added to <code>~/.julia</code>. However, you may run into problems if the package depends on system-provided libraries.  For instance, [https://github.com/JuliaIO/JLD.jl JLD] depends on a system-provided HDF5 library.  On a personal computer, Julia attempts to install such a dependency using [https://en.wikipedia.org/wiki/Yum_(software) yum] or [https://en.wikipedia.org/wiki/APT_(Debian) apt] with [https://en.wikipedia.org/wiki/Sudo sudo].  This will not work on a Compute Canada cluster; instead, some extra information must be provided to allow Julia's package manager (Pkg) to find the HDF5 library.
The first time you add a package to a Julia project (using Pkg.add or the package mode), the package will be downloaded, installed in <code>~/.julia</code>, and pre-compiled. The same package can be added to different projects, in which case the data in <code>~/.julia</code> will be reused. Different versions of the same package can be added to different projects; the required package versions will coexist in <code>~/.julia</code>. (Compared to Python, Julia projects replace “virtual environments” while avoiding code duplication.)
 
From Julia 1.6 onwards, Julia packages include their binary dependencies (such as libraries). There is therefore no need to load any software module, and we recommend not to.
 
With Julia 1.5 and earlier, you may run into problems if a package depends on system-provided binaries.  For instance, [https://github.com/JuliaIO/JLD.jl JLD] depends on a system-provided HDF5 library.  On a personal computer, Julia attempts to install such a dependency using [https://en.wikipedia.org/wiki/Yum_(software) yum] or [https://en.wikipedia.org/wiki/APT_(Debian) apt] with [https://en.wikipedia.org/wiki/Sudo sudo].  This will not work on a Compute Canada cluster; instead, some extra information must be provided to allow Julia's package manager (Pkg) to find the HDF5 library.


  <!--T:5-->
  <!--T:5-->
Line 25: Line 29:
<!--T:6-->
<!--T:6-->
If we were to omit the <code>Libdl.DL_LOAD_PATH</code> line from the above example, it would happen to work on Graham because Graham has HDF5 installed system-wide.  It would fail on Cedar because Cedar does not.  The best practice on ''any'' Compute Canada system, though, is that shown above: Load the appropriate [[Utiliser_des_modules/en | module]] first, and use the environment variable defined by the module (<code>HDF5_DIR</code> in this example) to extend <code>Libdl.DL_LOAD_PATH</code>.  This will work uniformly on all systems.
If we were to omit the <code>Libdl.DL_LOAD_PATH</code> line from the above example, it would happen to work on Graham because Graham has HDF5 installed system-wide.  It would fail on Cedar because Cedar does not.  The best practice on ''any'' Compute Canada system, though, is that shown above: Load the appropriate [[Utiliser_des_modules/en | module]] first, and use the environment variable defined by the module (<code>HDF5_DIR</code> in this example) to extend <code>Libdl.DL_LOAD_PATH</code>.  This will work uniformly on all systems.
<!--T:34-->
From Julia 1.6.0 onwards, the HDF5 Julia package provides its own copy of the underlying C library. Therefore, you should not load the hdf5 module or adjust the library path. (This also applies to JLD and other packages that depend on HDF5.)


= Package files and storage quotas = <!--T:7-->
= Package files and storage quotas = <!--T:7-->
cc_staff
127

edits

Navigation menu