{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Introduction" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## About this course\n", "\n", "In this one-day introductory course into Julia, I want to provide a condensed, high-level overview.\n", "In my presentation of the material I will focus on discussing key concepts of the language\n", "by examples and small exercises ([with solutions](Solutions_to_Exercises.ipynb)),\n", "which in many cases only scetch the surface.\n", "Still, these should provide you with first insight how Julia works,\n", "show you what is similar and\n", "what is different to programming languages you might know.\n", "I hope after the day you will be a little more curious about Julia\n", "and well-equipped with pointers and the necessary background to \n", "keep exploring for yourself.\n", "For this plenty of great Julia teaching material\n", "is already available. You can find it either links directly in these notes or\n", "on the [course website](https://michael-herbst.com/teaching/2019-julia-day-jussieu/).\n", "\n", "For my examples I will mostly draw from my own background in computational chemistry and physics.\n", "Especially in these fields one of the challenges is to combine researchers from different backgrounds,\n", "an aspect for which Julia is excellently suited in my opinion.\n", "But of course that's not the only domain in which Julia is used. Others include data science or mathematical optimisation.\n", "\n", "For the course familiarity with key programming concepts\n", "such as braching, loops, classes, ... as well as some familiarity with a wide-spread languages such as `C++`, `python`, `FORTRAN` or similar is assumed throughout the course." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Installing Julia\n", "\n", "For following the course you will need at least Julia 1.0, but for full compatibility **Julia 1.2** or **Julia 1.3** is recommended.\n", "Julia can be easily obtained in binary form from [Julia downloads](https://julialang.org/downloads/).\n", "[Installation instructions](https://julialang.org/downloads/platform.html) specific to your operating systems\n", "are available. In general it really just boils down to downloading a tarball and unpacking it.\n", "\n", "If you want, [compiling Julia from source](https://github.com/JuliaLang/julia/releases/download/) is possible as well." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Installing Jupyter and IJulia\n", "\n", "For the course we will be working with Jupyter notebooks (like the one you are currently reading).\n", "For obtaining Jupyter and integrating it with Julia, follow these instructions ([or read the more detailed version](https://github.com/JuliaLang/IJulia.jl)):\n", "\n", "1. Install Jupyter notebook. For Linux choose your favourite package manager, like\n", "```bash\n", "apt install jupyter jupyter-notebook\n", "```\n", "for debian or\n", "```bash\n", "pip install jupyter\n", "```\n", "if you prefer PyPi packages. For Mac use `brew install jupyterlab`.\n", "\n", "2. Install `IJulia` inside Julia. For this run\n", "```bash\n", "/path/to/juliafolder/bin/julia -e 'import Pkg; Pkg.add(\"IJulia\")'\n", "```\n", "in your terminal, where `/path/to/juliafolder` is the path into which you unpacked the `julia` tarball, which you have obtained in the previous step." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Obtaining the course files\n", "\n", "The last thing you need for the course are the notebook files themselves. These are available [on github](https://github.com/mfherbst/course_julia_day) and you can easily clone them with git:\n", "```bash\n", "git clone https://github.com/mfherbst/course_julia_day\n", "```\n", "Once this command is finished, you'll have a folder `course_julia_day`. Just `cd` into it and start the `jupyter notebook`:\n", "```bash\n", "cd course_julia_day\n", "jupyter notebook .\n", "```\n", "to fire up a browser ready to work on the course material." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## About Julia\n", "\n", "Before we [start digging](01_Variables_Control_Packages.ipynb) in the lovely world of Julia, let me loose a few words about the language itself.\n", "\n", "The idea of Julia is about 10 years old and the project was started by Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and Alan Edelman with the desire to create a language, which is both fast and high-level.\n", "In this spirit Julia thrives on the idea to end the traditional trade-off between performance and convenience in programming. For this Julia takes ideas from high-level languages like python, MATLAB or Perl, but also from functional languages like Lisp. This year the makers of Julia have been awarded with the James H. Wilkinson Prize for numerical software.\n", "\n", "The fundamental difference to many languages including C++ and Python is,\n", "that Julia is both high-level *and* compiled: In Julia types are dynamically inferred\n", "at runtime like in scripting languages, but still the first call to a function triggers a compilation\n", "of the respective code segment to *machine* code, running *natively* on the CPU / GPU.\n", "This is called **just-in-time compilation** (JIT)\n", "and is hardly a new concept. Interesting in Julia is, however, the combination with Julia's strong\n", "type system and a concept called multiple dispatch with the compilation process.\n", "In the latter the idea is to determine the precise functionality of a statement is doing\n", "by looking at the types of *all* the arguments.\n", "As we will see in examples later this\n", "- increases code reuse\n", "- allows for strong decoupling of libraries and code segments\n", "- allows the Julia compiler be very clever: Special cases or hardware details can be exploited during compilation.\n", "\n", "The latter aspect makes Julia programs behave unusual from time to time\n", "in the sense that a code which is for example very fast in Python can be slow in Julia,\n", "if written in the same way. So as always: There is no free lunch. Still, from my experience\n", "the ratio between coding time versus obtained performance is extremly good in Julia.\n", "With respect to performance it sohuld be noted, that Julia is one of the three programming languages\n", "which have been scaled to complete supercomputer (the others are C++ and FORTRAN).\n", "For details see the [blog articles](https://juliacomputing.com/blog/2019/04/12/Supercomputing-julia.html)\n", "and the [website](https://juliacomputing.com/case-studies/celeste.html) on the celeste project.\n", "\n", "A few more key characteristics of Julia in keywords:\n", "- **Dynamic-typed language with automatic type-inference**\n", "- **Stable:** Julia 1.0.0 is a long-term support release (until the next dedicated LTS is released)\n", "- **Cross-language support:** Easily use C++, FORTRAN, python, R, Java ... from Julia (and in some cases the other way round, too)\n", "- **Builtin package manager**\n", "- **Unicode support** inside the core language\n", "- **Green threading** and **distributed computing**\n", "- **Macros** are part of the language\n", "- **Rich set of packages**: GPU, Threading, Distributed computing, Plotting, Visualisation, Optimisation, Automatic differentiation, Machine Learning, PDEs ..." ] } ], "metadata": { "kernelspec": { "display_name": "Julia 1.3.0", "language": "julia", "name": "julia-1.3" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "1.3.0" } }, "nbformat": 4, "nbformat_minor": 2 }