[英]Change value of a variable in makefile
So, im trying to change the value of threads in openMP using OMP_NUM_THREADS .因此,我尝试使用OMP_NUM_THREADS更改 openMP 中线程的值。 When i type export OMP_NUM_THREADS=value in prompt it works fine, it changes the number of threads, but when i try to do this in a makefile it doesn't work.
当我在提示中键入export OMP_NUM_THREADS=value 时,它工作正常,它会更改线程数,但是当我尝试在 makefile 中执行此操作时,它不起作用。 My makefile:
我的生成文件:
run:
export OMP_NUM_THREADS=4
./cowichan_openmp vecdiff >> out
Each line of the recipe is run in a separate shell.配方的每一行都在单独的 shell 中运行。 So in this case, you're running one shell, setting
OMP_NUM_THREADS
, then exiting that shell and running another one (without that variable).因此,在这种情况下,您正在运行一个 shell,设置
OMP_NUM_THREADS
,然后退出该 shell 并运行另一个 shell(没有该变量)。
You can just put the variable definition and the call to cowichan_openmp
on the same line:您可以将变量定义和对
cowichan_openmp
的调用放在同一行:
run:
OMP_NUM_THREADS=4 ./cowichan_openmp vecdiff >> out
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.