-
Notifications
You must be signed in to change notification settings - Fork 0
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
Archive Bot
committed
Sep 27, 2024
0 parents
commit 08b7d62
Showing
1,451 changed files
with
128,648 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
version: 2 | ||
|
||
updates: | ||
# Enable updates to the dependencies of our workflows | ||
- package-ecosystem: 'github-actions' | ||
directory: '/' | ||
schedule: | ||
interval: daily |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Deploy Archive | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: 30 4 * * * | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
name: Publish zulip-archive on GH Pages | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: zulip/zulip-archive@5ff607209cbd3a7ff74cbca84656d01bfc8b5929 | ||
with: | ||
zuliprc: ${{ secrets.ZULIPRC }} | ||
# archive_branch: main | ||
|
||
github_token: ${{ secrets.DEPLOY_PAT }} | ||
delete_history: true |
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<html> | ||
<head><meta charset="utf-8"><title>Zulip Chat Archive</title></head> | ||
<hr> | ||
|
||
<h2>Streams:</h2> | ||
|
||
<ul> | ||
<li> <a href="stream/274208-helpdesk-.28published.29/index.html">helpdesk (published)</a> (720 topics) </li> | ||
</ul> | ||
|
||
<hr><p>Last updated: Sep 27 2024 at 04:40 UTC</p> | ||
</html> |
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> | ||
<!-- Powered by https://github.com/pigs-will-fly/py-xml-sitemap-writer --> | ||
<!-- 539 urls --> | ||
<sitemap><loc>https://juliacommunity.github.io/zulip-archive/sitemap-001-pages.xml.gz</loc></sitemap> | ||
</sitemapindex> |
Large diffs are not rendered by default.
Oops, something went wrong.
103 changes: 103 additions & 0 deletions
103
stream/274208-helpdesk-.28published.29/topic/.22Broadcast.20foreach.22.3F.html
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 |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<html> | ||
<head><meta charset="utf-8"><title>"Broadcast foreach"? · helpdesk (published) · Zulip Chat Archive</title></head> | ||
<h2>Stream: <a href="https://juliacommunity.github.io/zulip-archive/stream/274208-helpdesk-.28published.29/index.html">helpdesk (published)</a></h2> | ||
<h3>Topic: <a href="https://juliacommunity.github.io/zulip-archive/stream/274208-helpdesk-.28published.29/topic/.22Broadcast.20foreach.22.3F.html">"Broadcast foreach"?</a></h3> | ||
|
||
<hr> | ||
|
||
<base href="https://julialang.zulipchat.com"> | ||
|
||
<head><link href="https://juliacommunity.github.io/zulip-archive/style.css" rel="stylesheet"></head> | ||
|
||
<a name="262235042"></a> | ||
<h4><a href="https://julialang.zulipchat.com#narrow/stream/274208-helpdesk%20%28published%29/topic/%22Broadcast%20foreach%22%3F/near/262235042" class="zl"><img src="https://juliacommunity.github.io/zulip-archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Philipp Gabler <a href="https://juliacommunity.github.io/zulip-archive/stream/274208-helpdesk-.28published.29/topic/.22Broadcast.20foreach.22.3F.html#262235042">(Nov 21 2021 at 11:06)</a>:</h4> | ||
<p>Is there an established pattern to "broadcast" a function, but without allocation of output? Just for the sake of side-effects. I.e., <code>map</code> is to <code>broadcast</code> as <code>foreach</code> is to what?</p> | ||
<p>I came up with this:</p> | ||
<div class="codehilite" data-code-language="Julia"><pre><span></span><code><span class="n">julia</span><span class="o">></span> <span class="k">function</span> <span class="n">broadcast_foreach</span><span class="p">(</span><span class="n">op</span><span class="p">,</span> <span class="n">args</span><span class="o">...</span><span class="p">)</span> | ||
<span class="n">bc</span> <span class="o">=</span> <span class="n">Base</span><span class="o">.</span><span class="n">broadcasted</span><span class="p">(</span><span class="n">op</span><span class="p">,</span> <span class="n">args</span><span class="o">...</span><span class="p">)</span> | ||
<span class="n">foreach</span><span class="p">(</span><span class="n">x</span> <span class="o">-></span> <span class="nb">nothing</span><span class="p">,</span> <span class="n">bc</span><span class="p">)</span> | ||
<span class="k">return</span> <span class="nb">nothing</span> | ||
<span class="k">end</span> | ||
<span class="n">broadcast_foreach</span> <span class="p">(</span><span class="n">generic</span> <span class="k">function</span> <span class="n">with</span> <span class="mi">1</span> <span class="n">method</span><span class="p">)</span> | ||
|
||
<span class="n">julia</span><span class="o">></span> <span class="n">xs</span> <span class="o">=</span> <span class="p">[]</span> | ||
<span class="kt">Any</span><span class="p">[]</span> | ||
|
||
<span class="n">julia</span><span class="o">></span> <span class="n">broadcast_foreach</span><span class="p">((</span><span class="n">xs</span><span class="p">,</span> <span class="n">vs</span><span class="o">...</span><span class="p">)</span> <span class="o">-></span> <span class="n">push!</span><span class="p">(</span><span class="n">xs</span><span class="p">,</span> <span class="n">vs</span><span class="p">),</span> <span class="kt">Ref</span><span class="p">(</span><span class="n">xs</span><span class="p">),</span> <span class="p">[</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">],</span> <span class="p">[</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">])</span> | ||
|
||
<span class="n">julia</span><span class="o">></span> <span class="n">xs</span> | ||
<span class="mi">2</span><span class="o">-</span><span class="n">element</span> <span class="kt">Vector</span><span class="p">{</span><span class="kt">Any</span><span class="p">}</span><span class="o">:</span> | ||
<span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> | ||
<span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span> | ||
|
||
<span class="n">julia</span><span class="o">></span> <span class="n">xs</span> <span class="o">=</span> <span class="p">[]</span> | ||
<span class="kt">Any</span><span class="p">[]</span> | ||
|
||
<span class="n">julia</span><span class="o">></span> <span class="n">broadcast_foreach</span><span class="p">((</span><span class="n">xs</span><span class="p">,</span> <span class="n">vs</span><span class="o">...</span><span class="p">)</span> <span class="o">-></span> <span class="n">push!</span><span class="p">(</span><span class="n">xs</span><span class="p">,</span> <span class="n">vs</span><span class="p">),</span> <span class="kt">Ref</span><span class="p">(</span><span class="n">xs</span><span class="p">),</span> <span class="p">[</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">],</span> <span class="mi">1</span><span class="p">)</span> | ||
|
||
<span class="n">julia</span><span class="o">></span> <span class="n">xs</span> | ||
<span class="mi">2</span><span class="o">-</span><span class="n">element</span> <span class="kt">Vector</span><span class="p">{</span><span class="kt">Any</span><span class="p">}</span><span class="o">:</span> | ||
<span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> | ||
<span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> | ||
</code></pre></div> | ||
<p>but not knowing as much about broadcasting machinery as I'd like to, there might be something existing I am overlooking.</p> | ||
|
||
|
||
|
||
<a name="262254718"></a> | ||
<h4><a href="https://julialang.zulipchat.com#narrow/stream/274208-helpdesk%20%28published%29/topic/%22Broadcast%20foreach%22%3F/near/262254718" class="zl"><img src="https://juliacommunity.github.io/zulip-archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mason Protter <a href="https://juliacommunity.github.io/zulip-archive/stream/274208-helpdesk-.28published.29/topic/.22Broadcast.20foreach.22.3F.html#262254718">(Nov 21 2021 at 18:57)</a>:</h4> | ||
<p>One approach you could take is making a struct <code>Null</code> such that writing data to it just throws away the data. Then you could do something like<br> | ||
<code>Null() .= f.(x)</code> and broadcast Fusion should take care of everything.</p> | ||
|
||
|
||
|
||
<a name="262319796"></a> | ||
<h4><a href="https://julialang.zulipchat.com#narrow/stream/274208-helpdesk%20%28published%29/topic/%22Broadcast%20foreach%22%3F/near/262319796" class="zl"><img src="https://juliacommunity.github.io/zulip-archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Philipp Gabler <a href="https://juliacommunity.github.io/zulip-archive/stream/274208-helpdesk-.28published.29/topic/.22Broadcast.20foreach.22.3F.html#262319796">(Nov 22 2021 at 13:44)</a>:</h4> | ||
<p>I was thinking about that, too, but didn't know how to proceed. Some issues with broadcast style (I guess?):</p> | ||
<div class="codehilite" data-code-language="Julia"><pre><span></span><code><span class="n">julia</span><span class="o">></span> <span class="k">struct</span> <span class="kt">Null</span> <span class="k">end</span> | ||
|
||
<span class="n">julia</span><span class="o">></span> <span class="n">Base</span><span class="o">.</span><span class="n">copyto!</span><span class="p">(</span><span class="o">::</span><span class="kt">Null</span><span class="p">,</span> <span class="n">bc</span><span class="o">::</span><span class="kt">Broadcast</span><span class="o">.</span><span class="kt">Broadcasted</span><span class="p">{</span><span class="kt">Nothing</span><span class="p">})</span> <span class="o">=</span> <span class="p">(</span><span class="n">foreach</span><span class="p">(</span><span class="n">_</span> <span class="o">-></span> <span class="nb">nothing</span><span class="p">,</span> <span class="n">bc</span><span class="p">);</span> <span class="n">Null</span><span class="p">())</span> | ||
|
||
<span class="n">julia</span><span class="o">></span> <span class="n">f</span><span class="p">(</span><span class="n">xs</span><span class="p">,</span> <span class="n">vs</span><span class="o">...</span><span class="p">)</span> <span class="o">=</span> <span class="n">push!</span><span class="p">(</span><span class="n">xs</span><span class="p">,</span> <span class="n">vs</span><span class="p">)</span> | ||
<span class="n">f</span> <span class="p">(</span><span class="n">generic</span> <span class="k">function</span> <span class="n">with</span> <span class="mi">1</span> <span class="n">method</span><span class="p">)</span> | ||
|
||
<span class="n">julia</span><span class="o">></span> <span class="n">xs</span> <span class="o">=</span> <span class="p">[]</span> | ||
<span class="kt">Any</span><span class="p">[]</span> | ||
|
||
<span class="n">julia</span><span class="o">></span> <span class="n">Null</span><span class="p">()</span> <span class="o">.=</span> <span class="n">f</span><span class="o">.</span><span class="p">(</span><span class="kt">Ref</span><span class="p">(</span><span class="n">xs</span><span class="p">),</span> <span class="p">[</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">],</span> <span class="mi">1</span><span class="p">)</span> | ||
<span class="n">ERROR</span><span class="o">:</span> <span class="kt">MethodError</span><span class="o">:</span> <span class="n">no</span> <span class="n">method</span> <span class="n">matching</span> <span class="n">ndims</span><span class="p">(</span><span class="o">::</span><span class="kt">Type</span><span class="p">{</span><span class="kt">Null</span><span class="p">})</span> | ||
<span class="o">...</span> | ||
</code></pre></div> | ||
|
||
|
||
|
||
<a name="262359734"></a> | ||
<h4><a href="https://julialang.zulipchat.com#narrow/stream/274208-helpdesk%20%28published%29/topic/%22Broadcast%20foreach%22%3F/near/262359734" class="zl"><img src="https://juliacommunity.github.io/zulip-archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Michael Abbott <a href="https://juliacommunity.github.io/zulip-archive/stream/274208-helpdesk-.28published.29/topic/.22Broadcast.20foreach.22.3F.html#262359734">(Nov 22 2021 at 18:35)</a>:</h4> | ||
<p>I think you want to catch it earlier:</p> | ||
<div class="codehilite" data-code-language="Julia"><pre><span></span><code><span class="n">Broadcast</span><span class="o">.</span><span class="n">materialize!</span><span class="p">(</span><span class="n">dest</span><span class="o">::</span><span class="kt">Null</span><span class="p">,</span> <span class="n">bc</span><span class="o">::</span><span class="kt">Base</span><span class="o">.</span><span class="n">Broadcast</span><span class="o">.</span><span class="n">Broadcasted</span><span class="p">)</span> <span class="o">=</span> <span class="p">(</span><span class="n">foreach</span><span class="p">(</span><span class="n">_</span> <span class="o">-></span> <span class="nb">nothing</span><span class="p">,</span> <span class="n">bc</span><span class="p">);</span> <span class="n">Null</span><span class="p">())</span> | ||
</code></pre></div> | ||
|
||
|
||
|
||
<a name="262360772"></a> | ||
<h4><a href="https://julialang.zulipchat.com#narrow/stream/274208-helpdesk%20%28published%29/topic/%22Broadcast%20foreach%22%3F/near/262360772" class="zl"><img src="https://juliacommunity.github.io/zulip-archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Michael Abbott <a href="https://juliacommunity.github.io/zulip-archive/stream/274208-helpdesk-.28published.29/topic/.22Broadcast.20foreach.22.3F.html#262360772">(Nov 22 2021 at 18:44)</a>:</h4> | ||
<p>It is not quite as efficient as ordinary broadcasting. IIRC there were some such issues with <code>sum(::Broadcasted)</code>:</p> | ||
<div class="codehilite" data-code-language="Julia"><pre><span></span><code><span class="n">julia</span><span class="o">></span> <span class="n">x</span> <span class="o">=</span> <span class="n">rand</span><span class="p">(</span><span class="mi">100</span><span class="p">,</span> <span class="mi">100</span><span class="p">);</span> <span class="n">y</span> <span class="o">=</span> <span class="n">rand</span><span class="p">(</span><span class="mi">100</span><span class="p">,</span> <span class="mi">100</span><span class="p">);</span> | ||
|
||
<span class="n">julia</span><span class="o">></span> <span class="nd">@btime</span> <span class="n">sin</span><span class="o">.</span><span class="p">(</span><span class="o">$</span><span class="n">x</span> <span class="o">./</span> <span class="o">$</span><span class="n">y</span> <span class="o">.+</span> <span class="mi">1</span><span class="p">);</span> | ||
<span class="n">min</span> <span class="mf">77.958</span> <span class="n">μs</span><span class="p">,</span> <span class="n">mean</span> <span class="mf">86.330</span> <span class="n">μs</span> <span class="p">(</span><span class="mi">2</span> <span class="n">allocations</span><span class="p">,</span> <span class="mf">78.17</span> <span class="n">KiB</span><span class="o">.</span> <span class="n">GC</span> <span class="n">mean</span> <span class="mf">2.82</span><span class="o">%</span><span class="p">)</span> | ||
|
||
<span class="n">julia</span><span class="o">></span> <span class="nd">@btime</span> <span class="nb">nothing</span> <span class="o">.=</span> <span class="n">sin</span><span class="o">.</span><span class="p">(</span><span class="o">$</span><span class="n">x</span> <span class="o">./</span> <span class="o">$</span><span class="n">y</span> <span class="o">.+</span> <span class="mi">1</span><span class="p">);</span> | ||
<span class="n">min</span> <span class="mf">150.667</span> <span class="n">μs</span><span class="p">,</span> <span class="n">mean</span> <span class="mf">154.272</span> <span class="n">μs</span> <span class="p">(</span><span class="mi">0</span> <span class="n">allocations</span><span class="p">)</span> | ||
</code></pre></div> | ||
|
||
|
||
|
||
<a name="262499866"></a> | ||
<h4><a href="https://julialang.zulipchat.com#narrow/stream/274208-helpdesk%20%28published%29/topic/%22Broadcast%20foreach%22%3F/near/262499866" class="zl"><img src="https://juliacommunity.github.io/zulip-archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mason Protter <a href="https://juliacommunity.github.io/zulip-archive/stream/274208-helpdesk-.28published.29/topic/.22Broadcast.20foreach.22.3F.html#262499866">(Nov 23 2021 at 19:08)</a>:</h4> | ||
<p>Hm. I would have thought that <code>Broadcast.instantiate(bc)</code> would have fixed it but it didn't</p> | ||
|
||
|
||
|
||
<hr><p>Last updated: Sep 27 2024 at 04:40 UTC</p> | ||
</html> |
Oops, something went wrong.