Scientific computing and parallel computing C++23/C++26
forkit
forkit at gmail.com
Thu Jan 13 05:36:54 UTC 2022
On Thursday, 13 January 2022 at 01:19:07 UTC, H. S. Teoh wrote:
>
> Recently, I wanted to use POVRay to render frames for a short
> video clip. It was taking far too long because it was running
> on a single core at a time, so I wrote this:
>
> import std.parallellism, std.process;
> foreach (frame; frames.parallel) {
> execute([ "povray" ] ~ povrayOpts ~ [
> "+I", frame.infile,
> "+O", frame.outfile ]);
> }
>
> Instant 8x render speedup. (Well, almost 8x... there's of
> course a little bit of overhead. But you get the point.)
>
I'd like to see D simplify this even further:
@parallel foreach (frame; frames) { .. }
that's it. just annotate it. that's all I have to do. Let the
language tools do the rest.
More information about the Digitalmars-d
mailing list