Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 4102/5102 Team Project Matthew Beaulieu Kirk Gardner.

Similar presentations


Presentation on theme: "CSE 4102/5102 Team Project Matthew Beaulieu Kirk Gardner."— Presentation transcript:

1 CSE 4102/5102 Team Project Matthew Beaulieu Kirk Gardner

2 Overview Julia is a high-level, dynamic programming language.
Created to overcome the programming time vs. runtime problem. Designed for high-performance numerical analysis and computational science. No need for fast separate compilation. Compiles on the fly using LLVM just-in-time (JIT) compiler. Easy parallel and distributed computing. Parallelize directly from command line by calling the desired script with a given number of cores. Over 1500 built-in packages.

3 Real World Applications
Julia is continuously proving itself as a very effective tool for data science and machine learning. A faster high-level alternative to Python, R, and MATLAB, which have recently become more popular for data science. A better substitute for C,C++, and Fortran, when it comes to data science and machine learning. Julia uses garbage collection, while C/C++ uses manual memory management as its default. The standard library of C/C++ is relatively small and Julia tries to have batteries included which is a much larger and better library.

4 Real World Applications (cont.)
Has attracted high-profile clients including. Investment manager BlackRock for time series analytics. Insurer Aviva for risk calculations. The Federal Reserve Bank of New York used Julia to make models of the US economy. Noted that model estimation “about 10 times faster” than before (using MATLAB). The Celeste project used Julia to achieve “peak performance” of 1.54 petaflop using 1.3 million threads. Ran on Knights Landing nodes of the Cori supercomputer (8th fastest in the word). Joins C, C++, and Fortran as high-level languages in which petaflop computations have been written.

5 Performance Approaches that of statically-types languages like C

6 Influences Julia is a principle design that derives from the experiences of past programming languages with multiple dispatch, the type system and metaprogramming. A need to be accessible to those transitioning from other languages like Python and Matlab. A need to be fast, compiles on the fly using LLVM just-in-time (JIT) compiler. Much of the surface syntax is implemented from other languages like Matlab, Octave and Scilab.

7 Programming Paradigm Fully dynamic type system with parametric polymorphism. Multi-paradigm: Multiple Dispatch (object-oriented), Procedural, Functional, Meta, Multi-staged.

8 Implementation Core is implemented in
Julia. C (LLVM Dependency in C++). Assembly and its parser in Scheme (FemtoLisp). LLVM is used as the back-end for generation of optimized machine code. 64 or 32-bit depending on the platform. Standard library is fully implemented in Julia. Floating point calculations. Linear algebra. Random number generation. Fast fourier transforms (using FFTW). Regular expression matching.

9 Functions A function is an object that maps a tuple of arguments to a return value. Exception if no appropriate value can be returned. Each possible behavior of a function is a method.

10 Multiple Dispatch Ability to define function behavior across many combinations of argument types. Choose which method to call based on the number of arguments given and each of their types.

11 Multiple Dispatch Ability to define function behavior across many combinations of argument types. Choose which method to call based on the number of arguments given and each of their types. Traditionally dispatch occurs based only on the first argument. Unnatural for mathematical code: Does x + y belong to x any more than it does to y?

12 Typing (Dynamic) Optional typing: Helps in generating efficient code.
Allows method dispatch on the types of function arguments to be deeply integrated in the language.

13 Typing (Nominative) Typing in Julia is dynamic as well as:
Nominative: hierarchical relationships between types are explicitly declared. e.x. Bool, Int8, and UInt8 have identical representations: 8-bit chunks of memory.

14 Typing (Parametric) Typing in Julia is dynamic as well as
Nominative: hierarchical relationships between types are explicitly declared. Parametric: generic types can be parameterized. e.x. the following generic Point DataType:

15 Typing (cont.) Concrete types may not subtype each other.
May only have abstract types as their supertypes. Types inherit behavior instead of structure. How methods act on an object is more important than object’s shared structure.

