From 848a6cbc2c37341f7226bae12ccc888e1be84e9b Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Sat, 24 Aug 2024 13:14:55 +0000 Subject: [PATCH] build based on 87d6ccc --- dev/.documenter-siteinfo.json | 2 +- dev/Acknowledgments.html | 2 +- dev/Contact.html | 2 +- dev/api.html | 6 +++--- dev/index.html | 19 ++++++++++++++++++- dev/objects.inv | Bin 439 -> 483 bytes dev/search_index.js | 2 +- 7 files changed, 25 insertions(+), 8 deletions(-) diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 3e17f25..4bf43be 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-08-24T12:35:40","documenter_version":"1.6.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-08-24T13:14:51","documenter_version":"1.6.0"}} \ No newline at end of file diff --git a/dev/Acknowledgments.html b/dev/Acknowledgments.html index de516ba..433db32 100644 --- a/dev/Acknowledgments.html +++ b/dev/Acknowledgments.html @@ -1,2 +1,2 @@ -Acknowledgments · TrixiEnzyme.jl

Acknowledgments

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

The project also received support from other Julia contributors, including Benedict from Trixi Framework community.

+Acknowledgments · TrixiEnzyme.jl

Acknowledgments

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

The project also received support from other Julia contributors, including Benedict from Trixi Framework community.

diff --git a/dev/Contact.html b/dev/Contact.html index 550872f..6ad8c0d 100644 --- a/dev/Contact.html +++ b/dev/Contact.html @@ -1,2 +1,2 @@ -Contact Developer · TrixiEnzyme.jl

Contact Developer

If you have questions, suggestions, or are interested in contributing, feel free to reach out our developer, Junyi, via junyixu0@gmail.com.

+Contact Developer · TrixiEnzyme.jl

Contact Developer

If you have questions, suggestions, or are interested in contributing, feel free to reach out our developer, Junyi, via junyixu0@gmail.com.

diff --git a/dev/api.html b/dev/api.html index f5d258b..0604f3e 100644 --- a/dev/api.html +++ b/dev/api.html @@ -1,5 +1,5 @@ -API reference · TrixiEnzyme.jl

The TrixiEnzyme Module

TrixiEnzymeModule
TrixiEnzyme

TrixiEnzyme.jl is a component package of the Trixi.jl ecosystem and integrates Trixi.jl with Compiler-Based (LLVM level) automatic differentiation via Enzyme.jl for hyperbolic partial differential equations (PDEs). 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.

source

Module Index

Detailed API

TrixiEnzyme.jacobian_enzyme_forwardFunction
jacobian_enzyme_forward(semi::SemidiscretizationHyperbolic)

Uses the right-hand side operator of the semidiscretization semi and forward mode automatic differentiation to compute the Jacobian J of the semidiscretization semi at state u0_ode.


jacobian_enzyme_forward(f!:F, x::AbstractArray; N) where F <: Function

Uses the function f! and forward mode automatic differentiation to compute the Jacobian J

Examples

julia> x = -1:0.5:1;
+API reference · TrixiEnzyme.jl

The TrixiEnzyme Module

TrixiEnzymeModule
TrixiEnzyme

TrixiEnzyme.jl is a component package of the Trixi.jl ecosystem and integrates Trixi.jl with Compiler-Based (LLVM level) automatic differentiation via Enzyme.jl for hyperbolic partial differential equations (PDEs). 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.

source

Module Index

Detailed API

TrixiEnzyme.jacobian_enzyme_forwardFunction
jacobian_enzyme_forward(semi::SemidiscretizationHyperbolic)

Uses the right-hand side operator of the semidiscretization semi and forward mode automatic differentiation to compute the Jacobian J of the semidiscretization semi at state u0_ode.


jacobian_enzyme_forward(f!::F, x::AbstractArray; N = pick_batchsize(x)) where F <: Function

Uses the function f! and forward mode automatic differentiation to compute the Jacobian J

Examples

julia> x = -1:0.5:1;
 julia> batch_size = 2;
 julia> jacobian_enzyme_forward(TrixiEnzyme.upwind!, x, N=batch_size)
 5×5 Matrix{Float64}:
@@ -7,9 +7,9 @@
   0.2  -0.2  -0.0  -0.0  -0.0
  -0.0   0.2  -0.2  -0.0  -0.0
  -0.0  -0.0   0.2  -0.2  -0.0
- -0.0  -0.0  -0.0   0.2  -0.2
source
TrixiEnzyme.pick_batchsizeFunction
pick_batchsize(x)
 pick_batchsize(semi)

Return a reasonable batch size for batched differentiation.

Arguments

  • x: AbstractArray
  • semi: SemidiscretizationHyperbolic in Trixi.jl

