Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
The Julia Language: a fresh approach to technical computing.
C C++ FORTRAN Scheme JavaScript Assembly Other

This branch is 1 commit ahead, 16304 commits behind JuliaLang:jb/newnodes

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
attic
contrib
doc
examples
external
install
j
src
test
ui
.gitignore
.mailmap
LICENSE
Make.inc
Makefile
README.md
VERSION
lib

README.md

               _
   _       _ _(_)_     |
  (_)     | (_) (_)    |   A fresh approach to technical computing
   _ _   _| |_  __ _   |
  | | | | | | |/ _` |  |           http://julialang.org
  | | |_| | | | (_| |  |       julia-math@googlegroups.com
 _/ |\__'_|_|_|\__'_|  |
|__/                   |

The Julia Language

Julia is a high-level, high-performance dynamic language for technical computing, with syntax that is familiar to users of other technical computing environments. It provides a sophisticated compiler, distributed parallel execution, numerical accuracy, and an extensive mathematical function library. The library, mostly written in Julia itself, also integrates mature, best-of-breed C and Fortran libraries for linear algebra, random number generation, FFTs, and string processing. More libraries continue to be added over time. Julia programs are organized around defining functions, and overloading them for different combinations of argument types (which can also be user-defined). For a more in-depth discussion of the rationale and advantages of Julia over other systems, see the following highlights or read the introduction in the manual.

High-Performance JIT Compiler

Julia's LLVM-based JIT compiler combined with the language's design allow it to approach and often match the performance of C/C++. The following benchmarks are from a Macbook with 2.1GHz Intel Core 2 Duo:

____________________________________________________________________________________

                      Julia        Matlab      Octave    Python/NumPy    C++ (GCC)
                    46c2c6de       R2011a        3.4      2.7.1/1.5.1    4.6.1 -O3
____________________________________________________________________________________

  fib                  .500        309.        570.           7.49          .179
  parse_int            .210        124.        557.            .630         .151
  mandel              1.82          40.0       260.           9.64          .530
  quicksort            .640         71.0      1611.          30.6           .600
  pi_sum             49.5           69.0     20578.        1289.          49.3
  rand_mat_stat      38.9          139.        517.         363.
____________________________________________________________________________________

      Figure: benchmark time (ms) across various programming system versions.

Julia beats other high-level systems on all micro-benchmarks above. It also comes within a factor of two of optimized C++ on all but two tests, and is never more than four times as slow. Relative performance between languages on other systems is similar. These benchmarks, while not comprehensive, do test compiler performance on a range of common code patterns, such as function calls, string parsing, sorting, numerical loops, random number generation, and array operations.

Note: A C++ implementation of random matrix statistics is missing because this test involves many whole-matrix operations, and it is not clear what an idiomatic implementation would look like.

Designed for Parallelism

Julia does not impose any particular style of parallelism on the user. Instead, it provides a number of key building blocks for distributed computation, making it flexible enough to support a number of styles of parallelism, and allowing users to add more. The following simple example demonstrates how to count the number of heads in a large number of coin tosses in parallel.

nheads = @parallel (+) for i=1:100000000
  randbit()
end

This computation is automatically distributed across all available compute nodes, and the result, reduced by summation (+), is returned at the calling node.

Free, Open Source & Library-Friendly

The core of the Julia implementation is licensed under the MIT license. Various libraries used by the Julia environment include their own licenses such as the GPL, LGPL, and BSD. Core functionality is included in a shared library, so users can easily and legally combine Julia with their own C/Fortran code or proprietary third-party libraries. Furthermore, Julia makes it simple to call external functions in C and Fortran shared libraries, without writing any wrapper code or even recompiling existing code. You can try calling external library functions directly from Julia's interactive prompt, playing with the interface and getting immediate feedback until you get it right. See LICENSE for the full terms of Julia's licensing.

Resources

Required Build Tools & External Libraries

  • GNU make — building dependencies.
  • gcc, g++, gfortran — compiling and linking C, C++ and Fortran code.
  • curl — to automatically download external libraries:
    • LLVM — compiler infrastructure.
    • fdlibm — a portable implementation of much of the system-dependent libm math library's functionality.
    • MT — a fast Mersenne Twister pseudorandom number generator library.
    • OpenBLAS — a fast, open, and maintained basic linear algebra subprograms (BLAS) library, based on Kazushige Goto's famous GotoBLAS.
    • LAPACK — library of linear algebra routines for solving systems of simultaneous linear equations, least-squares solutions of linear systems of equations, eigenvalue problems, and singular value problems.
    • ARPACK — a collection of subroutines designed to solve large, sparse eigenvalue problems.
    • FFTW — library for computing fast Fourier transforms very quickly and efficiently.
    • PCRE — Perl-compatible regular expressions library.
    • GNU readline — library allowing shell-like line editing in the terminal, with history and familiar key bindings.

Supported Platforms

  • GNU/Linux: x86/64 (64-bit); x86 (32-bit).
  • Darwin/OS X: x86/64 (64-bit); x86 (32-bit) is untested but should work.

Binary Installation

Julia's binary installs ship as platform-specific tarballs:

Download the appropriate tarball and untar it somewhere; for example, if you are on an OS X (Darwin) x86/64 system, do the following:

curl -OLk https://github.com/downloads/JuliaLang/julia/julia-08b1e294ed-Darwin-x86_64.tar.gz
tar zxvf julia-08b1e294ed-Darwin-x86_64.tar.gz

You can either run the julia executable using its full path in the directory created above, or add that directory to your executable path so that you can run the julia program from anywhere:

export PATH="$(pwd)/julia:$PATH"

Now you should be able to run julia like this:

julia

If everything works correctly, you will see a Julia banner and an interactive prompt into which you can enter expressions for evaluation. You can read about getting started in the manual.

Source Download & Compilation

First, acquire the source code either by cloning the git repository (requires git to be installed):

git clone git://github.com/JuliaLang/julia.git

or, if you don't have git installed, by using curl and tar to fetch and unpack the source:

mkdir julia && curl -Lk https://github.com/JuliaLang/julia/tarball/master | tar -zxf- -C julia --strip-components 1

Next, enter the julia/ directory and run make to build the julia executable. When compiled the first time, it will automatically download and build its external dependencies. This takes a while, but only has to be done once. Note: the build process will not work if any of the build directory's parent directories have spaces in their names (this is due to a limitation in GNU make).

Once it is built, you can either run the julia executable using its full path in the directory created above, or add that directory to your executable path so that you can run the julia program from anywhere:

export PATH="$(pwd)/julia:$PATH"

Now you should be able to run julia like this:

julia

If everything works correctly, you will see a Julia banner and an interactive prompt into which you can enter expressions for evaluation. You can read about getting started in the manual.

Directories

attic/         old, now-unused code
contrib/       emacs and textmate support for julia
doc/           miscellaneous documentation and notes
examples/      example julia programs
external/      external dependencies
install/       used for creating binary installs
j/             source code for julia's standard library
lib/           shared libraries loaded by julia's standard libraries
src/           source for julia language core
test/          unit and function tests for julia itself
ui/            source for various front ends

Emacs Setup

Add the following line to ~/.emacs

(require 'julia-mode "JULIA_PATH/contrib/julia-mode.el")

where JULIA_PATH is the location of the top-level julia directory.

TextMate Setup

Copy (or symlink) the TextMate Julia bundle into the TextMate application support directory:

cp -r JULIA_PATH/contrib/Julia.tmbundle ~/Library/Application\ Support/TextMate/Bundles/

where JULIA_PATH is the location of the top-level julia directory. Now select from the menu in TextMate Bundles > Bundle Editor > Reload Bundles. Julia should appear as a file type and be automatically detected for files with the .j extension.

Terminal Setup

For best interaction with readline-based command-line interactive sessions, make sure that backspace sends the ^H sequence and that shift-Enter sends a \n newline character (hex 0x0a). The shift-Enter combination inserts a newline in the interactive session without evaluating the current expression, even if the expression is complete. These bindings allow readline to trap and correctly handle these key sequences; most other programs will behave normally with these bindings.

Something went wrong with that request. Please try again.