16 Typing (cont.) Concrete types may not subtype each other.
May only have abstract types as their supertypes. Types inherit behavior instead of structure How methods act on an object is more important than object’s shared structure.

17 Control Flow Compound Expressions: Conditional Evaluation:
begin blocks and (;) chains Conditional Evaluation: if-elseif-else and ?: (ternary operator) Short-Circuit Evaluation: &&, ||, and chained comparisons Repeated Evaluation Loops: while and for Exception Handling: try-catch, error(), and throw() Tasks (coroutines): yieldto()

18 Compound Expressions Single expression which evaluates several subexpressions in order, returning the value of the last. begin blocks (;) chains

19 Conditional Evaluation
if-elseif-else conditional syntax: “leaky”: do not introduce a local scope. variables defined in an if statement persist. “ternary operator” ?: associates from left to right. expressions before and after : are only evaluated if the condition evaluates to true or false respectively.

20 Short-Circuit Evaluation
Boolean operators && and || use short-circuit evaluation, & and | do not. a && b only evaluates b if a is true, a || b only evaluates b if a is false.

21 Tasks Allows computations to be suspended and resumed.
If the execution of a function is designated as a Task it can be interrupted by switching to another Task. The initial Task can be resumed where it left off. yieldto(task)suspends the current task and switches to the specified task.

22 Tasks (cont.) A Channel is a waitable first-in-first-out queue with multiple tasks reading and writing to it. Values are produced using put!()and consumed using take!().

23 Tasks (cont.) A Channel is a waitable first-in-first-out queue with multiple tasks reading and writing to it. Values are produced using put!()and consumed using take!(). A Channel object is iterable. loop variable takes on all the produced values.

24 Variable Scope Lexical (static) scoping: function’s scope inherits from the scope in which the function was defined. Global Scope: module, baremodule, and REPL. Local Scope: variables introduced in a local scope do not back-propagate to its parent scope, all variables in a parent scope are inherited by a local scope unless marked by the keyword local. Soft Local Scope: for, while, comprehensions, try-catch, and let Hard Local Scope: will not inherit variables which will result in a modified global variable. functions, struct, and macro. begin and if blocks do not introduce a new scope.

25 Modules Separate variable workspaces.
Introduce a new global scope. Defined inside module Name … end. import names from other modules, export names intended to be public. using Lib means that a module Lib will be available for resolving names as needed. The import keyword support the same syntax as using but only operates on a single name at a time. import must be used in order to extend functions in a module with new methods. importall explicitly imports all names exported by the specified module.

26 Modules (cont.) module MyModule export x,y x() = “x” y() = “y”
p() = “p” end

27 Process Management REPL “shell mode”.
Type ; from REPL to enter shell mode. Powerful shell-like abilities to manage other processes. Backtick `...` syntax for shell commands: Supports string Interpolation. Quoting. Pipelines.

28 Low Level Parallelization
A remote call returns a Future to its result. You may wait for a remote call to finish by calling wait() on the returned Future. Obtain the full value of the result using fetch() A RemoteChannel is rewritable. Multiple processes can coordinate their processing by referencing the same RemoteChannel. Start Julia with 2 processes Remote call rand(3,4) to process 2 run 1 .+ fetch(r) from process 2 fetch the result from current process (1)

29 High Level Parallelization
@parallel macro with a reduction function which combines each result into a final result. @parallel macro with a SharedArray.

30 Additional Features Built in package manager:
Binaries can be provided using integration with Homebrew.jl, AptGet, and WinRPM.jl. Call C programs natively, other languages including Python and R with additional packages. Macros and Metaprogramming. Powerful reflective capabilities. Lightweight green threading for tasks. Lightweight emulation of multithreaded environments without relying on native OS capabilities. User-defined types are as fast/compact as built-ins Supported by Jupyter for online interactive notebook environments.


Download ppt "CSE 4102/5102 Team Project Matthew Beaulieu Kirk Gardner."

Similar presentations


Ads by Google