In the this article, we’ll discuss how to get started with Julia programming language.
Whenever a new programming language makes an appearance, we have to ask ourselves whether learning it is worth it or not. This is what happened when Julia programming language was first released. However, over the years, Julia proved itself to be faster and more powerful than many other languages out there.
I’ve conducted a benchmarking and performance analysis of Julia against Python. The results were pretty amazing. If you’re interested to see the benchmarking results, check out this article I recently published : Julia vs Python: Choosing the best with benchmarking & performance analysis
Today, Julia is one of the top 50 languages in the Tiobe index. In order to help you learn more about Julia, I’m going to publish a series of articles that deal with everything you need to know about it. This article will help you understand what sets Julia apart from other languages. We will also cover the environment setup on Ubuntu 20.04.
Julia is a free, open-source programming language which can be used to write any kind of application. It is very easy to use, which makes it well suited for those with low technical expertise. The language allows anyone to easily create and share programs that others will be able to use for free and improve upon.
Julia uses multiple dispatch as a paradigm, making it easy to express many object-oriented and functional programming patterns. It provides asynchronous I/O, debugging, logging, profiling, a package manager, and more. Julia also uses the JIT (Just in Time) — compiler which generates native machine code. The JIT compiler provides stability via multiple dispatches, which makes it easy to compile the code into an efficient one.
Julia supports multiple tools, editors (Vim, Emacs, etc) as well as IDEs (Juno, Microsoft Visual Studio, etc). While it is a general-purpose language and can be used to write any application, many of its features are well-suited for numerical analysis and computational science.
Julia was also inducted into the “petaflop club” which was achieved by a Julia application called Celeste. The Celeste team achieved peak performance of 1.54 petaflops using 1.3 million threads on 9,300 Knights Landing (KNL) nodes of the Cori supercomputer at NERSC.
Work on Julia was started in 2009 by MIT researchers Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and Alan Edelman. Julia was envisioned as an open-source (i.e., free) computing language that was both fast and worked at a high level. In 2012, the computer language made its debut to the public and has since climbed up the ranks as one of the world’s most popular programming languages, to the point that many programmers now see it as a potential rival to Python, a stalwart language
The idea of Julia was born when its creators realized that even though computationally expensive tasks like scientific and numerical computing required high performance, domain experts usually went with slower, more dynamic languages for daily programming. Julia’s creators wanted to leverage modern language design and compiler techniques for a single environment that’s powerful enough for prototyping but also has the efficiency for performance-intensive applications.
Some of the key points that make Julia stand out from other programming languages include-
Although Julia is a very powerful programming language, it does have a few limitations that include-
Now that we have a more thorough understanding about Julia, it is time to dive into the installation of the language on your OS. The following sections will teach you how to install Julia on Ubuntu (version 20.04).
Julia offers portable binary distributions for windows, MacOS, Linux and Free BSD. You can download the binary distribution for your OS from here. Julia offers at most four active branches, namely master, unstable, stable, and LTS.
Apart from binaries, Julia also provides docker images and JuliaPro (by Julia Computing), which includes Julia and the Juno IDE, along with access to a curated set of packages for plotting, optimization, machine learning, databases and much more. You have to follow a registration process to download JuliaPro.
I would suggest you download binaries from either the stable or LTS (If you don’t want to update often) branch or go for JuliaPro. Note: For installation on non-linux distributions, follow this link: click here/
wget https://julialang-s3.julialang.org/bin/linux/x64/1.0/julia-1.0.5-linux-x86_64.tar.gz
tar -C /path/to/juliadir -xvzf julia-1.0.5-linux-x86_64.tar.gz
nano ~/.bashrc export PATH=”$PATH:/path/to/juliadir/bin”
source ~/.bashrc
All done. Now let’s see if you can invoke Julia’s REP. Type the following in your terminal-
julia
If all the steps were followed correctly, you should now see a screen similar to below:
Note: You can skip this part if you’ve installed JuliaPro, since it includes Juno IDE (an IDE based on Atom).
Julia supports various editors like VSCode, Atom, Emacs, Sublime, Vim, Notepad++ and IDEs like IntelliJ.
If Atom is not installed in your system, follow the instructions given at https://atom.io/
Head over to the package installation settings and search for uber-juno and click the install button. Once installed, try opening the REPL with Juno > Open REPL or Ctrl-J Ctrl-O (Cmd-J Cmd-O on macOS), and then press Enter in the REPL to start a Julia session.
If VSCode is not installed in your system, follow the instructions given at https://code.visualstudio.com/
Inside VS Code, go to the extensions view either by executing the View: Show Extensions command (click View->Command Palette…) or by clicking on the extension icon on the left side of the VS Code window.
In the extensions view, simply search for the term julia in the marketplace search box, then select the Julia extension and click the install button.
You might have to restart VS Code after this step.
If the extension does not find your Julia installation automatically, or if you want to use a different Julia installation than the default one, you can set the julia.executablePath to the full path of Julia executable that the extension should use. In that case the extension will always use that version of Julia. To do this, follow the below steps:
Note: If steps for an IDE of your choice is not listed here, follow the above specified official links corresponding to your IDE.
That’s it. We’ve covered how to install Julia. In the next article, we’ll discuss familiarize with Julia’s REPL, packages and basic I/O.