Julia

From ArchWiki
Jump to navigation Jump to search
Note: https://julialang.org/ has beautiful and open-source documentation, non-Arch-specific information should be contributed there.

Julia is a high-level, high-performance dynamic programming language for numerical computing. It provides a sophisticated compiler, distributed parallel execution, numerical accuracy, and an extensive mathematical function library.

Installation

Install the julia package. To learn and use Julia, please read upstream documents.

IJulia

If attempting to install ijulia by running Pkg.add("IJulia") gives the warning MbedTLS had build errors. you might need to install the mbedtls package.

Package build errors

Arpack

Building the Arpack package can result in an error like shown below (stacktrace omitted):

julia> Pkg.build("Arpack")
  Building Arpack → `~/.julia/packages/Arpack/UiiMc/deps/build.log`
┌ Error: Error building `Arpack`:
│ ERROR: LoadError: LibraryProduct(nothing, ["libarpack"], :libarpack, "Prefix(~/.julia/packages/Arpack/UiiMc/deps/usr)") is not satisfied, cannot generate deps.jl!

An issue has been filed.

Arpack packages its own libarpack.so that requires the DSO libopenblas64_.so.0 to be present on the system:

$ ldd ~/.julia/packages/Arpack/UiiMc/deps/usr/lib/libarpack.so | grep 'not found'
        libopenblas64_.so.0 => not found

The UiiMc part of the path may be different on your system. As shown, the required DSO is not present on the system, causing the build error. A workaround to this problem is to create a symbolic link to the DSO file provided by the openblas package, i.e.

# ln -s /usr/lib/libopenblas.so /usr/lib/libopenblas64_.so.0

and then rebuild the Arpack package in Julia. However, it is in unclear whether the DSO /usr/lib/libopenblas.so from the package openblas can function as a stable drop-in replacement, since the 64 suffix seems to be used to indicate a difference in interface and the 64 suffix does indicate a different version rather than a difference in target architecture.

Integration with editors

Vim

Syntax highlighting and more

julia-vim

Linting

The julialint plugin combined with the Lint.jl package can provide linting.

Performance

It is recommended that you use a multithreaded BLAS implementation, such as openblas. This can lead to speedups of 10-50x for certain matrix operations.