From cfdd5bb325b12d20c376992b997d91118ab4f700 Mon Sep 17 00:00:00 2001 From: Junyi Xu Date: Sun, 25 Aug 2024 22:20:20 +0800 Subject: [PATCH] docs: GSoC --- docs/make.jl | 1 - docs/src/Acknowledgments.md | 6 ----- docs/src/GSoC.md | 46 ++++++++++++++++++++++++++----------- docs/src/examples.md | 3 ++- 4 files changed, 34 insertions(+), 22 deletions(-) delete mode 100644 docs/src/Acknowledgments.md diff --git a/docs/make.jl b/docs/make.jl index ff4da05..269896c 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -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) diff --git a/docs/src/Acknowledgments.md b/docs/src/Acknowledgments.md deleted file mode 100644 index 541a3e7..0000000 --- a/docs/src/Acknowledgments.md +++ /dev/null @@ -1,6 +0,0 @@ -# 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. diff --git a/docs/src/GSoC.md b/docs/src/GSoC.md index e8d3726..e6d3bf2 100644 --- a/docs/src/GSoC.md +++ b/docs/src/GSoC.md @@ -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. diff --git a/docs/src/examples.md b/docs/src/examples.md index c0ad8c9..d403c9c 100644 --- a/docs/src/examples.md +++ b/docs/src/examples.md @@ -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 @@ -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 ```