ICCS Summer school 2023
2024-11-07
Over the ML sessions at the summer school we have learnt about:
using:
See review of Kashinath et al. (2021)
Climate models are large, complex, many-part systems.
We typically think of Deep Learning as an end-to-end process;
a black box with an input and an output.
Who’s that Pokémon?
\[\begin{bmatrix}\vdots\\a_{23}\\a_{24}\\a_{25}\\a_{26}\\a_{27}\\\vdots\\\end{bmatrix}=\begin{bmatrix}\vdots\\0\\0\\1\\0\\0\\\vdots\\\end{bmatrix}\] It’s Pikachu!
Neural Net by 3Blue1Brown under fair dealing.
Pikachu © The Pokemon Company, used under fair dealing.
Neural Net by 3Blue1Brown under fair dealing.
Pikachu © The Pokemon Company, used under fair dealing.
2 approaches:
Additional challenges:
Image by Earth Lab
Line plot image from Bi et al. (2023)
Global image from NVIDIA FourCastNet
How should we prepare our training data?
Image by NASA
There is a wide variety of ways to structure a Neural Net.
What is the most appropriate for our application.
What are potentiall pitfalls - don’t go in blind with an ML hammer!
Case study of Ukkonen (2022) for emulating radiative transfer:
Many ML applications in climate science are more complex than other classical applications.
Your NN is perfectly happy to have ‘negative rain’.
How easy is it to redeploy a ML model? - exactly what has it learned?
Replacing physics-based components of larger models (emulation or data-driven) requires care.
Mathematical Bridge by cmglee used under CC BY-SA 3.0
Ideally need to:
Python
env
Python
runtime
xkcd #1987 by Randall Munroe, used under CC BY-NC 2.5
Ftorch and TF-lib
Ftorch and TF-lib
Ftorch and TF-lib
Ftorch and TF-lib
Neccessary imports:
use, intrinsic :: iso_c_binding, only: c_int64_t, c_float, c_char, &
c_null_char, c_ptr, c_loc
use ftorch
Loading a pytorch model:
Tensor creation from Fortran arrays:
! Fortran variables
real, dimension(:,:), target :: SST, model_output
! C/Torch variables
integer(c_int), parameter :: dims_T = 2
integer(c_int64_t) :: shape_T(dims_T)
integer(c_int), parameter :: n_inputs = 1
type(torch_tensor), dimension(n_inputs), target :: model_inputs
type(torch_tensor) :: model_output_T
shape_T = shape(SST)
model_inputs(1) = torch_tensor_from_blob(c_loc(SST), dims_T, shape_T &
torch_kFloat64, torch_kCPU)
model_output = torch_tensor_from_blob(c_loc(output), dims_T, shape_T, &
torch_kFloat64, torch_kCPU)
Running the model
Cleaning up:
These slides can be viewed at:
https://cambridge-iccs.github.io/practical-ml-with-pytorch
The html and source can be found on GitHub.
For more information we can be reached at:
Jack Atkinson
You can also contact the ICCS, make a resource allocation request, or visit us at the Summer School RSE Helpdesk.