在makefile中同时运行一些操作 [英] Run some actions at the same time in a makefile
问题描述
我有以下makefile
.
我希望运行step0
,然后我希望所有b*.R
脚本同时在step1
中运行 . step1
完成后,我要运行final
.
I would like step0
to run then I would like all of the b*.R
scripts to run at the same time in step1
. When step1
is complete I would like final
to run.
当我运行make
或make -j 8
时,似乎所有b*.R
文件仍按顺序运行.此makefile
是否已正确设置为同时运行所有b*.R
文件?如果没有,我需要更改什么.
When I run make
or make -j 8
it seems like all of the b*.R
files still run sequentially. Is this makefile
set up correctly to run all of the b*.R
files at the same time? If not what do I need to change.
final : step1
Rscript c.R
step1 : step0
Rscript b1.R
Rscript b2.R
Rscript b3.R
Rscript b4.R
Rscript b5.R
Rscript b6.R
step0 :
Rscript a.R
推荐答案
当我运行make或make -j 8时,似乎所有b * .R文件仍按顺序运行.
When I run make or make -j 8 it seems like all of the b*.R files still run sequentially.
-jN
允许并行执行不同配方,而不是构成配方的单个命令.
-jN
allows parallel execution of different recipes, not the individual commands constituting a recipe.
因此,makefile应该像这样重组:
So the makefile should be restructured like this:
.PHONY: final b1 b2 b3 b4 b5 b6 step0
final: b1 b2 b3 b4 b5 b6
b1 b2 b3 b4 b5 b6: step0
b1: ;Rscript b1.R
b2: ;Rscript b2.R
b3: ;Rscript b3.R
b4: ;Rscript b4.R
b5: ;Rscript b5.R
b6: ;Rscript b6.R
step0: ;Rscript a.R
这篇关于在makefile中同时运行一些操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!