I use the script suggested in Run parallel multiple commands at once in the same terminal in order to run some applications in parallel. It works fine, however, I want to stick each application to a single core and my question is how to make sure that each of those applications runs on a distinct core? Where to insert "taskset -c"s ? Before each application's run command inside the script and/or before the script's command itself when I run it from the terminal??
我使用在同一终端同时运行多个并行命令时建议的脚本,以便并行运行一些应用程序。它工作得很好,但是,我想把每个应用程序都固定在一个核心上,我的问题是如何确保每个应用程序在一个不同的核心上运行?在哪里插入“任务集-c”?在每个应用程序的运行命令在脚本和/或脚本命令本身之前,当我从终端运行它时??
1 个解决方案
#1
2
Newer versions of GNU Parallel supports progressing ctrl-c, and {%} which will give the jobslot number:
GNU并行的新版本支持按ctrl-c和{%}的进程,这将给出jobslot数:
cat commands | parallel taskset -c {%} {}
Linux is pretty good at scheduling tasks, so only use taskset
after you have timed that it really does benefit performance.
Linux非常擅长调度任务,所以只有在您计时之后才使用taskset,这样才能真正提高性能。
#1
2
Newer versions of GNU Parallel supports progressing ctrl-c, and {%} which will give the jobslot number:
GNU并行的新版本支持按ctrl-c和{%}的进程,这将给出jobslot数:
cat commands | parallel taskset -c {%} {}
Linux is pretty good at scheduling tasks, so only use taskset
after you have timed that it really does benefit performance.
Linux非常擅长调度任务,所以只有在您计时之后才使用taskset,这样才能真正提高性能。