-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Documenter.jl
committed
Apr 1, 2024
1 parent
327c604
commit 94b5e85
Showing
3 changed files
with
3 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-04-01T17:28:24","documenter_version":"1.3.0"}} | ||
{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-04-01T17:43:21","documenter_version":"1.3.0"}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Home · Polyester.jl</title><meta name="title" content="Home · Polyester.jl"/><meta property="og:title" content="Home · Polyester.jl"/><meta property="twitter:title" content="Home · Polyester.jl"/><meta name="description" content="Documentation for Polyester.jl."/><meta property="og:description" content="Documentation for Polyester.jl."/><meta property="twitter:description" content="Documentation for Polyester.jl."/><meta property="og:url" content="https://JuliaSIMD.github.io/Polyester.jl/"/><meta property="twitter:url" content="https://JuliaSIMD.github.io/Polyester.jl/"/><link rel="canonical" href="https://JuliaSIMD.github.io/Polyester.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/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>Polyester.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 class="is-active"><a class="tocitem" href>Home</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>Home</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Home</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/JuliaSIMD/Polyester.jl/blob/master/docs/src/index.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="Polyester"><a class="docs-heading-anchor" href="#Polyester">Polyester</a><a id="Polyester-1"></a><a class="docs-heading-anchor-permalink" href="#Polyester" title="Permalink"></a></h1><ul><li><a href="#Polyester.reset_threads!-Tuple{}"><code>Polyester.reset_threads!</code></a></li><li><a href="#Polyester.@batch-Tuple{Any}"><code>Polyester.@batch</code></a></li></ul><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="Polyester.reset_threads!-Tuple{}" href="#Polyester.reset_threads!-Tuple{}"><code>Polyester.reset_threads!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">Polyester.reset_threads!()</code></pre><p>Resets the threads used by <a href="https://github.com/JuliaSIMD/Polyester.jl">Polyester.jl</a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/JuliaSIMD/Polyester.jl/blob/a0963152e26774f953b69213c3d7221e17ed079a/src/Polyester.jl#L41-L45">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="Polyester.@batch-Tuple{Any}" href="#Polyester.@batch-Tuple{Any}"><code>Polyester.@batch</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@batch for i in Iter; ...; end</code></pre><p>Evaluate the loop on multiple threads.</p><pre><code class="nohighlight hljs">@batch minbatch=N for i in Iter; ...; end</code></pre><p>Evaluate at least N iterations per thread. Will use at most <code>length(Iter) ÷ N</code> threads.</p><pre><code class="nohighlight hljs">@batch threadlocal=init() for i in Iter; ...; end</code></pre><p>Create a thread-local storage used in the loop.</p><p>The <code>init</code> function will be called at the start at each thread. <code>threadlocal</code> will refer to storage local for the thread. At the end of the loop, a <code>threadlocal</code> vector containing all the thread-local values will be available. A type can be specified with <code>threadlocal=init()::Type</code>.</p><pre><code class="nohighlight hljs">@batch reduction=((op1, var1), (op2, var2), ...) for i in Iter; ...; end</code></pre><p>Perform OpenMP-esque reduction on the <code>isbits</code> variables <code>var1</code>, <code>var2</code>, <code>...</code> using the operations <code>op1</code>, <code>op2</code>, <code>...</code> . The variables have to be initialized before the loop and cannot be a fieldname like <code>x.y</code> or <code>x[i]</code>. Supported operations are <code>+</code>, <code>*</code>, <code>min</code>, <code>max</code>, <code>&</code>, and <code>|</code>. The type does not have to be provided, since it is already inferred from the initialized variables–-<strong>caution has to be taken to ensure that the type remains consistent throughout the loop</strong>. While <code>threadlocal</code> can do the same thing, <code>reduction</code> does not incur additional allocations and is generally more efficient for its purpose. It is up to the user to ensure that there are no data dependencies between iterations, which could lead to incorrect results.</p><pre><code class="nohighlight hljs">@batch per=core for i in Iter; ...; end | ||
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Home · Polyester.jl</title><meta name="title" content="Home · Polyester.jl"/><meta property="og:title" content="Home · Polyester.jl"/><meta property="twitter:title" content="Home · Polyester.jl"/><meta name="description" content="Documentation for Polyester.jl."/><meta property="og:description" content="Documentation for Polyester.jl."/><meta property="twitter:description" content="Documentation for Polyester.jl."/><meta property="og:url" content="https://JuliaSIMD.github.io/Polyester.jl/"/><meta property="twitter:url" content="https://JuliaSIMD.github.io/Polyester.jl/"/><link rel="canonical" href="https://JuliaSIMD.github.io/Polyester.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/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>Polyester.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 class="is-active"><a class="tocitem" href>Home</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>Home</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Home</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/JuliaSIMD/Polyester.jl/blob/master/docs/src/index.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="Polyester"><a class="docs-heading-anchor" href="#Polyester">Polyester</a><a id="Polyester-1"></a><a class="docs-heading-anchor-permalink" href="#Polyester" title="Permalink"></a></h1><ul><li><a href="#Polyester.reset_threads!-Tuple{}"><code>Polyester.reset_threads!</code></a></li><li><a href="#Polyester.@batch-Tuple{Any}"><code>Polyester.@batch</code></a></li></ul><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="Polyester.reset_threads!-Tuple{}" href="#Polyester.reset_threads!-Tuple{}"><code>Polyester.reset_threads!</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">Polyester.reset_threads!()</code></pre><p>Resets the threads used by <a href="https://github.com/JuliaSIMD/Polyester.jl">Polyester.jl</a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/JuliaSIMD/Polyester.jl/blob/5d359b49df2503c9d46def1f6c6005b8ea92f4fb/src/Polyester.jl#L41-L45">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="Polyester.@batch-Tuple{Any}" href="#Polyester.@batch-Tuple{Any}"><code>Polyester.@batch</code></a> — <span class="docstring-category">Macro</span></header><section><div><pre><code class="language-julia hljs">@batch for i in Iter; ...; end</code></pre><p>Evaluate the loop on multiple threads.</p><pre><code class="nohighlight hljs">@batch minbatch=N for i in Iter; ...; end</code></pre><p>Evaluate at least N iterations per thread. Will use at most <code>length(Iter) ÷ N</code> threads.</p><pre><code class="nohighlight hljs">@batch threadlocal=init() for i in Iter; ...; end</code></pre><p>Create a thread-local storage used in the loop.</p><p>The <code>init</code> function will be called at the start at each thread. <code>threadlocal</code> will refer to storage local for the thread. At the end of the loop, a <code>threadlocal</code> vector containing all the thread-local values will be available. A type can be specified with <code>threadlocal=init()::Type</code>.</p><pre><code class="nohighlight hljs">@batch reduction=((op1, var1), (op2, var2), ...) for i in Iter; ...; end</code></pre><p>Perform OpenMP-esque reduction on the <code>isbits</code> variables <code>var1</code>, <code>var2</code>, <code>...</code> using the operations <code>op1</code>, <code>op2</code>, <code>...</code> . The variables have to be initialized before the loop and cannot be a fieldname like <code>x.y</code> or <code>x[i]</code>. Supported operations are <code>+</code>, <code>*</code>, <code>min</code>, <code>max</code>, <code>&</code>, and <code>|</code>. The type does not have to be provided, since it is already inferred from the initialized variables–-<strong>caution has to be taken to ensure that the type remains consistent throughout the loop</strong>. While <code>threadlocal</code> can do the same thing, <code>reduction</code> does not incur additional allocations and is generally more efficient for its purpose. It is up to the user to ensure that there are no data dependencies between iterations, which could lead to incorrect results.</p><pre><code class="nohighlight hljs">@batch per=core for i in Iter; ...; end | ||
@batch per=thread for i in Iter; ...; end</code></pre><p>Use at most 1 thread per physical core, or 1 thread per CPU thread, respectively. One thread per core will mean less threads competing for the cache, while (for example) if there are two hardware threads per physical core, then using each thread means that there are two independent instruction streams feeding the CPU's execution units. When one of these streams isn't enough to make the most of out of order execution, this could increase total throughput.</p><p>Which performs better will depend on the workload, so if you're not sure it may be worth benchmarking both.</p><p>LoopVectorization.jl currently only uses up to 1 thread per physical core. Because there is some overhead to switching the number of threads used, <code>per=core</code> is <code>@batch</code>'s default, so that <code>Polyester.@batch</code> and <code>LoopVectorization.@tturbo</code> work well together by default.</p><p>Threads are not pinned to a given CPU core and the total number of available threads is still governed by <code>--threads</code> or <code>JULIA_NUM_THREADS</code>.</p><p>You can pass both <code>per=(core/thread)</code> and <code>minbatch=N</code> options at the same time, e.g.</p><pre><code class="nohighlight hljs">@batch per=thread minbatch=2000 for i in Iter; ...; end | ||
@batch minbatch=5000 per=core for i in Iter; ...; end | ||
|
||
@batch stride=true for i in Iter; ...; end</code></pre><p>This may be better for load balancing if iterations close to each other take a similar amount of time, but iterations far apart take different lengths of time. Setting this also forces <code>per=thread</code>. The default is <code>stride=false</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/JuliaSIMD/Polyester.jl/blob/a0963152e26774f953b69213c3d7221e17ed079a/src/closure.jl#L525-L585">source</a></section></article></article><nav class="docs-footer"><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></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.3.0 on <span class="colophon-date" title="Monday 1 April 2024 17:28">Monday 1 April 2024</span>. Using Julia version 1.10.2.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> | ||
@batch stride=true for i in Iter; ...; end</code></pre><p>This may be better for load balancing if iterations close to each other take a similar amount of time, but iterations far apart take different lengths of time. Setting this also forces <code>per=thread</code>. The default is <code>stride=false</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/JuliaSIMD/Polyester.jl/blob/5d359b49df2503c9d46def1f6c6005b8ea92f4fb/src/closure.jl#L540-L600">source</a></section></article></article><nav class="docs-footer"><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></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.3.0 on <span class="colophon-date" title="Monday 1 April 2024 17:43">Monday 1 April 2024</span>. Using Julia version 1.10.2.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> |
Binary file not shown.