Live data from Hacker News

GNU Parallel, where have you been all my life?

alexplescan.com

251–260 of 277 posts

Re: GNU Parallel, where have you been all my life?

#251
post #187

Earlier quoted context omitted.

You might have misunderstood what I said. It’s not up for debate whether RMS’s opinions or intent on the GPL have affected industry practice; that’s a fact of history. His statements on the GPL are authoritative in the sense that they may have prevented the courts from examining this question.

"Authoritative" has a particular meaning. You might have intended to say "influential". You didn't. I can only reply based on what you said.

What meaning are you thinking of, exactly? I looked up the definition and it matches what I intended to say in every dictionary I checked (Merriam Webster, Oxford, Cambridge, Dictionary.com…) Some of the definitions seem more or less synonymous with “influential”, maybe you’re making some incorrect assumptions?

Re: GNU Parallel, where have you been all my life?

#252

It is sort if a shame that tools can’t figure out how to parallelize things without being herded like cattle to do so. It might be a culture thing. In .NET code I see people running things in parallel a lot within code but maybe this is less so for linux tools. Maybe functional programming style could lend to a parallel-first programming style, with heuristics to decide when it isn’t worth it.

You seem a bit behind or too invested in C# in particular. Elixir for example can run stuff in parallel with just 3-4 added lines of code added to an otherwise sequential code.

Yes of course other programming languages can do this. I was more referring to culture and idioms. The point is that tools don't support it or think about it. And that is because probably things work for most small use cases without it, and that it is a leaky abstraction - you need to change your code to support it.

Imagine a world where there were only GPUs for example - then everyone by default would be running parallel-first code, and in that imaginary world you would need to do nothing to run a series of bash commands piping into each other in parallel.

Re: GNU Parallel, where have you been all my life?

#253
post #71

Earlier quoted context omitted.

It's in current Fedora's: [david@pc ~]$ echo foo | parallel echo Academic tradition requires you to cite works you base your article on. If you use programs that use GNU Parallel to process data for an article in a scientific publication, please cite: Tange, O. (2023, July 22). GNU Parallel 20230722 ('Приго́жин'). Zenodo. https://doi.org/10.5281/zenodo.8175685 This helps funding further development; AND IT WON'T COST…

Does 'Приго́жин' relate somehow to infamous 'Евгений Пригожин'. Or am I just biased?

Yes it does. See sibling comment by 5e92cb50239222b:

> all releases are named after current political events

Re: GNU Parallel, where have you been all my life?

#254
post #181

Earlier quoted context omitted.

That’s not true. The language of Parallel’s citation notice, while confusing to some users, does not impose any legal requirements and is not part of the license. Neither the notice nor the license claim otherwise. RMS, and more importantly, Ole Tange, agree that Parallel’s notice is not legally binding, and intended to write it that way, and there is a publicly visible history of this intention and agreement.

RMS, not being a judge, is incapable of "authoritatively" or otherwise determining whether this notice is legally binding. If it is something that needs to be "confirmed" by someone "authoritatively" then you should ask a lawyer for advice. You should not ask a programmer for a "ruling". What RMS might be saying is "we won't seek to enforce it". That is completely different.

> What RMS might be saying is “we won’t seek to enforce it”. That is completely different.

If you review the thread from the top, you might find the primary question we were discussing from the start before you jumped in is whether the Parallel notice is GPL compliant. Whether Parallel’s notice is definitively and absolutely legally binding on its own and away from the GPL is a nuance you introduced, but it has been answered for all practical purposes by both Ole and RMS. It will probably never go to court or be tested by a judge, partially as a result of what Ole and RMS have said: that the notice is not a license and is not contractual.

There is no dispute about this, and because there is no dispute and because it’s not going to court, the statements by Ole and RMS are the most definitive answer we’ve got, and to date is what people are using when making and acting on decisions about Parallel usage. Both of them have said the Parallel notice complies with the GPL because the notice is not legally binding, so Ole & RMS both were saying more than GNU won’t seek to enforce Parallel’s notice. “Academic tradition” is not legally binding law, and the notice doesn’t reference any other relevant law. The notice is full of legal holes, if you insist on interpreting it as a legal contract. It was written by Ole (not a lawyer) and doesn’t define what research usage would constitute a mandatory citation, nor what happens if the user doesn’t see the notice, or if a citation is inappropriate, or if the citation is rejected by reviewers, among many other possibilities. It doesn’t take a lawyer or judge to see that the Parallel notice is not legally enforceable, and it doesn’t take a legal education to see that it’s not Ole’s intent to enforce it as a contract. He is just asking for citations, in slightly confrontational language.

It would be fair to say that a judge or court, if this issue was ever tested in court, might overrule some aspect of Ole’s or RMS’s stated intent because their language was imprecise and effectively said something different than they meant. Then again, another judge can override the first judge. There’s nothing definitive or absolute or permanent in law, regardless of whether a judges rules on it, and intent does matter in practice. Before this ever goes to court (probably never), all questions on this topic can be (and already are!) answered by non-judges, which is why it’s demonstrably not true to claim this question can only be answered in court or by a judge.

