Skip to content

steerapi/julia

 
 

Repository files navigation

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

Julia is a high-level, high-performance dynamic language for technical computing. It strives to provide a sophisticated compiler, distributed parallel execution, numerical accuracy, and a robust 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 is an interactive environment with a high performance JIT compiler, with syntax that is familiar to users of other technical computing environments. 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, including Linux, 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 (therefore the environment, which consists of the language, user interfaces, and libraries, is under the GPL). 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.
## 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.

No installation is required; julia is currently run from the directory where it was built. You might, however, want to make a symbolic link for the executable, for example ln -s JULIA_PATH/julia ~/bin/julia. Please note that 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).

Congratulations, if you've gotten this far, you are ready to try out Julia. 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
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.

About

The Julia Language - A fresh approach to technical computing - Forked to add social coding features.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 50.6%
  • Objective-J 23.1%
  • C++ 14.1%
  • Scheme 6.5%
  • Assembly 3.9%
  • Objective-C 0.8%
  • Other 1.0%