使用多个处理器来运行shell脚本

时间:2017-10-31 12:13:15

标签: shell parallel-processing gnu-parallel

壳牌:

for a in `ls -1 *.pdb`; do ./fud --pdb=$a --command=run --state=-CRYSTAL --element=ion ; done 

cat //home/*.fxout  >> results.out

fgrep -v 1 results.out > new.out

2 个答案:

答案 0 :(得分:1)

考虑使用 GNU Parallel ,如下所示:

parallel ./fud —pdb={} —command=run —state=-CRYSTAL —element=ion ::: *.pdb

有一个很棒的教程here

答案 1 :(得分:0)

尝试xargs(-P指定要运行的并行进程数):

ls -1 *.pdb | xargs -I {} -P8 ./fud --pdb={} --rest-of-switches > result.out