Notes

Inspired by https://github.com/EnzymeAD/Enzyme.jl/pull/1545/files

Warning

This function is experimental, and not part of the public API.

Examples

julia> pick_batchsize(rand(3))
 3
 
 julia> pick_batchsize(rand(20))
-11
source
+11
source
diff --git a/dev/index.html b/dev/index.html index 4980031..b21a45e 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,2 +1,19 @@ -Index · TrixiEnzyme.jl

TrixiEnzyme

Wikipedia's automatic differentiation entry is a useful resource for learning about the advantages of AD techniques over other common differentiation methods (such as finite differencing).

TrixiEnzyme is not a registered Julia package, and it can be installed by running:

julia> Pkg.add("https://github.com/junyixu/TrixiEnzyme.jl.git")
+Home · TrixiEnzyme.jl

TrixiEnzyme

Getting started

Wikipedia's automatic differentiation entry is a useful resource for learning about the advantages of AD techniques over other common differentiation methods (such as finite differencing).

TrixiEnzyme is not a registered Julia package, and it can be installed by running:

] add https://github.com/junyixu/TrixiEnzyme.jl.git

Configuring Batch Size

TrixiEnzyme.jl performs partial derivative evaluation on one "batch" of the input vector at a time. Each differentiation of a batch requires a call to the target function as well as additional memory proportional to the square of the batch's size. Thus, a smaller batch size makes better use of memory bandwidth at the cost of more calls to the target function, while a larger batch size reduces calls to the target function at the cost of more memory bandwidth.

julia> x = -1:0.5:1;
+julia> batch_size = 2
+julia> @time jacobian_enzyme_forward(TrixiEnzyme.upwind!, x, N=batch_size)
+  0.000040 seconds (31 allocations: 1.547 KiB)
+5×5 Matrix{Float64}:
+ -0.2  -0.0  -0.0  -0.0   0.2
+  0.2  -0.2  -0.0  -0.0  -0.0
+ -0.0   0.2  -0.2  -0.0  -0.0
+ -0.0  -0.0   0.2  -0.2  -0.0
+ -0.0  -0.0  -0.0   0.2  -0.2
+
+julia> x = -1:0.01:1;
+julia> @time jacobian_enzyme_forward(TrixiEnzyme.upwind!, x, N=2);
+  0.000539 seconds (1.34 k allocations: 390.969 KiB)
+julia> @time jacobian_enzyme_forward(TrixiEnzyme.upwind!, x, N=11);
+  0.000332 seconds (307 allocations: 410.453 KiB)

If you do not explicitly provide a chunk size, TrixiEnzyme will try to guess one for you based on your input vector:

