Although this course is language agnostic, we will use Julia to demonstrate various algorithms. It is a high-level language for scientific computing that provides exceptional run-time performance, approaching that of statically-compiled languages like C. The software is free and open source and is under active development.
If you are already familiar with MATLAB, R, or Python, see this list of notable differences.
There are many ways to get going with Julia. Here are some options:
Run Julia on Stanford FarmShare or FarmShare2. All you need to do is ssh into corn.stanford.edu or rice.stanford.edu to access the shared computing enviornment. The default version of Julia available on the machines is 0.5. To use the latest Julia 0.6, first load the julia module:
$ module load julia $ julia --version julia version 0.6.0
Run Julia in the cloud on JuliaBox. You will want to make sure to back up your code to a Google Drive folder or a Git repository to reduce the risk of losing your work. Also, be sure not to exceed 500MB, otherwise your older files will be lost.
Note: Please be sure you are using Julia version 0.6.x!
To install the course software on your local machine, complete the steps outlined here.
Note: Throughout this section, lines beginning with
julia> should be run in the Julia REPL.
Note: If anything goes wrong, see Troubleshooting below.
Install Julia 0.6: Instructions
To install Jupyter, Start Julia and run
Install the course code
$PATH_TO_AA228_NOTEBOOKwith the path to the aa228-notebook directory.
julia> using IJulia julia> notebook(dir="$PATH_TO_AA228_NOTEBOOK")
Potential fixes for things that could go wrong.
First, check to see if IJulia was able to install it.
julia> Pkg.add("IJulia") will download the IJulia Julia package, and, if you do not already have jupyter, this will automatically install it via miniconda via the Conda.jl package.
To test the installation, in Julia, run
julia> using IJulia julia> notebook()
This should open a jupyter notebook browser in the current directory. If this doesn’t work, jupyter may not be installed correctly.
If you are using Windows and you get the message
failed to create process, it is likely that you have spaces in the file path (if you are in this situation please contact Jayesh at email@example.com so I can verify that these instructions are correct).
julia> Pkg.dir(). If there are, one workaround is to install Miniconda in a path that does not have spaces:
conda install jupyter
jupyter notebookand try creating a new Julia 0.6 notebook.
Note: If you use this workaround, you may need to manually install dependencies for other packages (such as
conda instead of from within julia, and you may have to notify julia of your Anaconda installation with
julia> ENV["PYTHON"]="C:\\Miniconda3\\python.exe; Pkg.build("PyCall").
HDF5 is a data storage library (the same that is used in Matlab’s .mat files). Julia should automatically download and install the library, but you may need to do it manually. More instructions are at the HDF5.jl repo
sudo apt-get install hdf5-tools
If you get an error similar to
Error saving as SVG could not spawn `pdf2svg tikzpicture.pdf tikzpicture.svg`: no such file or directory (ENOENT)
You need to have
pdf2svg installed on your machine. If on OSX, run:
brew install pdf2svg
sudo apt-get install pdf2svg
If on Windows, download this: https://github.com/jalios/pdf2svg-windows/archive/master.zip. Extract the zip file where you want to keep it. Then add the directory inside called “dist-64bits” to your path. Instructions on how to do this can be found here.
And make sure that you add pdf2svg to your path, regardless of your platform, so that you can run “pdf2svg” from the terminal.
If you get an error similar to:
Error saving as SVG could not spawn `lualatex --enable-write18 --output-directory=. tikzpicture`: no such file or directory (ENOENT)
To get plotting to work, I recommend installing texlive (either through your package manager on linux [texlive-extra-utils on ubuntu I believe] or from https://www.tug.org/texlive/quickinstall.html) or from https://www.tug.org/texlive/acquire-netinstall.html.