> You should not ask a programmer for a “ruling”.

RMS wasn’t acting as a programmer when he wrote the GPL, btw, nor when he opined on whether Parallel’s notice complies, so in that sense your framing is veering into the hyperbolic.

Re: GNU Parallel, where have you been all my life?

#256

Love finding a good use-case of parallel as an easy way to gain massive time savings, especially on the modern high-threaded CPUs of today. Most recently found it useful when batch-compressing large jpeg images to smaller webp files, via use with find and ImageMagick: find ./ -type f -iname '*.jpg' -size +1M -print0 | parallel -0 mogrify -format webp -quality 80 {}

Xargs is a nearly drop in replacement and probably already installed by default in most distros. You may need the -n 1 (one file per) and -P to parallelize. xargs -n 1 -P 8

Actually, parallel is a drop in for xargs as xargs has been around longer. Parallel has a few big improvements:

* Grouped output (prevents one process from writing output in the middle of another's output) * In-order output (task a output first, task b output second even though they ran in parallel) * Better handling of special characters * Remote execution

More here: https://www.gnu.org/software/parallel/parallel_alternatives....

Re: GNU Parallel, where have you been all my life?

#257
post #53

You guys know that in bash you can use `&` to pass a foreground terminal process to the background and then use `wait` to wait for all the session's background process to end, right?

It takes time to notice that if you do _several_ of these background jobs with `&`, you will only get the exit status of the last one when you do `wait`. Errors of the others will be swallowed.

Then you _have_ resort to 'wait ' with the 20 lines of bash coded need to manage all those PIDs. I have a large editor bash snippet just for that.

Re: GNU Parallel, where have you been all my life?

#258
post #7

xargs is more useful because it's posix so you can always guarantee it to be there (whereas with GNU Parallel you probably have to reach for a package manager to install it first). The ergonomics are worse though, as usual.

Last time I checked (which was a few years ago, admittedly), some popular ystem's xargs were too old to support parallelism -- Mac in particular.

This is not the case I think, xargs on mac supports parallel, and does so back to 10.9 or older

Re: GNU Parallel, where have you been all my life?

#259

It's a nice tool, but it also shows the shortcomings of shell commands. In a proper programming language, we'd have something like parallel [1..5], i => { sleep random()*10+5; possibly_flaky i } // [{"Seq": 4, "Host": ":", "Starttime": 1692491267... And `parallel` would only have to worry about parallelization. Instead, the shell environment forces programs to invent their own parameter separator (:::), a templating…

Your find exec problem can be trivially solved with either - exec /bin/bash -c "script" or you can spend a little extra time figuring out how to properly structure your scripts in such a way where the incocations just flow with little more than an invocation +getopts

If you feel like the answer is rewriting the shell, the answer is practically never rewriting the shell. It's learning to use it.

Re: GNU Parallel, where have you been all my life?

#260

Since nobody asked, I'm reiterating my position that computers to effectively utilize parallel functionality simply aren't available today. I've always wanted a computer with at least 256 cores and local content-addressable memories beside each core to send data where it's needed. By Moore's Law, we could have had MIPS machines with 1000 cores around 2010, and 100,000 to 1 million cores today, for under $1000. Contra…

Sorry but we do have computers with 256 cores. I used to have this excuse back when processors only had 4 cores. When you consider that processors lower their turbo boost frequency as you use more cores and there is overhead from synchronization, your 4 core processor may only give you a 2x performance benefit at the expense of your code becoming difficult to reason about (depending on the problem at hand). Nowadays 8 core processors are quite cheap, below 200€. At 4x performance boost and easily 12x more if you are willing to spend the money, it is definitively worth it. The caveat of course is that there aren't actually that many programs that need the full power of your processor. The most common exception is a video game that was developed for a limited number of players or even single player but then the multiplayer version of the game becomes extremely popular and you get servers with 60 or even a hundred players, way beyond what the developers planned to support. Supporting multiple cores was not a priority and then very suddenly it becomes the biggest bottleneck.

The real problem we are facing is that our programming models aren't parallel by default.

>By Moore's Law, we could have had MIPS machines with 1000 cores around 2010, and 100,000 to 1 million cores today, for under $1000.

https://corescore.store/

You can have 10000 RISC-V cores on an FPGA but nobody cares. Why? Because even a bit serial processor (that means it processes one bit per clock cycle, or 32 clock cycles for a 32 bit addition) runs into memory bandwidth limitations very quickly if you have enough of them. Main memory is very slow compared to registers and caches. The only way to utilize this many cores is by having a workload that is entirely latency bound. Your memory access pattern is perfectly unpredictable. The moment you add caching, the number of cores you can have shrinks dramatically and companies like AMD are not slimming down their CPUs, they are adding more and more cache. Their highest end processors have almost a gigabyte of cache.

Post reply on HN