julia> x = -1:0.01:1;
+julia> @time jacobian_enzyme_forward(TrixiEnzyme.upwind!, x);
+  0.000327 seconds (307 allocations: 410.453 KiB)
diff --git a/dev/objects.inv b/dev/objects.inv index 95c726790b0621be897c515cdd23a117d5ad09f8..84645cd66f77ce5fbd789efb5e24904120b7b7dc 100644 GIT binary patch delta 361 zcmV-v0ha!^1LFgbgMZ6T!!Qs<_xTDV$PP!en@ZjFfuIW{Br3L*Yfl=tjvYA;eIWiF zJ5GvIQp76p%sn&r+FUX?pwh50QxxF=;;xWnCKu>giKv$i-!;4znvG4=GMYD HKU+f!L15$FoZ?CSqeoK*tJ!p^=f;Bx# z)d*l81xQo*#8s=Or^R5Sq#@M!Twikfp`XAf2vvd}2s~CgR)3Hkh->=(VTMn@5N;R1 zZIB5%M6}o-YSYeU9HF_C)&K{uiq!&eIzIH=94G2uJk$KdU*zRnz!doXH=T2q1NOAI zH@P*#%8_sFkiK&aYrBDc`pw|k` x = -1:0.5:1;\njulia> batch_size = 2;\njulia> jacobian_enzyme_forward(TrixiEnzyme.upwind!, x, N=batch_size)\n5×5 Matrix{Float64}:\n -0.2 -0.0 -0.0 -0.0 0.2\n 0.2 -0.2 -0.0 -0.0 -0.0\n -0.0 0.2 -0.2 -0.0 -0.0\n -0.0 -0.0 0.2 -0.2 -0.0\n -0.0 -0.0 -0.0 0.2 -0.2\n\n\n\n\n\n","category":"function"},{"location":"api.html#TrixiEnzyme.pick_batchsize","page":"API reference","title":"TrixiEnzyme.pick_batchsize","text":"pick_batchsize(x)\npick_batchsize(semi)\n\nReturn a reasonable batch size for batched differentiation.\n\nArguments\n\nx: AbstractArray\nsemi: SemidiscretizationHyperbolic in Trixi.jl\n\nNotes\n\nInspired by https://github.com/EnzymeAD/Enzyme.jl/pull/1545/files\n\nwarning: Warning\nThis function is experimental, and not part of the public API.\n\nExamples\n\njulia> pick_batchsize(rand(3))\n3\n\njulia> pick_batchsize(rand(20))\n11\n\n\n\n\n\n","category":"function"},{"location":"api.html#TrixiEnzyme.upwind!-Tuple{Vector, Vector, Any}","page":"API reference","title":"TrixiEnzyme.upwind!","text":"upwind!(du, u, cache)\n\nvanilla upwind scheme\n\n\n\n\n\n","category":"method"},{"location":"Acknowledgments.html#Acknowledgments","page":"Acknowledgments","title":"Acknowledgments","text":"","category":"section"},{"location":"Acknowledgments.html","page":"Acknowledgments","title":"Acknowledgments","text":"The entire project, along with this blog website, is developed and maintained by Junyi(@junyixu). The whole project is under the guidance of two outstanding professors, Michael(@sloede) and Hendrik(@ranocha), from Trixi Framework community.","category":"page"},{"location":"Acknowledgments.html","page":"Acknowledgments","title":"Acknowledgments","text":"The project also received support from other Julia contributors, including Benedict from Trixi Framework community.","category":"page"},{"location":"index.html#TrixiEnzyme","page":"Index","title":"TrixiEnzyme","text":"","category":"section"},{"location":"index.html","page":"Index","title":"Index","text":"Wikipedia's automatic differentiation entry is a useful resource for learning about the advantages of AD techniques over other common differentiation methods (such as finite differencing).","category":"page"},{"location":"index.html","page":"Index","title":"Index","text":"TrixiEnzyme is not a registered Julia package, and it can be installed by running:","category":"page"},{"location":"index.html","page":"Index","title":"Index","text":"julia> Pkg.add(\"https://github.com/junyixu/TrixiEnzyme.jl.git\")","category":"page"},{"location":"Contact.html#Contact-Developer","page":"Contact Developer","title":"Contact Developer","text":"","category":"section"},{"location":"Contact.html","page":"Contact Developer","title":"Contact Developer","text":"If you have questions, suggestions, or are interested in contributing, feel free to reach out our developer, Junyi, via junyixu0@gmail.com.","category":"page"}] +[{"location":"api.html#The-TrixiEnzyme-Module","page":"API reference","title":"The TrixiEnzyme Module","text":"","category":"section"},{"location":"api.html","page":"API reference","title":"API reference","text":"TrixiEnzyme","category":"page"},{"location":"api.html#TrixiEnzyme","page":"API reference","title":"TrixiEnzyme","text":"TrixiEnzyme\n\nTrixiEnzyme.jl is a component package of the Trixi.jl ecosystem and integrates Trixi.jl with Compiler-Based (LLVM level) automatic differentiation via Enzyme.jl for hyperbolic partial differential equations (PDEs). 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.\n\n\n\n\n\n","category":"module"},{"location":"api.html#Module-Index","page":"API reference","title":"Module Index","text":"","category":"section"},{"location":"api.html","page":"API reference","title":"API reference","text":"Modules = [TrixiEnzyme]\nOrder = [:constant, :type, :function, :macro]","category":"page"},{"location":"api.html#Detailed-API","page":"API reference","title":"Detailed API","text":"","category":"section"},{"location":"api.html","page":"API reference","title":"API reference","text":"Modules = [TrixiEnzyme]\nOrder = [:constant, :type, :function, :macro]","category":"page"},{"location":"api.html#TrixiEnzyme.jacobian_enzyme_forward","page":"API reference","title":"TrixiEnzyme.jacobian_enzyme_forward","text":"jacobian_enzyme_forward(semi::SemidiscretizationHyperbolic)\n\nUses the right-hand side operator of the semidiscretization semi and forward mode automatic differentiation to compute the Jacobian J of the semidiscretization semi at state u0_ode.\n\n\n\njacobian_enzyme_forward(f!::F, x::AbstractArray; N = pick_batchsize(x)) where F <: Function\n\nUses the function f! and forward mode automatic differentiation to compute the Jacobian J\n\nExamples\n\njulia> x = -1:0.5:1;\njulia> batch_size = 2;\njulia> jacobian_enzyme_forward(TrixiEnzyme.upwind!, x, N=batch_size)\n5×5 Matrix{Float64}:\n -0.2 -0.0 -0.0 -0.0 0.2\n 0.2 -0.2 -0.0 -0.0 -0.0\n -0.0 0.2 -0.2 -0.0 -0.0\n -0.0 -0.0 0.2 -0.2 -0.0\n -0.0 -0.0 -0.0 0.2 -0.2\n\n\n\n\n\n","category":"function"},{"location":"api.html#TrixiEnzyme.pick_batchsize","page":"API reference","title":"TrixiEnzyme.pick_batchsize","text":"pick_batchsize(x)\npick_batchsize(semi)\n\nReturn a reasonable batch size for batched differentiation.\n\nArguments\n\nx: AbstractArray\nsemi: SemidiscretizationHyperbolic in Trixi.jl\n\nNotes\n\nInspired by https://github.com/EnzymeAD/Enzyme.jl/pull/1545/files\n\nwarning: Warning\nThis function is experimental, and not part of the public API.\n\nExamples\n\njulia> pick_batchsize(rand(3))\n3\n\njulia> pick_batchsize(rand(20))\n11\n\n\n\n\n\n","category":"function"},{"location":"api.html#TrixiEnzyme.upwind!-Tuple{Vector, Vector, Any}","page":"API reference","title":"TrixiEnzyme.upwind!","text":"upwind!(du, u, cache)\n\nvanilla upwind scheme\n\n\n\n\n\n","category":"method"},{"location":"Acknowledgments.html#Acknowledgments","page":"Acknowledgments","title":"Acknowledgments","text":"","category":"section"},{"location":"Acknowledgments.html","page":"Acknowledgments","title":"Acknowledgments","text":"The entire project, along with this blog website, is developed and maintained by Junyi(@junyixu). The whole project is under the guidance of two outstanding professors, Michael(@sloede) and Hendrik(@ranocha), from Trixi Framework community.","category":"page"},{"location":"Acknowledgments.html","page":"Acknowledgments","title":"Acknowledgments","text":"The project also received support from other Julia contributors, including Benedict from Trixi Framework community.","category":"page"},{"location":"index.html#TrixiEnzyme","page":"Home","title":"TrixiEnzyme","text":"","category":"section"},{"location":"index.html#Getting-started","page":"Home","title":"Getting started","text":"","category":"section"},{"location":"index.html","page":"Home","title":"Home","text":"Wikipedia's automatic differentiation entry is a useful resource for learning about the advantages of AD techniques over other common differentiation methods (such as finite differencing).","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"TrixiEnzyme is not a registered Julia package, and it can be installed by running:","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"] add https://github.com/junyixu/TrixiEnzyme.jl.git","category":"page"},{"location":"index.html#Configuring-Batch-Size","page":"Home","title":"Configuring Batch Size","text":"","category":"section"},{"location":"index.html","page":"Home","title":"Home","text":"TrixiEnzyme.jl performs partial derivative evaluation on one \"batch\" of the input vector at a time. Each differentiation of a batch requires a call to the target function as well as additional memory proportional to the square of the batch's size. Thus, a smaller batch size makes better use of memory bandwidth at the cost of more calls to the target function, while a larger batch size reduces calls to the target function at the cost of more memory bandwidth.","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"julia> x = -1:0.5:1;\njulia> batch_size = 2\njulia> @time jacobian_enzyme_forward(TrixiEnzyme.upwind!, x, N=batch_size)\n 0.000040 seconds (31 allocations: 1.547 KiB)\n5×5 Matrix{Float64}:\n -0.2 -0.0 -0.0 -0.0 0.2\n 0.2 -0.2 -0.0 -0.0 -0.0\n -0.0 0.2 -0.2 -0.0 -0.0\n -0.0 -0.0 0.2 -0.2 -0.0\n -0.0 -0.0 -0.0 0.2 -0.2\n\njulia> x = -1:0.01:1;\njulia> @time jacobian_enzyme_forward(TrixiEnzyme.upwind!, x, N=2);\n 0.000539 seconds (1.34 k allocations: 390.969 KiB)\njulia> @time jacobian_enzyme_forward(TrixiEnzyme.upwind!, x, N=11);\n 0.000332 seconds (307 allocations: 410.453 KiB)","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"If you do not explicitly provide a chunk size, TrixiEnzyme will try to guess one for you based on your input vector:","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"julia> x = -1:0.01:1;\njulia> @time jacobian_enzyme_forward(TrixiEnzyme.upwind!, x);\n 0.000327 seconds (307 allocations: 410.453 KiB)","category":"page"},{"location":"Contact.html#Contact-Developer","page":"Contact Developer","title":"Contact Developer","text":"","category":"section"},{"location":"Contact.html","page":"Contact Developer","title":"Contact Developer","text":"If you have questions, suggestions, or are interested in contributing, feel free to reach out our developer, Junyi, via junyixu0@gmail.com.","category":"page"}] }