Welcome to the interactive hands-on tutorial for Devito. Devito is a domain-specific language (DSL) and code generation framework for the design of highly optimised finite difference kernels, and was primarily designed for use in seismic inversion methods. Devito utilises SymPy to allow the definition of matrix-free finite difference operators from high-level symbolic equations and generates optimised and automatically tuned code specific to a given target architecture.

This hands-on tutorial is intended to give you an initial flavour of the Devito framework and the power of symbolic computation. We will demonstrate how quickly explicit finite difference operators can be created from only a few lines of Python code, and how we can use them to implement complex imaging algorithms in very little time (literally!). For a more in-depth overview (and as cheat-sheet if you can speed read), you can find another set of tutorial notebooks on our webpage that go through the covered topics in more detail.

On entering the tutorial you should have been given an IP address for your own cloud instance that contains the full setup for this tutorial. To get started, you should log into this node and execute the following commands to start the Jupyter Notebook server:

```
cd devcon-tutorial
jupyter notebook
```

Once that is setup you should simply open the following in your browser:

`http://<instance_ip>:9889`

Now you should see a set of Jupyter notebooks, inlcuding this one called `00_index.ipynb`

. The procedure is explained in more detail here.

```
In [ ]:
```from devito import *
from examples.seismic import model, source

```
In [ ]:
```import yask

- How to use SymPy and Devito to create simple finite difference expressions from governing equations
- Creating Devito operators to perform highly optimized stencil computations from the symbolic kernel definitions
- Create basic seismic modelling operator to model wave propagation for a seismic survey
- Implement a functional FWI algorithm usign high-level components from Devito and
`scipy.optimize`

- Gain an overview of the various performance optimization techniques used in Devito operators
- Get a "sneak-preview" of the new backend that allows individual parts to be offload to the YASK stencil DSL

Session 1:

**Introduction to Devito**- Functions and derivatives
**[5min]** - Exercise: A linear convection operator
**[10min]** - Second derivatives and high-order stencils
**[5min]** - Exercise 2: Making a wave!
**[10min]**

- Functions and derivatives
Session 2:

**Seismic Imaging**

- Session 3:
**Performance Optimization and Analysis**- Introduction to performance optimization in Devito
**[2min]** - Setup for shared-memory parallelism
**[5min]** - Devito Symbolic Engine (DSE)
**[5min]** - Devito Loop Engine (DLE)
**[5min]** - Exercise 4: performance analysis of a TTI forward operator
**[8min]** - A sneak peek at the YASK backend
**[5min]**

- Introduction to performance optimization in Devito

- Opesci project webpage
- More detailed introductory tutorials, covering the following topics:
- Introduction to Devito with CFD
- Introdcution to seismic imaging

M. Lange, N. Kukreja, F. Luporini, M. Louboutin, C. Yount, J. Hückelheim and G. Gorman. Optimised finite difference computation from symbolic equations. Accepted for publication in Proceedings of the 15th Python in Science Conference, 2017. [doi:10.25080/shinma-7f4c6e7-00d] [arxiv]

M. Louboutin, M. Lange, N. Kukreja, F. Herrmann, and G. Gorman.

*Performance prediction of finite-difference solvers for different computer architectures*. Accepted for publication in Computers & Geosciences, 2016, doi:10.1016/j.cageo.2017.04.014