---
# System prepended metadata

title: ICON workshop 2023-11-23
tags: [workshop]

---

# ICON workshop

## last year material

- [workshop PR](https://github.com/GridTools/gt4py/pull/1051)
- [Slides](https://github.com/havogt/intro_to_gt4py)
- [dawn workshop notebook]()
- [dawn workshop repo](https://github.com/dawn-ico/dusk-dawn-notebook)

## brainstorming

- add jupyter + Python intro (if time)
- add numpy example to start
- update old workshop material to new gt4py
- idea for new examples:
    - dawn examples which have visualization
    - find a diffusion (or other things) that allow visualization

## TODOs

- [ ] Update old PR to new GT4Py (Nikki, Christoph)
- [ ] Add `where` example


## Workshop structure:
- Start with demo to open Jupyter Notebook and all imports (make instructions doc on the side for later reference)

Exercises structure: pseudo code provided, for them to do: numpy and gt4py versions
- For exercises - every step should be visualized:
    - simple addition
    - more complex operation
    - C. divergence, curl and nabla (give interface for numpy function and field operator)
    - C. laplace using the previous 3 field operators, call from program
    - N. domains with where with KOff(1) - special case at nlev
    - scan (microphysics need visualization - ask Chia Rui or David)


## Missing gt4py features

### Required
- embedded `remap()`
- embedded `neighbor_sum()`
    
### Optional
- expose dtypes and scalars from `core._definitions`
- add new field constructors `ones_like`, `zeros_like`, `full_like`

### Related PRs

- [feat[next]: add where to embedded field view #1316](https://github.com/GridTools/gt4py/pull/1316)
- [feature[next]: Cartesian connectivity for embedded #1309](https://github.com/GridTools/gt4py/pull/1309)

## Agenda

```
9:00 Intro 
9:30 Setup
9:45 exercise interleaved with presentation (45 min)
10:30 coffee break
10:45 continue with exercises (1h 15 min)
12:00 lunch
13:00 continue with exercises (1h 30 min)
14:45 ICON4Py overview
15:15 feedback (coffee break after)
```

## Environment on Daint

What Tim suggests is to make a central conda environment with all the dependencies and provide a script for each user to run first thing, which creates the jupyter kernel for them.

If people are not going to use their personal cscs accounts but ones just for the workshop we can just run the script on each of them beforehand ourselves.

Also the env file needs to be in the home folder, which we can include in the script for setting up the ephemeral accounts, but for the first option we should make sure not to overwrite theirs if they have one.

Ok, here is what I have. No time for rigorous testing, but daint will be available tomorrow

Steps for each user:

- this needs to be run from their home folder:
    `bash /apps/daint/UES/6.0.UP04/sandboxes/gt4py-workshop/setup-script.sh`
- it should back up the `jupyterhub env` file if it exists
- after that the users’s Jupyterhub server can be started and `gt4py-workshop-2023-11` should show up as a kernel choice when creating new notebooks.

That one automatically uses the right env, `apps/daint/UES/6.0.UP04/sandboxes/gt4py-workshop/wsenv202311` and loads the modules in `apps/daint/UES/6.0.UP04/sandboxes/gt4py-workshop/jupyterhub.env`.

The gt4py version in the `ws202311` environment was installed via `pip install gt4py[full,cuda11x,performance]` in the parent folder with the environment activated (there is a `gt4py` repo clone there)

To edit the environment I would recommend activating it: `/apps/daint/UES/6.0.UP04/sandboxes/gt4py-workshop/miniconda3/bin/conda init bash` (replace bash with what you actually use) followed by `conda activate /apps/daint/UES/6.0.UP04/sandboxes/gt4py-workshop/wsenv202311`.

