[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to refrain only use certain number of processors

lina <lina.lastname@gmail.com> writes:

>Yes. the ultimate goal is:

>for i in {0..108}
>cat A_$i.txt B_$i.txt C_$i.txt -o ABC_$i.txt  (output as ABC_$i.txt)

>but here I wish to use only 8 processors at most, total is 16.
>the administrator of the cluster asked me not to use whole, cause
>someone else needs SMP server.

seq 0 108 | xargs -I@ -P8 cat A_@.txt B_@.txt C_@.txt -o ABC_@.txt

Most people use the character sequence {} where I have used @. I find @
to be simpler to type, so I use that instead.

I don't think you need -n1 in this case as it is somewhat implied by the
use of -I.

Reply to: