From 18074f1031cf6decfd003dba726433bb6bfbe2c9 Mon Sep 17 00:00:00 2001 From: "Documenter.jl" <documenter@juliadocs.github.io> Date: Mon, 26 Aug 2024 16:28:01 +0000 Subject: [PATCH] build based on f5e6f6a --- dev/.documenter-siteinfo.json | 2 +- dev/Contact.html | 2 +- dev/GSoC.html | 2 +- dev/api.html | 6 +++--- dev/examples.html | 4 ++-- dev/index.html | 2 +- dev/notes.html | 2 +- dev/objects.inv | Bin 850 -> 877 bytes dev/search_index.js | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index a3f27a0..22c432f 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-08-26T16:18:00","documenter_version":"1.6.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-08-26T16:27:58","documenter_version":"1.6.0"}} \ No newline at end of file diff --git a/dev/Contact.html b/dev/Contact.html index 0ffa0d5..b63e4db 100644 --- a/dev/Contact.html +++ b/dev/Contact.html @@ -1,2 +1,2 @@ <!DOCTYPE html> -<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Contact Developer · TrixiEnzyme.jl</title><meta name="title" content="Contact Developer · TrixiEnzyme.jl"/><meta property="og:title" content="Contact Developer · TrixiEnzyme.jl"/><meta property="twitter:title" content="Contact Developer · TrixiEnzyme.jl"/><meta name="description" content="Documentation for TrixiEnzyme.jl."/><meta property="og:description" content="Documentation for TrixiEnzyme.jl."/><meta property="twitter:description" content="Documentation for TrixiEnzyme.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-mocha.css" data-theme-name="catppuccin-mocha"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-macchiato.css" data-theme-name="catppuccin-macchiato"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-frappe.css" data-theme-name="catppuccin-frappe"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-latte.css" data-theme-name="catppuccin-latte"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">TrixiEnzyme.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Home</a></li><li><a class="tocitem" href="api.html">API reference</a></li><li><a class="tocitem" href="examples.html">Examples</a></li><li><a class="tocitem" href="GSoC.html">GSoC</a></li><li><a class="tocitem" href="notes.html">Notes</a></li><li class="is-active"><a class="tocitem" href="Contact.html">Contact Developer</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href="Contact.html">Contact Developer</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="Contact.html">Contact Developer</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/junyixu/TrixiEnzyme.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/junyixu/TrixiEnzyme.jl/blob/main/docs/src/Contact.md" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Contact-Developer"><a class="docs-heading-anchor" href="#Contact-Developer">Contact Developer</a><a id="Contact-Developer-1"></a><a class="docs-heading-anchor-permalink" href="#Contact-Developer" title="Permalink"></a></h1><p>If you have questions, suggestions, or are interested in contributing, feel free to reach out our developer, Junyi, via junyixu0@gmail.com.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="notes.html">« Notes</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.6.0 on <span class="colophon-date" title="Monday 26 August 2024 16:18">Monday 26 August 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Contact Developer · TrixiEnzyme.jl</title><meta name="title" content="Contact Developer · TrixiEnzyme.jl"/><meta property="og:title" content="Contact Developer · TrixiEnzyme.jl"/><meta property="twitter:title" content="Contact Developer · TrixiEnzyme.jl"/><meta name="description" content="Documentation for TrixiEnzyme.jl."/><meta property="og:description" content="Documentation for TrixiEnzyme.jl."/><meta property="twitter:description" content="Documentation for TrixiEnzyme.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-mocha.css" data-theme-name="catppuccin-mocha"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-macchiato.css" data-theme-name="catppuccin-macchiato"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-frappe.css" data-theme-name="catppuccin-frappe"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-latte.css" data-theme-name="catppuccin-latte"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">TrixiEnzyme.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Home</a></li><li><a class="tocitem" href="api.html">API reference</a></li><li><a class="tocitem" href="examples.html">Examples</a></li><li><a class="tocitem" href="GSoC.html">GSoC</a></li><li><a class="tocitem" href="notes.html">Notes</a></li><li class="is-active"><a class="tocitem" href="Contact.html">Contact Developer</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href="Contact.html">Contact Developer</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="Contact.html">Contact Developer</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/junyixu/TrixiEnzyme.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/junyixu/TrixiEnzyme.jl/blob/main/docs/src/Contact.md" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Contact-Developer"><a class="docs-heading-anchor" href="#Contact-Developer">Contact Developer</a><a id="Contact-Developer-1"></a><a class="docs-heading-anchor-permalink" href="#Contact-Developer" title="Permalink"></a></h1><p>If you have questions, suggestions, or are interested in contributing, feel free to reach out our developer, Junyi, via junyixu0@gmail.com.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="notes.html">« Notes</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.6.0 on <span class="colophon-date" title="Monday 26 August 2024 16:27">Monday 26 August 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/dev/GSoC.html b/dev/GSoC.html index 23fd709..3d04772 100644 --- a/dev/GSoC.html +++ b/dev/GSoC.html @@ -1,2 +1,2 @@ <!DOCTYPE html> -<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>GSoC · TrixiEnzyme.jl</title><meta name="title" content="GSoC · TrixiEnzyme.jl"/><meta property="og:title" content="GSoC · TrixiEnzyme.jl"/><meta property="twitter:title" content="GSoC · TrixiEnzyme.jl"/><meta name="description" content="Documentation for TrixiEnzyme.jl."/><meta property="og:description" content="Documentation for TrixiEnzyme.jl."/><meta property="twitter:description" content="Documentation for TrixiEnzyme.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-mocha.css" data-theme-name="catppuccin-mocha"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-macchiato.css" data-theme-name="catppuccin-macchiato"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-frappe.css" data-theme-name="catppuccin-frappe"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-latte.css" data-theme-name="catppuccin-latte"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">TrixiEnzyme.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Home</a></li><li><a class="tocitem" href="api.html">API reference</a></li><li><a class="tocitem" href="examples.html">Examples</a></li><li class="is-active"><a class="tocitem" href="GSoC.html">GSoC</a><ul class="internal"><li><a class="tocitem" href="#Project-Overview"><span>Project Overview</span></a></li><li><a class="tocitem" href="#Key-Highlights"><span>Key Highlights</span></a></li><li><a class="tocitem" href="#Constraints-and-Future-Work"><span>Constraints and Future Work</span></a></li><li><a class="tocitem" href="#Acknowledgments"><span>Acknowledgments</span></a></li></ul></li><li><a class="tocitem" href="notes.html">Notes</a></li><li><a class="tocitem" href="Contact.html">Contact Developer</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href="GSoC.html">GSoC</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="GSoC.html">GSoC</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/junyixu/TrixiEnzyme.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/junyixu/TrixiEnzyme.jl/blob/main/docs/src/GSoC.md" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Final-Report:-GSoC-'24"><a class="docs-heading-anchor" href="#Final-Report:-GSoC-'24">Final Report: GSoC '24</a><a id="Final-Report:-GSoC-'24-1"></a><a class="docs-heading-anchor-permalink" href="#Final-Report:-GSoC-'24" title="Permalink"></a></h1><ul><li>Student Name: Junyi(<a href="https://github.com/junyixu">@junyixu</a>).</li><li>Organization: Trixi Framework community.</li><li>Mentors: Michael(<a href="https://github.com/sloede">@sloede</a>) and Hendrik(<a href="https://github.com/ranocha">@ranocha</a>)</li><li>Project: Integrating the Modern CFD Package Trixi.jl with Compiler-Based Auto-Diff via Enzyme.jl</li><li>Project Link: <a href="https://github.com/junyixu/TrixiEnzyme.jl">https://github.com/junyixu/TrixiEnzyme.jl</a></li></ul><h2 id="Project-Overview"><a class="docs-heading-anchor" href="#Project-Overview">Project Overview</a><a id="Project-Overview-1"></a><a class="docs-heading-anchor-permalink" href="#Project-Overview" title="Permalink"></a></h2><p>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.</p><ul><li><strong><a href="https://junyixu.github.io/TrixiEnzyme.jl/dev/api.html#TrixiEnzyme.jacobian_enzyme_forward">Forward Mode</a> Automatic Differentiation (AD) for Discontinuous Galerkin Collocation Spectral Element Method (DGSEM)</strong>: Implement forward mode automatic differentiation to enhance the calculation of derivatives in DG methods, improving computational efficiency and accuracy for various applications.</li><li><strong><a href="https://junyixu.github.io/TrixiEnzyme.jl/dev/api.html#TrixiEnzyme.jacobian_enzyme_reverse-Tuple{Any}">Reverse Mode</a> Automatic Differentiation for DG</strong>.</li><li><strong>Improve Performance</strong>:<ul><li><strong>Extract Parameters Passed to Enzyme</strong>: Implement a systematic approach to extract and manage parameters passed to Enzyme, ensuring optimal configuration and efficiency in the execution of AD tasks.</li><li><strong><code>batchsize</code> for Jacobians</strong>:<ul><li><strong>Optimize for Memory Bandwidth</strong>: 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.</li><li><strong>Automatically <a href="https://junyixu.github.io/TrixiEnzyme.jl/dev/api.html#TrixiEnzyme.pick_batchsize">Pick</a> <code>batchsize</code></strong></li></ul></li></ul></li><li><strong>Explore Enzyme Custom Rules</strong>: 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.</li></ul><p>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.</p><h2 id="Key-Highlights"><a class="docs-heading-anchor" href="#Key-Highlights">Key Highlights</a><a id="Key-Highlights-1"></a><a class="docs-heading-anchor-permalink" href="#Key-Highlights" title="Permalink"></a></h2><h3 id="Function-Prototyping"><a class="docs-heading-anchor" href="#Function-Prototyping">Function Prototyping</a><a id="Function-Prototyping-1"></a><a class="docs-heading-anchor-permalink" href="#Function-Prototyping" title="Permalink"></a></h3><ul><li>Functions intended for automatic differentiation with <code>Enzyme.autodiff</code> should adhere to specific naming conventions:<ul><li>Functions must start with <code>enzyme_</code>.</li><li>The primary role of these functions is to unpack <code>semi.cache</code> and accurately recreate <code>cache</code> for effective use with Enzyme’s APIs.</li></ul></li></ul><h3 id="Configuration"><a class="docs-heading-anchor" href="#Configuration">Configuration</a><a id="Configuration-1"></a><a class="docs-heading-anchor-permalink" href="#Configuration" title="Permalink"></a></h3><ul><li>The functions <code>jacobian_enzyme_forward</code> and <code>jacobian_enzyme_reverse</code> are configured to behave similarly to <code>jacobian_ad_forward</code>, with the primary distinction being how <code>batchsize</code> is chosen:<ul><li>An alternative usage pattern involves defining new functions prefixed with <code>enzyme_</code> and passing them to <code>jacobian_enzyme_forward</code> or <code>jacobian_enzyme_reverse</code> for differentiation.</li></ul></li></ul><h3 id="Optimization-Strategies"><a class="docs-heading-anchor" href="#Optimization-Strategies">Optimization Strategies</a><a id="Optimization-Strategies-1"></a><a class="docs-heading-anchor-permalink" href="#Optimization-Strategies" title="Permalink"></a></h3><ul><li>To enhance performance, several optimization strategies are recommended:<ul><li>Reuse containers for shadow variables during middlebatching and utilize the <code>@batch</code> macro for multithreading acceleration to improve computational efficiency.</li><li>Minimize the number of arguments extracted from <code>semi.cache</code> to reduce overhead and streamline computations.</li><li>Current benchmarks for Enzyme indicate mixed results. In scenarios involving smaller caches, like in toy models, <code>jacobian_enzyme(semi)</code> performs better than <code>ForwardDiff</code>. However, in the context of Discontinuous Galerkin Collocation Spectral Element Method (DGSEM) simulations, the performance may lag behind <code>jacobian_ad_forward(semi)</code> due to the challenges associated with large cache sizes (<code>elements._surface_flux_values</code> and <code>cache.interfaces._u</code>) and the complexities involved in unpacking and recreating the cache.</li></ul></li></ul><p>This package aims to provide a robust framework for integrating advanced differentiation techniques into Trixi, addressing both performance and usability to facilitate high-quality computational research and development.</p><h2 id="Constraints-and-Future-Work"><a class="docs-heading-anchor" href="#Constraints-and-Future-Work">Constraints and Future Work</a><a id="Constraints-and-Future-Work-1"></a><a class="docs-heading-anchor-permalink" href="#Constraints-and-Future-Work" title="Permalink"></a></h2><ul><li><strong>Make Reverse Mode AD Work with Polyester.jl</strong>: 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.</li><li><strong>Integrate Enzyme with GPU Kernels</strong>: Extend the functionality of Enzyme by integrating it with GPU kernels, allowing AD operations to leverage the parallel processing power of GPUs.</li></ul><h2 id="Acknowledgments"><a class="docs-heading-anchor" href="#Acknowledgments">Acknowledgments</a><a id="Acknowledgments-1"></a><a class="docs-heading-anchor-permalink" href="#Acknowledgments" title="Permalink"></a></h2><p>The entire project, along with this website, is developed and maintained by Junyi(<a href="https://github.com/junyixu">@junyixu</a>). The whole project is under the guidance of two outstanding professors, Michael(<a href="https://github.com/sloede">@sloede</a>) and Hendrik(<a href="https://github.com/ranocha">@ranocha</a>), from Trixi Framework community.</p><p>The project also received support from other Julia contributors, including Benedict from Trixi Framework community.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="examples.html">« Examples</a><a class="docs-footer-nextpage" href="notes.html">Notes »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.6.0 on <span class="colophon-date" title="Monday 26 August 2024 16:18">Monday 26 August 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>GSoC · TrixiEnzyme.jl</title><meta name="title" content="GSoC · TrixiEnzyme.jl"/><meta property="og:title" content="GSoC · TrixiEnzyme.jl"/><meta property="twitter:title" content="GSoC · TrixiEnzyme.jl"/><meta name="description" content="Documentation for TrixiEnzyme.jl."/><meta property="og:description" content="Documentation for TrixiEnzyme.jl."/><meta property="twitter:description" content="Documentation for TrixiEnzyme.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-mocha.css" data-theme-name="catppuccin-mocha"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-macchiato.css" data-theme-name="catppuccin-macchiato"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-frappe.css" data-theme-name="catppuccin-frappe"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-latte.css" data-theme-name="catppuccin-latte"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">TrixiEnzyme.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Home</a></li><li><a class="tocitem" href="api.html">API reference</a></li><li><a class="tocitem" href="examples.html">Examples</a></li><li class="is-active"><a class="tocitem" href="GSoC.html">GSoC</a><ul class="internal"><li><a class="tocitem" href="#Project-Overview"><span>Project Overview</span></a></li><li><a class="tocitem" href="#Key-Highlights"><span>Key Highlights</span></a></li><li><a class="tocitem" href="#Constraints-and-Future-Work"><span>Constraints and Future Work</span></a></li><li><a class="tocitem" href="#Acknowledgments"><span>Acknowledgments</span></a></li></ul></li><li><a class="tocitem" href="notes.html">Notes</a></li><li><a class="tocitem" href="Contact.html">Contact Developer</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href="GSoC.html">GSoC</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="GSoC.html">GSoC</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/junyixu/TrixiEnzyme.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/junyixu/TrixiEnzyme.jl/blob/main/docs/src/GSoC.md" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Final-Report:-GSoC-'24"><a class="docs-heading-anchor" href="#Final-Report:-GSoC-'24">Final Report: GSoC '24</a><a id="Final-Report:-GSoC-'24-1"></a><a class="docs-heading-anchor-permalink" href="#Final-Report:-GSoC-'24" title="Permalink"></a></h1><ul><li>Student Name: Junyi(<a href="https://github.com/junyixu">@junyixu</a>).</li><li>Organization: Trixi Framework community.</li><li>Mentors: Michael(<a href="https://github.com/sloede">@sloede</a>) and Hendrik(<a href="https://github.com/ranocha">@ranocha</a>)</li><li>Project: Integrating the Modern CFD Package Trixi.jl with Compiler-Based Auto-Diff via Enzyme.jl</li><li>Project Link: <a href="https://github.com/junyixu/TrixiEnzyme.jl">https://github.com/junyixu/TrixiEnzyme.jl</a></li></ul><h2 id="Project-Overview"><a class="docs-heading-anchor" href="#Project-Overview">Project Overview</a><a id="Project-Overview-1"></a><a class="docs-heading-anchor-permalink" href="#Project-Overview" title="Permalink"></a></h2><p>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.</p><ul><li><strong><a href="https://junyixu.github.io/TrixiEnzyme.jl/dev/api.html#TrixiEnzyme.jacobian_enzyme_forward">Forward Mode</a> Automatic Differentiation (AD) for Discontinuous Galerkin Collocation Spectral Element Method (DGSEM)</strong>: Implement forward mode automatic differentiation to enhance the calculation of derivatives in DG methods, improving computational efficiency and accuracy for various applications.</li><li><strong><a href="https://junyixu.github.io/TrixiEnzyme.jl/dev/api.html#TrixiEnzyme.jacobian_enzyme_reverse-Tuple{Any}">Reverse Mode</a> Automatic Differentiation for DG</strong>.</li><li><strong>Improve Performance</strong>:<ul><li><strong>Extract Parameters Passed to Enzyme</strong>: Implement a systematic approach to extract and manage parameters passed to Enzyme, ensuring optimal configuration and efficiency in the execution of AD tasks.</li><li><strong><code>batchsize</code> for Jacobians</strong>:<ul><li><strong>Optimize for Memory Bandwidth</strong>: 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.</li><li><strong>Automatically <a href="https://junyixu.github.io/TrixiEnzyme.jl/dev/api.html#TrixiEnzyme.pick_batchsize">Pick</a> <code>batchsize</code></strong></li></ul></li></ul></li><li><strong>Explore Enzyme Custom Rules</strong>: 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.</li></ul><p>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.</p><h2 id="Key-Highlights"><a class="docs-heading-anchor" href="#Key-Highlights">Key Highlights</a><a id="Key-Highlights-1"></a><a class="docs-heading-anchor-permalink" href="#Key-Highlights" title="Permalink"></a></h2><h3 id="Function-Prototyping"><a class="docs-heading-anchor" href="#Function-Prototyping">Function Prototyping</a><a id="Function-Prototyping-1"></a><a class="docs-heading-anchor-permalink" href="#Function-Prototyping" title="Permalink"></a></h3><ul><li>Functions intended for automatic differentiation with <code>Enzyme.autodiff</code> should adhere to specific naming conventions:<ul><li>Functions must start with <code>enzyme_</code>.</li><li>The primary role of these functions is to unpack <code>semi.cache</code> and accurately recreate <code>cache</code> for effective use with Enzyme’s APIs.</li></ul></li></ul><h3 id="Configuration"><a class="docs-heading-anchor" href="#Configuration">Configuration</a><a id="Configuration-1"></a><a class="docs-heading-anchor-permalink" href="#Configuration" title="Permalink"></a></h3><ul><li>The functions <code>jacobian_enzyme_forward</code> and <code>jacobian_enzyme_reverse</code> are configured to behave similarly to <code>jacobian_ad_forward</code>, with the primary distinction being how <code>batchsize</code> is chosen:<ul><li>An alternative usage pattern involves defining new functions prefixed with <code>enzyme_</code> and passing them to <code>jacobian_enzyme_forward</code> or <code>jacobian_enzyme_reverse</code> for differentiation.</li></ul></li></ul><h3 id="Optimization-Strategies"><a class="docs-heading-anchor" href="#Optimization-Strategies">Optimization Strategies</a><a id="Optimization-Strategies-1"></a><a class="docs-heading-anchor-permalink" href="#Optimization-Strategies" title="Permalink"></a></h3><ul><li>To enhance performance, several optimization strategies are recommended:<ul><li>Reuse containers for shadow variables during middlebatching and utilize the <code>@batch</code> macro for multithreading acceleration to improve computational efficiency.</li><li>Minimize the number of arguments extracted from <code>semi.cache</code> to reduce overhead and streamline computations.</li><li>Current benchmarks for Enzyme indicate mixed results. In scenarios involving smaller caches, like in toy models, <code>jacobian_enzyme(semi)</code> performs better than <code>ForwardDiff</code>. However, in the context of Discontinuous Galerkin Collocation Spectral Element Method (DGSEM) simulations, the performance may lag behind <code>jacobian_ad_forward(semi)</code> due to the challenges associated with large cache sizes (<code>elements._surface_flux_values</code> and <code>cache.interfaces._u</code>) and the complexities involved in unpacking and recreating the cache.</li></ul></li></ul><p>This package aims to provide a robust framework for integrating advanced differentiation techniques into Trixi, addressing both performance and usability to facilitate high-quality computational research and development.</p><h2 id="Constraints-and-Future-Work"><a class="docs-heading-anchor" href="#Constraints-and-Future-Work">Constraints and Future Work</a><a id="Constraints-and-Future-Work-1"></a><a class="docs-heading-anchor-permalink" href="#Constraints-and-Future-Work" title="Permalink"></a></h2><ul><li><strong>Make Reverse Mode AD Work with Polyester.jl</strong>: 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.</li><li><strong>Integrate Enzyme with GPU Kernels</strong>: Extend the functionality of Enzyme by integrating it with GPU kernels, allowing AD operations to leverage the parallel processing power of GPUs.</li></ul><h2 id="Acknowledgments"><a class="docs-heading-anchor" href="#Acknowledgments">Acknowledgments</a><a id="Acknowledgments-1"></a><a class="docs-heading-anchor-permalink" href="#Acknowledgments" title="Permalink"></a></h2><p>The entire project, along with this website, is developed and maintained by Junyi(<a href="https://github.com/junyixu">@junyixu</a>). The whole project is under the guidance of two outstanding professors, Michael(<a href="https://github.com/sloede">@sloede</a>) and Hendrik(<a href="https://github.com/ranocha">@ranocha</a>), from Trixi Framework community.</p><p>The project also received support from other Julia contributors, including Benedict from Trixi Framework community.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="examples.html">« Examples</a><a class="docs-footer-nextpage" href="notes.html">Notes »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.6.0 on <span class="colophon-date" title="Monday 26 August 2024 16:27">Monday 26 August 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/dev/api.html b/dev/api.html index b8dc617..2414f82 100644 --- a/dev/api.html +++ b/dev/api.html @@ -1,5 +1,5 @@ <!DOCTYPE html> -<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>API reference · TrixiEnzyme.jl</title><meta name="title" content="API reference · TrixiEnzyme.jl"/><meta property="og:title" content="API reference · TrixiEnzyme.jl"/><meta property="twitter:title" content="API reference · TrixiEnzyme.jl"/><meta name="description" content="Documentation for TrixiEnzyme.jl."/><meta property="og:description" content="Documentation for TrixiEnzyme.jl."/><meta property="twitter:description" content="Documentation for TrixiEnzyme.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-mocha.css" data-theme-name="catppuccin-mocha"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-macchiato.css" data-theme-name="catppuccin-macchiato"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-frappe.css" data-theme-name="catppuccin-frappe"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-latte.css" data-theme-name="catppuccin-latte"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">TrixiEnzyme.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Home</a></li><li class="is-active"><a class="tocitem" href="api.html">API reference</a><ul class="internal"><li><a class="tocitem" href="#Module-Index"><span>Module Index</span></a></li><li><a class="tocitem" href="#Detailed-API"><span>Detailed API</span></a></li></ul></li><li><a class="tocitem" href="examples.html">Examples</a></li><li><a class="tocitem" href="GSoC.html">GSoC</a></li><li><a class="tocitem" href="notes.html">Notes</a></li><li><a class="tocitem" href="Contact.html">Contact Developer</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href="api.html">API reference</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="api.html">API reference</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/junyixu/TrixiEnzyme.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/junyixu/TrixiEnzyme.jl/blob/main/docs/src/api.md" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="The-TrixiEnzyme-Module"><a class="docs-heading-anchor" href="#The-TrixiEnzyme-Module">The TrixiEnzyme Module</a><a id="The-TrixiEnzyme-Module-1"></a><a class="docs-heading-anchor-permalink" href="#The-TrixiEnzyme-Module" title="Permalink"></a></h1><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="TrixiEnzyme" href="#TrixiEnzyme"><code>TrixiEnzyme</code></a> — <span class="docstring-category">Module</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><pre><code class="language-julia hljs">TrixiEnzyme</code></pre><p>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.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/junyixu/TrixiEnzyme.jl/blob/e056045a6b5d9c10c989b1264ad7170eacc3794e/src/TrixiEnzyme.jl#L1-L6">source</a></section></article><h2 id="Module-Index"><a class="docs-heading-anchor" href="#Module-Index">Module Index</a><a id="Module-Index-1"></a><a class="docs-heading-anchor-permalink" href="#Module-Index" title="Permalink"></a></h2><ul><li><a href="api.html#TrixiEnzyme.enzyme_rhs!-Tuple{AbstractVector, AbstractVector, Vararg{Any, 16}}"><code>TrixiEnzyme.enzyme_rhs!</code></a></li><li><a href="api.html#TrixiEnzyme.jacobian_enzyme_forward"><code>TrixiEnzyme.jacobian_enzyme_forward</code></a></li><li><a href="api.html#TrixiEnzyme.jacobian_enzyme_forward_closure-Tuple{Any}"><code>TrixiEnzyme.jacobian_enzyme_forward_closure</code></a></li><li><a href="api.html#TrixiEnzyme.jacobian_enzyme_reverse-Tuple{Any}"><code>TrixiEnzyme.jacobian_enzyme_reverse</code></a></li><li><a href="api.html#TrixiEnzyme.jacobian_enzyme_reverse_closure-Tuple{Any}"><code>TrixiEnzyme.jacobian_enzyme_reverse_closure</code></a></li><li><a href="api.html#TrixiEnzyme.pick_batchsize"><code>TrixiEnzyme.pick_batchsize</code></a></li><li><a href="api.html#TrixiEnzyme.upwind!-Tuple{Vector, Vector, Any}"><code>TrixiEnzyme.upwind!</code></a></li></ul><h2 id="Detailed-API"><a class="docs-heading-anchor" href="#Detailed-API">Detailed API</a><a id="Detailed-API-1"></a><a class="docs-heading-anchor-permalink" href="#Detailed-API" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="TrixiEnzyme.enzyme_rhs!-Tuple{AbstractVector, AbstractVector, Vararg{Any, 16}}" href="#TrixiEnzyme.enzyme_rhs!-Tuple{AbstractVector, AbstractVector, Vararg{Any, 16}}"><code>TrixiEnzyme.enzyme_rhs!</code></a> — <span class="docstring-category">Method</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><pre><code class="language-julia hljs">enzyme_rhs!(du_ode::AbstractVector, u_ode::AbstractVector, mesh, equations, initial_condition, boundary_conditions, source_terms, solver, boundaries, _node_coordinates, cell_ids, node_coordinates, inverse_jacobian, _neighbor_ids, neighbor_ids, orientation, surface_flux_values, u)</code></pre><p>The best thing to do for a user would be to separate out the things that you need to track through, make them arguments to the function, and then simply Duplicate on those.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/junyixu/TrixiEnzyme.jl/blob/e056045a6b5d9c10c989b1264ad7170eacc3794e/src/rhs.jl#L29-L33">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="TrixiEnzyme.jacobian_enzyme_forward" href="#TrixiEnzyme.jacobian_enzyme_forward"><code>TrixiEnzyme.jacobian_enzyme_forward</code></a> — <span class="docstring-category">Function</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><pre><code class="language-julia hljs">jacobian_enzyme_forward(semi::SemidiscretizationHyperbolic)</code></pre><p>Uses the right-hand side operator of the semidiscretization <code>semi</code> and forward mode automatic differentiation to compute the Jacobian <code>J</code> of the semidiscretization <code>semi</code> at state <code>u0_ode</code>.</p><hr/><pre><code class="nohighlight hljs">jacobian_enzyme_forward(f!::F, x::AbstractArray; N = pick_batchsize(x)) where F <: Function</code></pre><p>Uses the function <code>f!</code> and forward mode automatic differentiation to compute the Jacobian <code>J</code></p><p><strong>Examples</strong></p><pre><code class="language-julia-repl hljs">julia> x = -1:0.5:1; +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>API reference · TrixiEnzyme.jl</title><meta name="title" content="API reference · TrixiEnzyme.jl"/><meta property="og:title" content="API reference · TrixiEnzyme.jl"/><meta property="twitter:title" content="API reference · TrixiEnzyme.jl"/><meta name="description" content="Documentation for TrixiEnzyme.jl."/><meta property="og:description" content="Documentation for TrixiEnzyme.jl."/><meta property="twitter:description" content="Documentation for TrixiEnzyme.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-mocha.css" data-theme-name="catppuccin-mocha"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-macchiato.css" data-theme-name="catppuccin-macchiato"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-frappe.css" data-theme-name="catppuccin-frappe"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-latte.css" data-theme-name="catppuccin-latte"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">TrixiEnzyme.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Home</a></li><li class="is-active"><a class="tocitem" href="api.html">API reference</a><ul class="internal"><li><a class="tocitem" href="#Module-Index"><span>Module Index</span></a></li><li><a class="tocitem" href="#Detailed-API"><span>Detailed API</span></a></li></ul></li><li><a class="tocitem" href="examples.html">Examples</a></li><li><a class="tocitem" href="GSoC.html">GSoC</a></li><li><a class="tocitem" href="notes.html">Notes</a></li><li><a class="tocitem" href="Contact.html">Contact Developer</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href="api.html">API reference</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="api.html">API reference</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/junyixu/TrixiEnzyme.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/junyixu/TrixiEnzyme.jl/blob/main/docs/src/api.md" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="The-TrixiEnzyme-Module"><a class="docs-heading-anchor" href="#The-TrixiEnzyme-Module">The TrixiEnzyme Module</a><a id="The-TrixiEnzyme-Module-1"></a><a class="docs-heading-anchor-permalink" href="#The-TrixiEnzyme-Module" title="Permalink"></a></h1><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="TrixiEnzyme" href="#TrixiEnzyme"><code>TrixiEnzyme</code></a> — <span class="docstring-category">Module</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><pre><code class="language-julia hljs">TrixiEnzyme</code></pre><p>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.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/junyixu/TrixiEnzyme.jl/blob/f5e6f6a16ac2f54a3e1742ae6cd6d3189965ad08/src/TrixiEnzyme.jl#L1-L6">source</a></section></article><h2 id="Module-Index"><a class="docs-heading-anchor" href="#Module-Index">Module Index</a><a id="Module-Index-1"></a><a class="docs-heading-anchor-permalink" href="#Module-Index" title="Permalink"></a></h2><ul><li><a href="api.html#TrixiEnzyme.enzyme_rhs!-Tuple{AbstractVector, AbstractVector, Vararg{Any, 16}}"><code>TrixiEnzyme.enzyme_rhs!</code></a></li><li><a href="api.html#TrixiEnzyme.jacobian_enzyme_forward"><code>TrixiEnzyme.jacobian_enzyme_forward</code></a></li><li><a href="api.html#TrixiEnzyme.jacobian_enzyme_forward_closure-Tuple{Any}"><code>TrixiEnzyme.jacobian_enzyme_forward_closure</code></a></li><li><a href="api.html#TrixiEnzyme.jacobian_enzyme_reverse-Tuple{Trixi.SemidiscretizationHyperbolic}"><code>TrixiEnzyme.jacobian_enzyme_reverse</code></a></li><li><a href="api.html#TrixiEnzyme.jacobian_enzyme_reverse_closure-Tuple{Any}"><code>TrixiEnzyme.jacobian_enzyme_reverse_closure</code></a></li><li><a href="api.html#TrixiEnzyme.pick_batchsize"><code>TrixiEnzyme.pick_batchsize</code></a></li><li><a href="api.html#TrixiEnzyme.upwind!-Tuple{Vector, Vector, Any}"><code>TrixiEnzyme.upwind!</code></a></li></ul><h2 id="Detailed-API"><a class="docs-heading-anchor" href="#Detailed-API">Detailed API</a><a id="Detailed-API-1"></a><a class="docs-heading-anchor-permalink" href="#Detailed-API" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="TrixiEnzyme.enzyme_rhs!-Tuple{AbstractVector, AbstractVector, Vararg{Any, 16}}" href="#TrixiEnzyme.enzyme_rhs!-Tuple{AbstractVector, AbstractVector, Vararg{Any, 16}}"><code>TrixiEnzyme.enzyme_rhs!</code></a> — <span class="docstring-category">Method</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><pre><code class="language-julia hljs">enzyme_rhs!(du_ode::AbstractVector, u_ode::AbstractVector, mesh, equations, initial_condition, boundary_conditions, source_terms, solver, boundaries, _node_coordinates, cell_ids, node_coordinates, inverse_jacobian, _neighbor_ids, neighbor_ids, orientation, surface_flux_values, u)</code></pre><p>The best thing to do for a user would be to separate out the things that you need to track through, make them arguments to the function, and then simply Duplicate on those.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/junyixu/TrixiEnzyme.jl/blob/f5e6f6a16ac2f54a3e1742ae6cd6d3189965ad08/src/rhs.jl#L29-L33">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="TrixiEnzyme.jacobian_enzyme_forward" href="#TrixiEnzyme.jacobian_enzyme_forward"><code>TrixiEnzyme.jacobian_enzyme_forward</code></a> — <span class="docstring-category">Function</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><pre><code class="language-julia hljs">jacobian_enzyme_forward(semi::SemidiscretizationHyperbolic; N = pick_batchsize(semi))</code></pre><p>Uses the right-hand side operator of the semidiscretization <code>semi</code> and forward mode automatic differentiation to compute the Jacobian <code>J</code> of the semidiscretization <code>semi</code> at state <code>u0_ode</code>.</p><p><strong>Notes</strong></p><p>Both <code>jacobian_enzyme_forward(semi)</code> and <code>jacobian_enzyme_reverse(semi)</code> depend on <code>enzyme_rhs!</code>.</p><hr/><pre><code class="nohighlight hljs">jacobian_enzyme_forward(f!::F, x::AbstractArray; N = pick_batchsize(x)) where F <: Function</code></pre><p>Uses the function <code>f!</code> and forward mode automatic differentiation to compute the Jacobian <code>J</code></p><p><strong>Examples</strong></p><pre><code class="language-julia-repl hljs">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</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/junyixu/TrixiEnzyme.jl/blob/e056045a6b5d9c10c989b1264ad7170eacc3794e/src/jacobian.jl#L88-L113">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="TrixiEnzyme.jacobian_enzyme_forward_closure-Tuple{Any}" href="#TrixiEnzyme.jacobian_enzyme_forward_closure-Tuple{Any}"><code>TrixiEnzyme.jacobian_enzyme_forward_closure</code></a> — <span class="docstring-category">Method</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><pre><code class="language-julia hljs">jacobian_enzyme_forward_closure(semi::SemidiscretizationHyperbolic; N = pick_batchsize(semi))</code></pre><p>Same as <code>jacobian_enzyme_forward</code> but with closure</p><p><strong>Notes</strong></p><p>I resolved issues related to type instability caused by closures, which is a known limitation of Enzyme.</p><p>I utilized closures here because they simplify the reuse of memory buffers and temporary variables without the need for explicit storage. <code>let</code> blocks create a new hard scope and optionally introduce new local bindings.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/junyixu/TrixiEnzyme.jl/blob/e056045a6b5d9c10c989b1264ad7170eacc3794e/src/jacobian.jl#L3-L13">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="TrixiEnzyme.jacobian_enzyme_reverse-Tuple{Any}" href="#TrixiEnzyme.jacobian_enzyme_reverse-Tuple{Any}"><code>TrixiEnzyme.jacobian_enzyme_reverse</code></a> — <span class="docstring-category">Method</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><pre><code class="language-julia hljs">jacobian_enzyme_reverse(semi::SemidiscretizationHyperbolic)</code></pre><div class="admonition is-warning"><header class="admonition-header">Warning</header><div class="admonition-body"><p>Enzyme.jl does not play well with Polyester.jl and there are no plans to fix this soon.</p></div></div></div><a class="docs-sourcelink" target="_blank" href="https://github.com/junyixu/TrixiEnzyme.jl/blob/e056045a6b5d9c10c989b1264ad7170eacc3794e/src/jacobian.jl#L338-L343">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="TrixiEnzyme.jacobian_enzyme_reverse_closure-Tuple{Any}" href="#TrixiEnzyme.jacobian_enzyme_reverse_closure-Tuple{Any}"><code>TrixiEnzyme.jacobian_enzyme_reverse_closure</code></a> — <span class="docstring-category">Method</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><pre><code class="language-julia hljs">jacobian_enzyme_reverse_closure(semi::SemidiscretizationHyperbolic)</code></pre><p>Same as <code>jacobian_enzyme_reverse</code> but with closure</p><div class="admonition is-warning"><header class="admonition-header">Warning</header><div class="admonition-body"><p>Enzyme.jl does not play well with Polyester.jl and there are no plans to fix this soon.</p></div></div></div><a class="docs-sourcelink" target="_blank" href="https://github.com/junyixu/TrixiEnzyme.jl/blob/e056045a6b5d9c10c989b1264ad7170eacc3794e/src/jacobian.jl#L46-L53">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="TrixiEnzyme.pick_batchsize" href="#TrixiEnzyme.pick_batchsize"><code>TrixiEnzyme.pick_batchsize</code></a> — <span class="docstring-category">Function</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><pre><code class="language-julia hljs">pick_batchsize(x) + -0.0 -0.0 -0.0 0.2 -0.2</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/junyixu/TrixiEnzyme.jl/blob/f5e6f6a16ac2f54a3e1742ae6cd6d3189965ad08/src/jacobian.jl#L88-L116">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="TrixiEnzyme.jacobian_enzyme_forward_closure-Tuple{Any}" href="#TrixiEnzyme.jacobian_enzyme_forward_closure-Tuple{Any}"><code>TrixiEnzyme.jacobian_enzyme_forward_closure</code></a> — <span class="docstring-category">Method</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><pre><code class="language-julia hljs">jacobian_enzyme_forward_closure(semi::SemidiscretizationHyperbolic; N = pick_batchsize(semi))</code></pre><p>Same as <code>jacobian_enzyme_forward</code> but with closure</p><p><strong>Notes</strong></p><p>I resolved issues related to type instability caused by closures, which is a known limitation of Enzyme.</p><p>I utilized closures here because they simplify the reuse of memory buffers and temporary variables without the need for explicit storage. <code>let</code> blocks create a new hard scope and optionally introduce new local bindings.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/junyixu/TrixiEnzyme.jl/blob/f5e6f6a16ac2f54a3e1742ae6cd6d3189965ad08/src/jacobian.jl#L3-L13">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="TrixiEnzyme.jacobian_enzyme_reverse-Tuple{Trixi.SemidiscretizationHyperbolic}" href="#TrixiEnzyme.jacobian_enzyme_reverse-Tuple{Trixi.SemidiscretizationHyperbolic}"><code>TrixiEnzyme.jacobian_enzyme_reverse</code></a> — <span class="docstring-category">Method</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><pre><code class="language-julia hljs">jacobian_enzyme_reverse(semi::SemidiscretizationHyperbolic)</code></pre><p>The jacobian<em>enzyme</em>reverse reuses containers for shadow variables. This might provide beginners with a clear view of how Enzyme works in detail.</p><div class="admonition is-warning"><header class="admonition-header">Warning</header><div class="admonition-body"><p>Enzyme.jl does not play well with Polyester.jl and there are no plans to fix this soon.</p></div></div></div><a class="docs-sourcelink" target="_blank" href="https://github.com/junyixu/TrixiEnzyme.jl/blob/f5e6f6a16ac2f54a3e1742ae6cd6d3189965ad08/src/jacobian.jl#L341-L349">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="TrixiEnzyme.jacobian_enzyme_reverse_closure-Tuple{Any}" href="#TrixiEnzyme.jacobian_enzyme_reverse_closure-Tuple{Any}"><code>TrixiEnzyme.jacobian_enzyme_reverse_closure</code></a> — <span class="docstring-category">Method</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><pre><code class="language-julia hljs">jacobian_enzyme_reverse_closure(semi::SemidiscretizationHyperbolic)</code></pre><p>Same as <code>jacobian_enzyme_reverse</code> but with closure</p><div class="admonition is-warning"><header class="admonition-header">Warning</header><div class="admonition-body"><p>Enzyme.jl does not play well with Polyester.jl and there are no plans to fix this soon.</p></div></div></div><a class="docs-sourcelink" target="_blank" href="https://github.com/junyixu/TrixiEnzyme.jl/blob/f5e6f6a16ac2f54a3e1742ae6cd6d3189965ad08/src/jacobian.jl#L46-L53">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="TrixiEnzyme.pick_batchsize" href="#TrixiEnzyme.pick_batchsize"><code>TrixiEnzyme.pick_batchsize</code></a> — <span class="docstring-category">Function</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><pre><code class="language-julia hljs">pick_batchsize(x) pick_batchsize(semi)</code></pre><p>Return a reasonable batch size for batched differentiation.</p><p><strong>Arguments</strong></p><ul><li><code>x</code>: AbstractArray</li><li><code>semi</code>: SemidiscretizationHyperbolic in Trixi.jl</li></ul><p><strong>Notes</strong></p><p>Inspired by https://github.com/EnzymeAD/Enzyme.jl/pull/1545/files</p><div class="admonition is-warning"><header class="admonition-header">Warning</header><div class="admonition-body"><p>This function is experimental, and not part of the public API.</p></div></div><p><strong>Examples</strong></p><pre><code class="language-julia-repl hljs">julia> pick_batchsize(rand(3)) 3 julia> pick_batchsize(rand(20)) -11</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/junyixu/TrixiEnzyme.jl/blob/e056045a6b5d9c10c989b1264ad7170eacc3794e/src/prelude.jl#L4-L28">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="TrixiEnzyme.upwind!-Tuple{Vector, Vector, Any}" href="#TrixiEnzyme.upwind!-Tuple{Vector, Vector, Any}"><code>TrixiEnzyme.upwind!</code></a> — <span class="docstring-category">Method</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><pre><code class="language-julia hljs">upwind!(du, u, cache)</code></pre><p>Vanilla upwind scheme</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/junyixu/TrixiEnzyme.jl/blob/e056045a6b5d9c10c989b1264ad7170eacc3794e/src/rhs.jl#L1-L5">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="index.html">« Home</a><a class="docs-footer-nextpage" href="examples.html">Examples »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.6.0 on <span class="colophon-date" title="Monday 26 August 2024 16:17">Monday 26 August 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +11</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/junyixu/TrixiEnzyme.jl/blob/f5e6f6a16ac2f54a3e1742ae6cd6d3189965ad08/src/prelude.jl#L4-L28">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="TrixiEnzyme.upwind!-Tuple{Vector, Vector, Any}" href="#TrixiEnzyme.upwind!-Tuple{Vector, Vector, Any}"><code>TrixiEnzyme.upwind!</code></a> — <span class="docstring-category">Method</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><pre><code class="language-julia hljs">upwind!(du, u, cache)</code></pre><p>Vanilla upwind scheme</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/junyixu/TrixiEnzyme.jl/blob/f5e6f6a16ac2f54a3e1742ae6cd6d3189965ad08/src/rhs.jl#L1-L5">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="index.html">« Home</a><a class="docs-footer-nextpage" href="examples.html">Examples »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.6.0 on <span class="colophon-date" title="Monday 26 August 2024 16:27">Monday 26 August 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/dev/examples.html b/dev/examples.html index ad1fcbc..bd8f6db 100644 --- a/dev/examples.html +++ b/dev/examples.html @@ -24,6 +24,6 @@ J1 = jacobian_ad_forward(semi) J2 = jacobian_enzyme_forward(semi;N=1) -J3 = jacobian_enzyme_reverse(semi;N=1) +J3 = jacobian_enzyme_reverse(semi) -J1 == J2</code></pre></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="api.html">« API reference</a><a class="docs-footer-nextpage" href="GSoC.html">GSoC »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.6.0 on <span class="colophon-date" title="Monday 26 August 2024 16:17">Monday 26 August 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +J1 == J2</code></pre></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="api.html">« API reference</a><a class="docs-footer-nextpage" href="GSoC.html">GSoC »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.6.0 on <span class="colophon-date" title="Monday 26 August 2024 16:27">Monday 26 August 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/dev/index.html b/dev/index.html index 63b6d06..9483eae 100644 --- a/dev/index.html +++ b/dev/index.html @@ -16,4 +16,4 @@ julia> @time jacobian_enzyme_forward(TrixiEnzyme.upwind!, x, N=11); 0.000332 seconds (307 allocations: 410.453 KiB)</code></pre><p>When the cache is relatively small and you have appropriately chosen the batch size, Enzyme generally performs faster than ForwardDiff (see <a href="https://github.com/junyixu/TrixiEnzyme.jl/blob/main/test/UpwindTest.jl">test</a>). <img src="img/enzyme_ForwardDiff.png" alt="enzyme ForwardDiff upwind"/></p><p>If you do not explicitly provide a batch size, TrixiEnzyme will try to guess one for you based on your input vector:</p><pre><code class="language-julia-repl hljs">julia> x = -1:0.01:1; julia> @time jacobian_enzyme_forward(TrixiEnzyme.upwind!, x); - 0.000327 seconds (307 allocations: 410.453 KiB)</code></pre><p>Benchmark for a 401x401 Jacobian of <code>TrixiEnzyme.upwind!</code> (Lower is better): <img src="img/upwind_benchmark.png" alt="upwind benchmark"/> <code>Enyme(@batch)</code> means applying <code>Polyester.@batch</code> to <code>middlebatches</code>.</p></article><nav class="docs-footer"><a class="docs-footer-nextpage" href="api.html">API reference »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.6.0 on <span class="colophon-date" title="Monday 26 August 2024 16:18">Monday 26 August 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> + 0.000327 seconds (307 allocations: 410.453 KiB)</code></pre><p>Benchmark for a 401x401 Jacobian of <code>TrixiEnzyme.upwind!</code> (Lower is better): <img src="img/upwind_benchmark.png" alt="upwind benchmark"/> <code>Enyme(@batch)</code> means applying <code>Polyester.@batch</code> to <code>middlebatches</code>.</p></article><nav class="docs-footer"><a class="docs-footer-nextpage" href="api.html">API reference »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.6.0 on <span class="colophon-date" title="Monday 26 August 2024 16:27">Monday 26 August 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/dev/notes.html b/dev/notes.html index 2a4941d..6896be1 100644 --- a/dev/notes.html +++ b/dev/notes.html @@ -1,3 +1,3 @@ <!DOCTYPE html> <html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Notes · TrixiEnzyme.jl</title><meta name="title" content="Notes · TrixiEnzyme.jl"/><meta property="og:title" content="Notes · TrixiEnzyme.jl"/><meta property="twitter:title" content="Notes · TrixiEnzyme.jl"/><meta name="description" content="Documentation for TrixiEnzyme.jl."/><meta property="og:description" content="Documentation for TrixiEnzyme.jl."/><meta property="twitter:description" content="Documentation for TrixiEnzyme.jl."/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-mocha.css" data-theme-name="catppuccin-mocha"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-macchiato.css" data-theme-name="catppuccin-macchiato"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-frappe.css" data-theme-name="catppuccin-frappe"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-latte.css" data-theme-name="catppuccin-latte"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit"><a href="index.html">TrixiEnzyme.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="index.html">Home</a></li><li><a class="tocitem" href="api.html">API reference</a></li><li><a class="tocitem" href="examples.html">Examples</a></li><li><a class="tocitem" href="GSoC.html">GSoC</a></li><li class="is-active"><a class="tocitem" href="notes.html">Notes</a><ul class="internal"><li><a class="tocitem" href="#Proof-of-reverse-mode-AD"><span>Proof of reverse mode AD</span></a></li></ul></li><li><a class="tocitem" href="Contact.html">Contact Developer</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href="notes.html">Notes</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="notes.html">Notes</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/junyixu/TrixiEnzyme.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/junyixu/TrixiEnzyme.jl/blob/main/docs/src/notes.md" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h2 id="Proof-of-reverse-mode-AD"><a class="docs-heading-anchor" href="#Proof-of-reverse-mode-AD">Proof of reverse mode AD</a><a id="Proof-of-reverse-mode-AD-1"></a><a class="docs-heading-anchor-permalink" href="#Proof-of-reverse-mode-AD" title="Permalink"></a></h2><p>Take the example of polar coordinate system <span>$x = r \cos \theta, y = r \sin \theta$</span>, according to the chain rule: <img src="img/compute_graph.png" alt="compute_graph"/> We use <span>$t$</span> to represent the <span>$n$</span>-th layer in the tree. with the values of 1,2,3.</p><p class="math-container">\[\frac{\partial y_1}{\partial x_1} = \frac{\partial y_1}{\partial v_4} \frac{\partial v_4}{\partial x_1} \implies \frac{\partial y_1}{\partial x_1} = \sum_{i(t)} \frac{\partial y_1}{\partial v_{t,i}} {\color{red}\frac{\partial v_{t,i}}{\partial x_1}}\]</p><p class="math-container">\[\frac{\partial v_4}{\partial x_1} = \frac{\partial v_4}{\partial v_{-1}} \frac{\partial v_{-1}}{\partial x_1} + \frac{\partial v_4}{\partial v_1} \frac{\partial v_1}{\partial x_1} \implies {\color{red}\frac{\partial v_{t,i}}{\partial x_1}} = \sum_{j(t)} \frac{\partial v_{t,i}}{\partial v_{t-1, j}} \frac{\partial v_{t-1, j}}{\partial x_1}\]</p><p class="math-container">\[\frac{\partial y_1}{\partial x_1} = \sum_{i(t)} \frac{\partial y_1}{\partial v_{t,i}} -\sum_{j(i)} \frac{\partial v_{t,i}}{\partial v_{t-1,j}} \frac{\partial v_{t-1,j}}{\partial x_1} = \sum_{j} \bar{v}_{t-1,j} \frac{\partial v_{t-1,j}}{\partial x_1}\]</p><p>where we define adjoint as</p><p class="math-container">\[\bar{v}_{t-1, j} = \sum_i \bar{v}_{t, i} \frac{\partial v_{t,i}}{\partial v_{t-1,j}}.\]</p><p>For example (in this computing graph):</p><p class="math-container">\[\bar{v}_0 = \bar{v}_{1,2} = \frac{\partial v_{2,1}}{\partial v_{1,2}} \bar{v}_{2,1} + \frac{\partial v_{2,2}}{\partial v_{1,2}} \bar{v}_{2,2}.\]</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="GSoC.html">« GSoC</a><a class="docs-footer-nextpage" href="Contact.html">Contact Developer »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.6.0 on <span class="colophon-date" title="Monday 26 August 2024 16:17">Monday 26 August 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> +\sum_{j(i)} \frac{\partial v_{t,i}}{\partial v_{t-1,j}} \frac{\partial v_{t-1,j}}{\partial x_1} = \sum_{j} \bar{v}_{t-1,j} \frac{\partial v_{t-1,j}}{\partial x_1}\]</p><p>where we define adjoint as</p><p class="math-container">\[\bar{v}_{t-1, j} = \sum_i \bar{v}_{t, i} \frac{\partial v_{t,i}}{\partial v_{t-1,j}}.\]</p><p>For example (in this computing graph):</p><p class="math-container">\[\bar{v}_0 = \bar{v}_{1,2} = \frac{\partial v_{2,1}}{\partial v_{1,2}} \bar{v}_{2,1} + \frac{\partial v_{2,2}}{\partial v_{1,2}} \bar{v}_{2,2}.\]</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="GSoC.html">« GSoC</a><a class="docs-footer-nextpage" href="Contact.html">Contact Developer »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.6.0 on <span class="colophon-date" title="Monday 26 August 2024 16:27">Monday 26 August 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> diff --git a/dev/objects.inv b/dev/objects.inv index a9f88793c18e534b4de79b28e5b6dcd12569d0bd..e823350dc7eff6f341dbeab436dbc614b08d372b 100644 GIT binary patch delta 714 zcmV;*0yX{82JHrruYZL=HBCy@*gog@`1;%k8Pg-=CO(N(1lR}RCJq-SP2ftU#CRsc zWjpkX!<%c+G$TziB1Vrq%@WE(Xg%lg=hcW^j@4NRb7K#2Z%iuFmMJGZ;JbTeXG$6# znGjP=c~reVq9r9NBh5-4@~J8ep3A3oN+mhrQ%c%r-rM(^Kz|7a4`vra@&tcUrnEUh zXA?gTzO*%(W9)_K-shpm_Xfw7Q7%CxR8qhSv2Q9a62j}|E*jOk+}4)|K?!2FT0Dw( zkAiF*@q}wkge3dN<0VB#D2epD;N^>u*dMheTK8sEyasp;Xf&YKuzNy(#BQ{@w=4K# zNqQ-0)m5H-sDF@9BOO)E&_3E;na&AQ6%!7(d~Jf@HPj63Q>CU^rqUGF&7SqYG$P zEo+cVvCGp;%nR)g)9D)7S6bthm@g9hGkG`C;$VYg!{|Y(mECQgl6;GY&Pr}H7Z!$G z#&}VfLKFT{`k|W^kie3_lfaSKB^e{+9CO39vFGj1N`Hlf3R!m<HeJ-_h8^cUZ1voE z_(kZ<7B<y)E>F3M7C079Z-qJ_KuG{cU_UY=Qt{+dJ+}2QG#A_3hh+;1upzLELi!%D z5i`oHGhdYsl^P8Jn%yo4gAT>2b-U7N;Se^ohlf3Wc+Vp>6<kiJ98YFSuegrkJ~^4y z4qBSnqJJ0J%GU4$-WIm_f9`DaDSZI-|4^=<ol;6>q2f^IrABYi_bR>PQ_t@W&U%AS z;k(uA9gnswY@eX&+ewtD+-2Nb+s(>OTGrreMoM*mA8!<_qu&3;?W<ZHZo7_J87Ps5 zV@gFV@<@}Z@_e<nEjU$)i2l8rjj#7Nd1*Tn(L=*z>bf&`-MnK=YXghCj_PpgK5da{ wqPjJ{<C^QayNCnmA3g7I+RYwel-s&hj9;1a`&E}!&h(G$>3sqI0@6A}CHnncF8}}l delta 687 zcmV;g0#N<!2GRzQuYVos`hb+G{y68{kDMDJV|s?%#AmUJ0Q(@^!STYR3EZfZ7|%p_ zZMXh%cy|k$W~50*#ORr)SweXTt<OCEvf8ohvAPIhZto#(#iTNAnexB`zPly6P}1<o zgqZ5cqw4z+Eh$kMX;$)(PgP;?QogKHD#;0-Qqr#Z;Lrzw5`PRH%&vsw3I3!^X>*1y zP5e0c($;9oI0(_b&qI&z4Nfhiyn;%oq<|G--&9;AgtyJRXjJQV+q^soN)Wr(;#vH+ z6lCLwCtPD9B-uY6FDWuYNu=KeFBd{$f7F&}y*I1kHNa~?qXD&sjS2k`yVL5?-r$cV z>7}4mS9=bjLVrSybW}A%`)K>hbWWJ6m~gn2*Tx85L(RZG6$Kmxh9fp2!$m?dI)irg zvIaR9J3r0DywJXw&a9Drr8VA&`697DlXoL64mLP8jGm-g*=X~W<Srh%RC1%aurTB@ z#;d{<n(&v>Pu;YD1eOGz1dhb6$rvH$m>aH*t+(4N6@L;cWIbirOi`N~PMptSYvwM) zFG8ocu<5?b@|>G!fn)Kq%hUk@N&+|n`;i%uiWl$dvF(SUx!4XLwk;&UhQO{0>1V`R z%qX+Yd{;VDYBU6BcE2DDCKRjD?Q)}qLpabL9?tmjBahTna5<rJKba}L;yQ-M<ZM=F z(9*;fy?@A7wuc|^zOc>z^I(Th=_9EBhjRVulu|Ma6^A<iYV-zuuhKg`_x#@AqBr;y zuB~40bhMSib_LbkPNGER&f`9{{ZiRW%O?0%BBi>2A3GY>(eHQ3_D!vhY`aQ*k9O@2 zoQddZGIjHnyLsHxXmx}|UYl(=bswk5G-lh{KPYg`_1sl*1pSlOJ<8d{2+i2mt&I4_ VnU7ahU7qw$Z1uhYe*y3aD&zG+Wa<C_ diff --git a/dev/search_index.js b/dev/search_index.js index 5174f46..b791d49 100644 --- a/dev/search_index.js +++ b/dev/search_index.js @@ -1,3 +1,3 @@ var documenterSearchIndex = {"docs": -[{"location":"notes.html#Proof-of-reverse-mode-AD","page":"Notes","title":"Proof of reverse mode AD","text":"","category":"section"},{"location":"notes.html","page":"Notes","title":"Notes","text":"Take the example of polar coordinate system x = r cos theta y = r sin theta, according to the chain rule: (Image: compute_graph) We use t to represent the n-th layer in the tree. with the values of 1,2,3.","category":"page"},{"location":"notes.html","page":"Notes","title":"Notes","text":"fracpartial y_1partial x_1 = fracpartial y_1partial v_4 fracpartial v_4partial x_1 implies fracpartial y_1partial x_1 = sum_i(t) fracpartial y_1partial v_ti colorredfracpartial v_tipartial x_1","category":"page"},{"location":"notes.html","page":"Notes","title":"Notes","text":"fracpartial v_4partial x_1 = fracpartial v_4partial v_-1 fracpartial v_-1partial x_1 + fracpartial v_4partial v_1 fracpartial v_1partial x_1 implies colorredfracpartial v_tipartial x_1 = sum_j(t) fracpartial v_tipartial v_t-1 j fracpartial v_t-1 jpartial x_1","category":"page"},{"location":"notes.html","page":"Notes","title":"Notes","text":"fracpartial y_1partial x_1 = sum_i(t) fracpartial y_1partial v_ti\nsum_j(i) fracpartial v_tipartial v_t-1j fracpartial v_t-1jpartial x_1 = sum_j barv_t-1j fracpartial v_t-1jpartial x_1","category":"page"},{"location":"notes.html","page":"Notes","title":"Notes","text":"where we define adjoint as","category":"page"},{"location":"notes.html","page":"Notes","title":"Notes","text":"barv_t-1 j = sum_i barv_t i fracpartial v_tipartial v_t-1j","category":"page"},{"location":"notes.html","page":"Notes","title":"Notes","text":"For example (in this computing graph):","category":"page"},{"location":"notes.html","page":"Notes","title":"Notes","text":"barv_0 = barv_12 = fracpartial v_21partial v_12 barv_21 + fracpartial v_22partial v_12 barv_22","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.enzyme_rhs!-Tuple{AbstractVector, AbstractVector, Vararg{Any, 16}}","page":"API reference","title":"TrixiEnzyme.enzyme_rhs!","text":"enzyme_rhs!(du_ode::AbstractVector, u_ode::AbstractVector, mesh, equations, initial_condition, boundary_conditions, source_terms, solver, boundaries, _node_coordinates, cell_ids, node_coordinates, inverse_jacobian, _neighbor_ids, neighbor_ids, orientation, surface_flux_values, u)\n\nThe best thing to do for a user would be to separate out the things that you need to track through, make them arguments to the function, and then simply Duplicate on those.\n\n\n\n\n\n","category":"method"},{"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.jacobian_enzyme_forward_closure-Tuple{Any}","page":"API reference","title":"TrixiEnzyme.jacobian_enzyme_forward_closure","text":"jacobian_enzyme_forward_closure(semi::SemidiscretizationHyperbolic; N = pick_batchsize(semi))\n\nSame as jacobian_enzyme_forward but with closure\n\nNotes\n\nI resolved issues related to type instability caused by closures, which is a known limitation of Enzyme.\n\nI utilized closures here because they simplify the reuse of memory buffers and temporary variables without the need for explicit storage. let blocks create a new hard scope and optionally introduce new local bindings.\n\n\n\n\n\n","category":"method"},{"location":"api.html#TrixiEnzyme.jacobian_enzyme_reverse-Tuple{Any}","page":"API reference","title":"TrixiEnzyme.jacobian_enzyme_reverse","text":"jacobian_enzyme_reverse(semi::SemidiscretizationHyperbolic)\n\nwarning: Warning\nEnzyme.jl does not play well with Polyester.jl and there are no plans to fix this soon.\n\n\n\n\n\n","category":"method"},{"location":"api.html#TrixiEnzyme.jacobian_enzyme_reverse_closure-Tuple{Any}","page":"API reference","title":"TrixiEnzyme.jacobian_enzyme_reverse_closure","text":"jacobian_enzyme_reverse_closure(semi::SemidiscretizationHyperbolic)\n\nSame as jacobian_enzyme_reverse but with closure\n\nwarning: Warning\nEnzyme.jl does not play well with Polyester.jl and there are no plans to fix this soon.\n\n\n\n\n\n","category":"method"},{"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":"examples.html#Examples","page":"Examples","title":"Examples","text":"","category":"section"},{"location":"examples.html#Scalar-linear-advection-equation-in-1D","page":"Examples","title":"Scalar linear advection equation in 1D","text":"","category":"section"},{"location":"examples.html","page":"Examples","title":"Examples","text":"We will implement the scalar linear advection equation in 1D with the advection velocity 1 and compute its Jacobian.","category":"page"},{"location":"examples.html","page":"Examples","title":"Examples","text":"using Trixi\nusing TrixiEnzyme\n\n# %%\n# equation with a advection_velocity of `1`.\nadvection_velocity = 1.0\nequations = LinearScalarAdvectionEquation1D(advection_velocity)\n\n# create DG solver with flux lax friedrichs and LGL basis\nsolver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)\n\n# distretize domain with `TreeMesh`\ncoordinates_min = -1.0 # minimum coordinate\ncoordinates_max = 1.0 # maximum coordinate\nmesh = TreeMesh(coordinates_min, coordinates_max,\n initial_refinement_level=4, # number of elements = 2^4\n n_cells_max=30_000)\n\n# create initial condition and semidiscretization\ninitial_condition_sine_wave(x, t, equations) = SVector(1.0 + 0.5 * sin(pi * sum(x - equations.advection_velocity * t)))\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_sine_wave, solver)\n\nJ1 = jacobian_ad_forward(semi)\nJ2 = jacobian_enzyme_forward(semi;N=1)\nJ3 = jacobian_enzyme_reverse(semi;N=1)\n\nJ1 == J2","category":"page"},{"location":"GSoC.html#Final-Report:-GSoC-'24","page":"GSoC","title":"Final Report: GSoC '24","text":"","category":"section"},{"location":"GSoC.html","page":"GSoC","title":"GSoC","text":"Student Name: Junyi(@junyixu).\nOrganization: Trixi Framework community.\nMentors: Michael(@sloede) and Hendrik(@ranocha)\nProject: Integrating the Modern CFD Package Trixi.jl with Compiler-Based Auto-Diff via Enzyme.jl\nProject Link: https://github.com/junyixu/TrixiEnzyme.jl","category":"page"},{"location":"GSoC.html#Project-Overview","page":"GSoC","title":"Project Overview","text":"","category":"section"},{"location":"GSoC.html","page":"GSoC","title":"GSoC","text":"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.","category":"page"},{"location":"GSoC.html","page":"GSoC","title":"GSoC","text":"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.\nReverse Mode Automatic Differentiation for DG.\nImprove Performance:\nExtract 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.\nbatchsize for Jacobians:\nOptimize 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.\nAutomatically Pick batchsize\nExplore 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.","category":"page"},{"location":"GSoC.html","page":"GSoC","title":"GSoC","text":"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.","category":"page"},{"location":"GSoC.html#Key-Highlights","page":"GSoC","title":"Key Highlights","text":"","category":"section"},{"location":"GSoC.html#Function-Prototyping","page":"GSoC","title":"Function Prototyping","text":"","category":"section"},{"location":"GSoC.html","page":"GSoC","title":"GSoC","text":"Functions intended for automatic differentiation with Enzyme.autodiff should adhere to specific naming conventions:\nFunctions must start with enzyme_.\nThe primary role of these functions is to unpack semi.cache and accurately recreate cache for effective use with Enzyme’s APIs.","category":"page"},{"location":"GSoC.html#Configuration","page":"GSoC","title":"Configuration","text":"","category":"section"},{"location":"GSoC.html","page":"GSoC","title":"GSoC","text":"The functions jacobian_enzyme_forward and jacobian_enzyme_reverse are configured to behave similarly to jacobian_ad_forward, with the primary distinction being how batchsize is chosen:\nAn alternative usage pattern involves defining new functions prefixed with enzyme_ and passing them to jacobian_enzyme_forward or jacobian_enzyme_reverse for differentiation.","category":"page"},{"location":"GSoC.html#Optimization-Strategies","page":"GSoC","title":"Optimization Strategies","text":"","category":"section"},{"location":"GSoC.html","page":"GSoC","title":"GSoC","text":"To enhance performance, several optimization strategies are recommended:\nReuse containers for shadow variables during middlebatching and utilize the @batch macro for multithreading acceleration to improve computational efficiency.\nMinimize the number of arguments extracted from semi.cache to reduce overhead and streamline computations.\nCurrent benchmarks for Enzyme indicate mixed results. In scenarios involving smaller caches, like in toy models, jacobian_enzyme(semi) performs better than ForwardDiff. However, in the context of Discontinuous Galerkin Collocation Spectral Element Method (DGSEM) simulations, the performance may lag behind jacobian_ad_forward(semi) due to the challenges associated with large cache sizes (elements._surface_flux_values and cache.interfaces._u) and the complexities involved in unpacking and recreating the cache.","category":"page"},{"location":"GSoC.html","page":"GSoC","title":"GSoC","text":"This package aims to provide a robust framework for integrating advanced differentiation techniques into Trixi, addressing both performance and usability to facilitate high-quality computational research and development.","category":"page"},{"location":"GSoC.html#Constraints-and-Future-Work","page":"GSoC","title":"Constraints and Future Work","text":"","category":"section"},{"location":"GSoC.html","page":"GSoC","title":"GSoC","text":"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.\nIntegrate 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.","category":"page"},{"location":"GSoC.html#Acknowledgments","page":"GSoC","title":"Acknowledgments","text":"","category":"section"},{"location":"GSoC.html","page":"GSoC","title":"GSoC","text":"The entire project, along with this 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":"GSoC.html","page":"GSoC","title":"GSoC","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#Notes-about-Enzyme","page":"Home","title":"Notes about Enzyme","text":"","category":"section"},{"location":"index.html","page":"Home","title":"Home","text":"Allocations of temporary arrays like these puts more pressure on the GC and impacts performance. That's why we have decided to pre-allocate them in create_cache - which is called when the semidiscretization semi is constructed. This is why we need Enzyme.jl, which supports mutating operations.","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"There's still some caveats to make_zero! since it's brand new so there's some edge cases on a few structures, but those will get worked out and this flow should be the recommended path. One needs to be careful with a vanilla closure outside Enzyme. If one writes to caches and expect to differentiate through them, then the closure should be duplicated for handling the derivative of those values. If you want to track derivatives through arrays that are enclosed, you have to duplicate the array to have shadow memory for its differentiation. if you want to track derivatives through arrays that are enclosed, you have to duplicate the array to have shadow memory for its differentiation So if you only have the original memory, you cannot do the differentiation since you don't have a place to store the extra values. In a simplified sense, a Dual{Float64} is 128 bits, Float64 is 64 bits, so if you're writing to a buffer of 5 Float64 numbers, you need 5264 bits of space to keep a dual number, which you don't have. So the best thing to do for a user would be to separate out the things that you need to track through, make them arguments to the function, and then simply Duplicate on those. This is how TrixiEnzyme.jacobian_enzyme_forward works: Extract the arguments from semi.cache and duplicate them to store shadows.","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":"To utilize Enzyme.BatchDuplicated(x, ∂f_∂xs) or Enzyme.BatchDuplicatedNoNeed(x, ∂f_∂xs), one can create a tuple containing duals (or shadows). 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":"When the cache is relatively small and you have appropriately chosen the batch size, Enzyme generally performs faster than ForwardDiff (see test). (Image: enzyme ForwardDiff upwind)","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"If you do not explicitly provide a batch 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":"index.html","page":"Home","title":"Home","text":"Benchmark for a 401x401 Jacobian of TrixiEnzyme.upwind! (Lower is better): (Image: upwind benchmark) Enyme(@batch) means applying Polyester.@batch to middlebatches.","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":"notes.html#Proof-of-reverse-mode-AD","page":"Notes","title":"Proof of reverse mode AD","text":"","category":"section"},{"location":"notes.html","page":"Notes","title":"Notes","text":"Take the example of polar coordinate system x = r cos theta y = r sin theta, according to the chain rule: (Image: compute_graph) We use t to represent the n-th layer in the tree. with the values of 1,2,3.","category":"page"},{"location":"notes.html","page":"Notes","title":"Notes","text":"fracpartial y_1partial x_1 = fracpartial y_1partial v_4 fracpartial v_4partial x_1 implies fracpartial y_1partial x_1 = sum_i(t) fracpartial y_1partial v_ti colorredfracpartial v_tipartial x_1","category":"page"},{"location":"notes.html","page":"Notes","title":"Notes","text":"fracpartial v_4partial x_1 = fracpartial v_4partial v_-1 fracpartial v_-1partial x_1 + fracpartial v_4partial v_1 fracpartial v_1partial x_1 implies colorredfracpartial v_tipartial x_1 = sum_j(t) fracpartial v_tipartial v_t-1 j fracpartial v_t-1 jpartial x_1","category":"page"},{"location":"notes.html","page":"Notes","title":"Notes","text":"fracpartial y_1partial x_1 = sum_i(t) fracpartial y_1partial v_ti\nsum_j(i) fracpartial v_tipartial v_t-1j fracpartial v_t-1jpartial x_1 = sum_j barv_t-1j fracpartial v_t-1jpartial x_1","category":"page"},{"location":"notes.html","page":"Notes","title":"Notes","text":"where we define adjoint as","category":"page"},{"location":"notes.html","page":"Notes","title":"Notes","text":"barv_t-1 j = sum_i barv_t i fracpartial v_tipartial v_t-1j","category":"page"},{"location":"notes.html","page":"Notes","title":"Notes","text":"For example (in this computing graph):","category":"page"},{"location":"notes.html","page":"Notes","title":"Notes","text":"barv_0 = barv_12 = fracpartial v_21partial v_12 barv_21 + fracpartial v_22partial v_12 barv_22","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.enzyme_rhs!-Tuple{AbstractVector, AbstractVector, Vararg{Any, 16}}","page":"API reference","title":"TrixiEnzyme.enzyme_rhs!","text":"enzyme_rhs!(du_ode::AbstractVector, u_ode::AbstractVector, mesh, equations, initial_condition, boundary_conditions, source_terms, solver, boundaries, _node_coordinates, cell_ids, node_coordinates, inverse_jacobian, _neighbor_ids, neighbor_ids, orientation, surface_flux_values, u)\n\nThe best thing to do for a user would be to separate out the things that you need to track through, make them arguments to the function, and then simply Duplicate on those.\n\n\n\n\n\n","category":"method"},{"location":"api.html#TrixiEnzyme.jacobian_enzyme_forward","page":"API reference","title":"TrixiEnzyme.jacobian_enzyme_forward","text":"jacobian_enzyme_forward(semi::SemidiscretizationHyperbolic; N = pick_batchsize(semi))\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\nNotes\n\nBoth jacobian_enzyme_forward(semi) and jacobian_enzyme_reverse(semi) depend on enzyme_rhs!.\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.jacobian_enzyme_forward_closure-Tuple{Any}","page":"API reference","title":"TrixiEnzyme.jacobian_enzyme_forward_closure","text":"jacobian_enzyme_forward_closure(semi::SemidiscretizationHyperbolic; N = pick_batchsize(semi))\n\nSame as jacobian_enzyme_forward but with closure\n\nNotes\n\nI resolved issues related to type instability caused by closures, which is a known limitation of Enzyme.\n\nI utilized closures here because they simplify the reuse of memory buffers and temporary variables without the need for explicit storage. let blocks create a new hard scope and optionally introduce new local bindings.\n\n\n\n\n\n","category":"method"},{"location":"api.html#TrixiEnzyme.jacobian_enzyme_reverse-Tuple{Trixi.SemidiscretizationHyperbolic}","page":"API reference","title":"TrixiEnzyme.jacobian_enzyme_reverse","text":"jacobian_enzyme_reverse(semi::SemidiscretizationHyperbolic)\n\nThe jacobianenzymereverse reuses containers for shadow variables. This might provide beginners with a clear view of how Enzyme works in detail.\n\nwarning: Warning\nEnzyme.jl does not play well with Polyester.jl and there are no plans to fix this soon.\n\n\n\n\n\n","category":"method"},{"location":"api.html#TrixiEnzyme.jacobian_enzyme_reverse_closure-Tuple{Any}","page":"API reference","title":"TrixiEnzyme.jacobian_enzyme_reverse_closure","text":"jacobian_enzyme_reverse_closure(semi::SemidiscretizationHyperbolic)\n\nSame as jacobian_enzyme_reverse but with closure\n\nwarning: Warning\nEnzyme.jl does not play well with Polyester.jl and there are no plans to fix this soon.\n\n\n\n\n\n","category":"method"},{"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":"examples.html#Examples","page":"Examples","title":"Examples","text":"","category":"section"},{"location":"examples.html#Scalar-linear-advection-equation-in-1D","page":"Examples","title":"Scalar linear advection equation in 1D","text":"","category":"section"},{"location":"examples.html","page":"Examples","title":"Examples","text":"We will implement the scalar linear advection equation in 1D with the advection velocity 1 and compute its Jacobian.","category":"page"},{"location":"examples.html","page":"Examples","title":"Examples","text":"using Trixi\nusing TrixiEnzyme\n\n# %%\n# equation with a advection_velocity of `1`.\nadvection_velocity = 1.0\nequations = LinearScalarAdvectionEquation1D(advection_velocity)\n\n# create DG solver with flux lax friedrichs and LGL basis\nsolver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)\n\n# distretize domain with `TreeMesh`\ncoordinates_min = -1.0 # minimum coordinate\ncoordinates_max = 1.0 # maximum coordinate\nmesh = TreeMesh(coordinates_min, coordinates_max,\n initial_refinement_level=4, # number of elements = 2^4\n n_cells_max=30_000)\n\n# create initial condition and semidiscretization\ninitial_condition_sine_wave(x, t, equations) = SVector(1.0 + 0.5 * sin(pi * sum(x - equations.advection_velocity * t)))\n\nsemi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_sine_wave, solver)\n\nJ1 = jacobian_ad_forward(semi)\nJ2 = jacobian_enzyme_forward(semi;N=1)\nJ3 = jacobian_enzyme_reverse(semi)\n\nJ1 == J2","category":"page"},{"location":"GSoC.html#Final-Report:-GSoC-'24","page":"GSoC","title":"Final Report: GSoC '24","text":"","category":"section"},{"location":"GSoC.html","page":"GSoC","title":"GSoC","text":"Student Name: Junyi(@junyixu).\nOrganization: Trixi Framework community.\nMentors: Michael(@sloede) and Hendrik(@ranocha)\nProject: Integrating the Modern CFD Package Trixi.jl with Compiler-Based Auto-Diff via Enzyme.jl\nProject Link: https://github.com/junyixu/TrixiEnzyme.jl","category":"page"},{"location":"GSoC.html#Project-Overview","page":"GSoC","title":"Project Overview","text":"","category":"section"},{"location":"GSoC.html","page":"GSoC","title":"GSoC","text":"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.","category":"page"},{"location":"GSoC.html","page":"GSoC","title":"GSoC","text":"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.\nReverse Mode Automatic Differentiation for DG.\nImprove Performance:\nExtract 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.\nbatchsize for Jacobians:\nOptimize 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.\nAutomatically Pick batchsize\nExplore 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.","category":"page"},{"location":"GSoC.html","page":"GSoC","title":"GSoC","text":"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.","category":"page"},{"location":"GSoC.html#Key-Highlights","page":"GSoC","title":"Key Highlights","text":"","category":"section"},{"location":"GSoC.html#Function-Prototyping","page":"GSoC","title":"Function Prototyping","text":"","category":"section"},{"location":"GSoC.html","page":"GSoC","title":"GSoC","text":"Functions intended for automatic differentiation with Enzyme.autodiff should adhere to specific naming conventions:\nFunctions must start with enzyme_.\nThe primary role of these functions is to unpack semi.cache and accurately recreate cache for effective use with Enzyme’s APIs.","category":"page"},{"location":"GSoC.html#Configuration","page":"GSoC","title":"Configuration","text":"","category":"section"},{"location":"GSoC.html","page":"GSoC","title":"GSoC","text":"The functions jacobian_enzyme_forward and jacobian_enzyme_reverse are configured to behave similarly to jacobian_ad_forward, with the primary distinction being how batchsize is chosen:\nAn alternative usage pattern involves defining new functions prefixed with enzyme_ and passing them to jacobian_enzyme_forward or jacobian_enzyme_reverse for differentiation.","category":"page"},{"location":"GSoC.html#Optimization-Strategies","page":"GSoC","title":"Optimization Strategies","text":"","category":"section"},{"location":"GSoC.html","page":"GSoC","title":"GSoC","text":"To enhance performance, several optimization strategies are recommended:\nReuse containers for shadow variables during middlebatching and utilize the @batch macro for multithreading acceleration to improve computational efficiency.\nMinimize the number of arguments extracted from semi.cache to reduce overhead and streamline computations.\nCurrent benchmarks for Enzyme indicate mixed results. In scenarios involving smaller caches, like in toy models, jacobian_enzyme(semi) performs better than ForwardDiff. However, in the context of Discontinuous Galerkin Collocation Spectral Element Method (DGSEM) simulations, the performance may lag behind jacobian_ad_forward(semi) due to the challenges associated with large cache sizes (elements._surface_flux_values and cache.interfaces._u) and the complexities involved in unpacking and recreating the cache.","category":"page"},{"location":"GSoC.html","page":"GSoC","title":"GSoC","text":"This package aims to provide a robust framework for integrating advanced differentiation techniques into Trixi, addressing both performance and usability to facilitate high-quality computational research and development.","category":"page"},{"location":"GSoC.html#Constraints-and-Future-Work","page":"GSoC","title":"Constraints and Future Work","text":"","category":"section"},{"location":"GSoC.html","page":"GSoC","title":"GSoC","text":"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.\nIntegrate 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.","category":"page"},{"location":"GSoC.html#Acknowledgments","page":"GSoC","title":"Acknowledgments","text":"","category":"section"},{"location":"GSoC.html","page":"GSoC","title":"GSoC","text":"The entire project, along with this 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":"GSoC.html","page":"GSoC","title":"GSoC","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#Notes-about-Enzyme","page":"Home","title":"Notes about Enzyme","text":"","category":"section"},{"location":"index.html","page":"Home","title":"Home","text":"Allocations of temporary arrays like these puts more pressure on the GC and impacts performance. That's why we have decided to pre-allocate them in create_cache - which is called when the semidiscretization semi is constructed. This is why we need Enzyme.jl, which supports mutating operations.","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"There's still some caveats to make_zero! since it's brand new so there's some edge cases on a few structures, but those will get worked out and this flow should be the recommended path. One needs to be careful with a vanilla closure outside Enzyme. If one writes to caches and expect to differentiate through them, then the closure should be duplicated for handling the derivative of those values. If you want to track derivatives through arrays that are enclosed, you have to duplicate the array to have shadow memory for its differentiation. if you want to track derivatives through arrays that are enclosed, you have to duplicate the array to have shadow memory for its differentiation So if you only have the original memory, you cannot do the differentiation since you don't have a place to store the extra values. In a simplified sense, a Dual{Float64} is 128 bits, Float64 is 64 bits, so if you're writing to a buffer of 5 Float64 numbers, you need 5264 bits of space to keep a dual number, which you don't have. So the best thing to do for a user would be to separate out the things that you need to track through, make them arguments to the function, and then simply Duplicate on those. This is how TrixiEnzyme.jacobian_enzyme_forward works: Extract the arguments from semi.cache and duplicate them to store shadows.","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":"To utilize Enzyme.BatchDuplicated(x, ∂f_∂xs) or Enzyme.BatchDuplicatedNoNeed(x, ∂f_∂xs), one can create a tuple containing duals (or shadows). 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":"When the cache is relatively small and you have appropriately chosen the batch size, Enzyme generally performs faster than ForwardDiff (see test). (Image: enzyme ForwardDiff upwind)","category":"page"},{"location":"index.html","page":"Home","title":"Home","text":"If you do not explicitly provide a batch 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":"index.html","page":"Home","title":"Home","text":"Benchmark for a 401x401 Jacobian of TrixiEnzyme.upwind! (Lower is better): (Image: upwind benchmark) Enyme(@batch) means applying Polyester.@batch to middlebatches.","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"}] }