Skip to content

Commit

Permalink
chore:
Browse files Browse the repository at this point in the history
1. docs
2. UpwindTest
  • Loading branch information
junyixu committed Aug 25, 2024
1 parent cfdd5bb commit 849927d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,25 @@
integrates Trixi.jl with Compiler-Based (LLVM level) automatic differentiation via [Enzyme.jl](https://github.com/EnzymeAD/Enzyme.jl)
for hyperbolic partial differential equations (PDEs).
This package was initialized through the **Google Summer of Code** program in 2024 and is still under development.

See the [documentation](https://junyixu.github.io/TrixiEnzyme.jl/dev/) for more.

## Installation
To install the package, run the following command in the Julia REPL:
```julia
] # enter Pkg mode
(@v1.10) pkg> add https://github.com/junyixu/TrixiEnzyme.jl.git
```
Then simply run the following command to use the package:
```julia
using TrixiEnzyme
```

## Current status and TODOs

- [x] General interface development
- [x] Documentation
- [ ] Including more AD Examples/Tutorials
- [ ] GPU compatibility
- [ ] Benchmarking
- WIP: [ISSUE#3](https://github.com/junyixu/jacobian4DG/issues/3)
5 changes: 0 additions & 5 deletions docs/src/GSoC.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
## 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
- **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**:
Expand Down
4 changes: 2 additions & 2 deletions src/jacobian.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Enzyme.API.runtimeActivity!(true)

"""
jacobian_enzyme_forward_closure(semi::SemidiscretizationHyperbolic)
jacobian_enzyme_forward_closure(semi::SemidiscretizationHyperbolic; N = pick_batchsize(semi))
Same as `jacobian_enzyme_forward` but with closure
Expand Down Expand Up @@ -207,7 +207,7 @@ function batch_mode_jacobian_enzyme_forward(f!::F, x::AbstractVector, N) where F
end

# %%
function jacobian_enzyme_forward(semi::SemidiscretizationHyperbolic; N = pick_batchsize(x))
function jacobian_enzyme_forward(semi::SemidiscretizationHyperbolic; N = pick_batchsize(semi))
# if N == length(x)
if N == 1
return vector_mode_jacobian_enzyme_forward(semi)
Expand Down
3 changes: 1 addition & 2 deletions test/UpwindTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ end; # 0.326764 seconds (1.09 M allocations: 75.013 MiB, 7.28% gc time, 99.87% c
@test J1 = J2

@info "Compare the time consumed by Enzyme.jl Δt and ForwardDiff.jl..."
println("Enzyme: ", Δt₁)
println("ForwardDiff: ", Δt₂)
@info "Enzyme: $Δt₁ seconds | ForwardDiff: $Δt₂ seconds."

end

0 comments on commit 849927d

Please sign in to comment.