achuthpnr
October 28th, 2014, 05:38 PM
I want to run a program N times, with an incremented variable as input each time. The for loop in bash script seems a good option here. So I have like
#!/bin/bash
for i in {1..10}
do
./my_prog $i
done
Imagine one run takes about 10minutes to finish. The above code obviously runs on one processor at a time until it finishes and then starts the next one.
I have multiple processors and I want to use them all together to save time
Is there any way other than doing n separate scripts of
for i in {1..10..1}.... to have the same effect in a single script such that all cores are used together?
just curious...
#!/bin/bash
for i in {1..10}
do
./my_prog $i
done
Imagine one run takes about 10minutes to finish. The above code obviously runs on one processor at a time until it finishes and then starts the next one.
I have multiple processors and I want to use them all together to save time
Is there any way other than doing n separate scripts of
for i in {1..10..1}.... to have the same effect in a single script such that all cores are used together?
just curious...