Skip to content

Commit

Permalink
Merge branch 'main' of github.com:milancurcic/pfml-iccs-talk
Browse files Browse the repository at this point in the history
  • Loading branch information
milancurcic committed Sep 11, 2024
2 parents 76a2be5 + b9db763 commit ba28420
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 29 deletions.
18 changes: 14 additions & 4 deletions slides/fortran-lang.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

## Fortran continues to improve in many ways..

* MPI+Fortran keeps getting better (Thanks, Jeff)
* Native parallel Fortran continues to improve (Thanks, Kate, Damian & CLaSS team)
* Fortran 2028 will bring type-safe generics (Thanks, Tom & The Generics team)
* Latest release is Fortran 2023
* Native and MPI-based parallelism continue to improve
* Fortran 2028 will bring powerful, type-safe, generics
* The modern ecosystem of Fortran tools and libraries is growing rapidly
</section>

Expand All @@ -19,11 +19,21 @@
and the US Fortran Standards Committee
* Supported by the Google Summer of Code Program 4 years in a row (19 student projects to date)
* Grants from the Sovereign Tech Fund in 2022 and 2023
* And now a [NumFOCUS](https://numfocus.org) fiscally sponsored project
* A [NumFOCUS](https://numfocus.org/project/fortran-lang) fiscally sponsored project

</section>


<section>

## Fortran's popularity according to TIOBE

![TIOBE](assets/tiobe_fortran.png)

<div class="reference">Image credit: Jacob Williams</div>
</section>


<section>

## fpm: Fortran Package Manager
Expand Down
9 changes: 5 additions & 4 deletions slides/machine-learning.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

## ...and so it eats the Numerical Weather Prediction (NWP) as well

* We've entered a new revolution in NWP.
* AI NWP models are:
* We've entered a new era of NWP.
* Data-based (AI) NWP models are:
- orders of magnitude faster;
- match or beat the accuracy of traditional models on _some_ metrics.
* New AI models appear rapidly: FourCastNet, GraphCast, PanguWeather, FuXi, NeuralGCM, AtmoRep, ClimaX, STORMER, ACE, StormCast, etc.
* Though extremely useful for prediction, they cannot (yet) replace the traditional physics-based models.
* Though extremely useful for prediction, they can't (yet) replace the physics-based models.
</section>


Expand Down Expand Up @@ -60,10 +60,11 @@ $\rightarrow$ Domain scientist asks: How do I run ML within my Fortran applicati

## Multiple approaches to ML in Fortran

* Two-language disk-based interop, e.g. [Fortran Keras Bridge](https://doi.org/10.1155/2020/8888811)
* PyTorch bindings: [pytorch-fortran](https://github.com/alexeedm/pytorch-fortran), [ftorch](https://github.com/Cambridge-ICCS/FTorch), [torchfort](https://github.com/NVIDIA/TorchFort)
* TensorFlow bindings: [fortran-tf-lib](https://github.com/Cambridge-ICCS/fortran-tf-lib)
* _Pure Fortran ML_:
- Naturally great fit for ML: First-class multi-dimensional arrays, `matmul`, `dot_product`, `sum`, `pack`, `unpack`, `reshape` etc.
- Natural fit for ML: First-class multi-dimensional arrays, `matmul`, `dot_product`, `sum`, `pack`, `unpack`, `reshape` etc.
- Fast linear algebra libraries
- No complexity associated with multi-language applications
- Many Fortran programmers would love to use pure Fortran ML.
Expand Down
42 changes: 36 additions & 6 deletions slides/neural-fortran.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@

## Design principles

1. **Easy to use**: nice, concise, high-level API;
2. **Easy to extend**: modular design;
3. **Be hardware-agnostic**: let the compiler optimize when possible;
4. **Be self-contained**: no external dependencies when possible;
1. **Easy to use**: nice, concise, high-level API
2. **Easy to extend**: modular design
3. **Hardware-agnostic**: let the compiler optimize & accelerate
4. **Self-contained**: no external dependencies when possible
</section>


Expand Down Expand Up @@ -91,7 +91,7 @@ end program simple

<section>

## Creating, training, and running a CNN with neural-fortran
## Convolutional network training and inference

```fortran
use nf
Expand Down Expand Up @@ -125,7 +125,37 @@ print *, net % predict(test_images)

<section>

## More Fortran ML goodness
## nf-keras-hdf5: Load Keras models saved in HDF5

* [https://github.com/neural-fortran/nf-keras-hdf5](https://github.com/neural-fortran/nf-keras-hdf5)
* Optional plugin for neural-fortran
* Instead of defining the network, give it the HDF5 path string

```fortran
program cnn_from_keras
use nf, only: network
type(network) :: net
net = network("keras_cnn_mnist.h5")
! run inference
```
</section>


<section>

## Single-core CPU performance in training

![benchmark_dense_mnist](assets/benchmark_dense_mnist.png)

</section>


<section>

## Other Fortran ML libraries

* [inference-engine](https://github.com/BerkeleyLab/inference-engine) - A deep learning library for HPC applications
* [athena](https://github.com/nedtaylor/athena) - Another ML framework, inspired by neural-fortran
Expand Down
19 changes: 9 additions & 10 deletions slides/takeaways.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
<section>

## Takeaways and some personal outlooks
## Takeaways

* NWP has entered a new revolution with AI models
* Machine Learning is transforming the the NWP and Earth System Modeling enterprise
* Phenomenal *forecasting* tools that won't replace traditional models for *research*
* Pure Fortran ML has its place in Earth System Modeling
* What does the future of Earth System Modeling look like?
- A wide, diverse, spectrum of traditional, AI, and hybrid models
- ML implemented in many languages for respective needs
- Hardware will continue to evolve and remain ahead of software
* Fortran will continue to rock and improve.
* Pure Fortran ML approach may appeal to:
- Domain scientist who mostly work with Fortran-based models
- Fortran enthusiasts
* Fortran the language and its ecosystem of compilers, tools, and libraries
continues to improve
* If you haven't tried modern Fortran before, please do!
</section>


<section>

## Thank you and get off my porch!
😉
## Thank you!
</section>
7 changes: 2 additions & 5 deletions slides/title.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ _September 10, 2024_
* I study ocean waves and their role in the Earth system
* Mix of theory, field and laboratory measurements, and numerical modeling
* I wrote a popular book for Fortran beginners
* I'm not an ML practitioner, but I love learning new things
* I'm not an ML practitioner yet, but I enjoy making useful tools
</section>


Expand Down Expand Up @@ -69,9 +69,6 @@ _September 10, 2024_
introducing an integration complexity when used in Fortran applications.
* **Pure Fortran** ML
- Fortran itself provides all the necessary building blocks for ML,
making a Pure Fortran approach one candidate to integrating ML in physics-based
making a Pure Fortran approach a candidate to applying ML in physics-based
Fortran models.
* **Pure Fortran ML**
- We will look at one candidate solution to this problem and the challenges in
the design and implementation.
</section>

0 comments on commit ba28420

Please sign in to comment.