Is it possible to call gnu parallel from within multiple runs of a script that are in-turn spawned by gnu parallel?
I have a python script that runs for 100s of sequential iterations, and somewhere within each iteration, 4 values are being computed in parallel (using gnu parallel). Now I want to spawn multiple such scripts at the same time, again, using gnu parallel. Is this possible? Will gnu parallel take care of good utilization of available cores?
For example, if in the inner loop, out of 4 values, 2 have been completed and 2 are running, so that a single script cannot proceed to the next iteration until all 4 values are computed. Will the two free cores be used for computing results for a different run of the script automatically? How can I specify the total number of cores available? In the inner call to parallel or outer call?
This questions shows it is possible to nest calls to parallel, but I'm not sure if this changes when I'm calling the nested parallel from inside a script.
PS: Thrashing is not a concern, I can use a LOT of cores from a large cluster.
PS2: gnu-parallel is an AWESOME tool... thanks! : )
OpenMP parallel regions can be nested inside each other. If nested parallelism is disabled, then the new team created by a thread encountering a parallel construct inside a parallel region consists only of the encountering thread. If nested parallelism is enabled, then the new team may consist of more than one thread.
The OpenMP scheduler uses this added parallelism to improve performance when possible.
Yes. GNU Parallel is designed (and tested heavily) to be able to be called from GNU Parallel - either directly or through a script.
If called directly you are likely to need to change -I
. What does the second {} mean here (does it refer to the first or the second parallel?):
seq 10 | parallel 'seq {} | parallel echo {}'
Here it is very clear:
seq 10 | parallel 'seq {} | parallel -I // echo //'
seq 10 | parallel 'seq {} | parallel -I // echo {} //'
PS Good to hear you find GNU Parallel awesome. If you like GNU Parallel:
If you use GNU Parallel for research:
If GNU Parallel saves you money:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With