[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to make multiple 'parallel' runs exclusive?
From: |
Ole Tange |
Subject: |
Re: How to make multiple 'parallel' runs exclusive? |
Date: |
Sun, 1 May 2016 18:50:41 +0200 |
On Sun, May 1, 2016 at 12:59 PM, Jianghui Geng <jhgeng1982@gmail.com> wrote:
> Sometime we submit multiple ‘parallel’ runs, such as
>
> parallel A ::: a b
> parallel B ::: c d
>
> We hope B can wait if A have already occupied all CPUs. However, it’s not the
> case. It seems that B does not know the presence of A, and will thus
> ‘compete’ for the CPU resources with A. How can I resolve this problem? I
> just want B to wait until A has released CPUs.
sem --id /tmp/waituntildone parallel A ::: a b &
sem --id /tmp/waituntildone parallel B ::: c d
This will run only one parallel at a time. sem is an alias for
parallel --semaphore.
Another trick is to nice B:
parallel A ::: a b &
parallel --nice 19 B ::: c d
I usually do that of there are only two competing parallels.
/Ole