Skip to content

Commit

Permalink
docs: GSoC
Browse files Browse the repository at this point in the history
  • Loading branch information
junyixu committed Aug 25, 2024
1 parent 76035d7 commit cfdd5bb
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 22 deletions.
1 change: 0 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ makedocs(sitename="TrixiEnzyme.jl",
"Examples" => "examples.md",
"GSoC" => "GSoC.md",
"Notes" => "notes.md",
"Acknowledgments" => "Acknowledgments.md",
"Contact Developer" => "Contact.md",
],
format = Documenter.HTML(prettyurls = false)
Expand Down
6 changes: 0 additions & 6 deletions docs/src/Acknowledgments.md

This file was deleted.

46 changes: 32 additions & 14 deletions docs/src/GSoC.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,37 @@
# Final Report: GSoC '24

- Student Name: Junyi([@junyixu](https://github.com/junyixu)).
- Organization: Trixi Framework community.
- Mentors: Michael([@sloede](https://github.com/sloede)) and Hendrik([@ranocha](https://github.com/ranocha))
- Project: Integrating the Modern CFD Package Trixi.jl with Compiler-Based Auto-Diff via Enzyme.jl
- Project Link: https://github.com/junyixu/TrixiEnzyme.jl

## Project Overview
Trixi.jl is a numerical simulation framework for conservation laws written in Julia. The integration of Trixi.jl with Compiler-Based (LLVM level) automatic differentiation via Enzyme.jl offers the following benefits: facilitates rapid forward mode AD, enables reverse mode AD, supports cross-language AD, and critically, supports mutating operations and caching, on which Trixi.jl relies, to enhance the performance of both simulation runs and AD. The final deliverable will include as many of Trixi's advanced features as possible, such as adaptive mesh refinement, shock capturing, etc., showcasing the benefits of differentiable programming in Julia's ecosystem.

## Pre-GSoC24
- The GSoC proposal: Integrating the Modern CFD Package Trixi.jl with Compiler-Based Auto-Diff via Enzyme.jl (see PDF)
- Implemented AD with pure Julia personally using guidance from a [blog](https://blog.rogerluo.dev/2018/10/23/write-an-ad-in-one-day/)

## GSoC24
- [X] Forward mode AD for DG
- [X] Reverse mode AD for DG
- [ ] Make reverse mode AD work with Polyester.jl
- [x] Improve performance
- [x] Reduce parameters passed to Enzyme
- [X] Investigating `init_elements` and `init_interfaces`
- [x] Extract `elements._surface_flux_values` and `cache.interfaces._u`
- [x] `chunksize` for Jacobians
- [X] Implemented a [prototype](https://github.com/junyixu/enzyme_MWE/blob/81365fb0ae848bcae592292ca5d9cc82ace53df9/valilla_upwind.jl#L85-L109) for picking the chunk/batch size for the toy model
- [x] Further optimize for memory bandwidth
- [X] explore Enzyme custom rules

## Future Work
- [ ] Integrate Enzyme with GPU kernels
- **Forward Mode Automatic Differentiation (AD) for Discontinuous Galerkin Collocation Spectral Element Method (DGSEM)**: Implement forward mode automatic differentiation to enhance the calculation of derivatives in DG methods, improving computational efficiency and accuracy for various applications.
- **Reverse Mode Automatic Differentiation for DG**.
- **Improve Performance**:
- **Extract Parameters Passed to Enzyme**: Implement a systematic approach to extract and manage parameters passed to Enzyme, ensuring optimal configuration and efficiency in the execution of AD tasks.
- **`batchsize` for Jacobians**:
- **Optimize for Memory Bandwidth**: Fine-tune the batch size in Jacobian computations to optimize the use of memory bandwidth, thus improving the overall performance and speed of the computations.
- **Automatically Pick `batchsize`**
- **Explore Enzyme Custom Rules**: Investigate and implement custom rules within the Enzyme AD framework to handle specific cases and operations that are not optimally managed by the default settings, enhancing the flexibility and capability of the AD processes.

Please note that the last step was planned but remains incomplete due to time constraints and this step will be completed in the future if possible.

## Constraints and Future Work
- **Make Reverse Mode AD Work with Polyester.jl**: Address compatibility issues and integrate reverse mode AD with Polyester.jl for multithreading capabilities, aiming to enhance performance and scalability of the AD operations across different computing environments.
- **Integrate Enzyme with GPU Kernels**: Extend the functionality of Enzyme by integrating it with GPU kernels, allowing AD operations to leverage the parallel processing power of GPUs.

## Acknowledgments

The entire project, along with this blog website, is developed and maintained by Junyi([@junyixu](https://github.com/junyixu)).
The whole project is under the guidance of two outstanding professors, Michael([@sloede](https://github.com/sloede)) and Hendrik([@ranocha](https://github.com/ranocha)), from Trixi Framework community.

The project also received support from other Julia contributors, including Benedict from Trixi Framework community.
3 changes: 2 additions & 1 deletion docs/src/examples.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Examples

## scalar linear advection equation in 1D
## Scalar linear advection equation in 1D
We will implement the scalar linear advection equation in 1D with the advection velocity 1 and compute its Jacobian.
```
using Trixi
Expand Down Expand Up @@ -28,6 +28,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_sine_wave
J1 = jacobian_ad_forward(semi)
J2 = jacobian_enzyme_forward(semi;N=1)
J3 = jacobian_enzyme_reverse(semi;N=1)
J1 == J2
```

0 comments on commit cfdd5bb

Please sign in to comment.