让 qsub 阻塞直到工作完成?
目前,我有一个驱动程序,它运行数千个“有效负载”程序实例,并对输出进行一些后处理。驱动程序当前使用 shell()
函数从多个线程直接调用有效负载程序。 shell() 函数在当前工作目录中执行命令,阻塞直到命令完成运行,并返回命令发送到 stdout 的数据。这在单个多核机器上运行良好。我想修改驱动程序以将 qsub 作业提交到大型计算集群,以获得更多并行性。
有没有办法让 qsub 命令将其结果输出到 stdout 而不是文件并阻塞直到作业完成?基本上,我希望它尽可能像“正常”执行命令一样,这样我就可以在对驱动程序进行尽可能少的修改的情况下并行化到集群。
编辑:我认为所有网格引擎几乎都是标准化的。如果不是而且很重要,我会使用扭矩。
Currently, I have a driver program that runs several thousand instances of a "payload" program and does some post-processing of the output. The driver currently calls the payload program directly, using a shell()
function, from multiple threads. The shell()
function executes a command in the current working directory, blocks until the command is finished running, and returns the data that was sent to stdout by the command. This works well on a single multicore machine. I want to modify the driver to submit qsub
jobs to a large compute cluster instead, for more parallelism.
Is there a way to make the qsub
command output its results to stdout instead of a file and block until the job is finished? Basically, I want it to act as much like "normal" execution of a command as possible, so that I can parallelize to the cluster with as little modification of my driver program as possible.
Edit: I thought all the grid engines were pretty much standardized. If they're not and it matters, I'm using Torque.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您没有提及您正在使用的排队系统,但 SGE 支持 qsub 的“-sync y”选项,这将导致它阻塞,直到作业完成或退出。
You don't mention what queuing system you're using, but SGE supports the '-sync y' option to qsub which will cause it to block until the job completes or exits.
在 TORQUE 中,这是使用 -x 和 -I 选项完成的。 qsub -I 指定它应该是交互式的,-x 表示仅运行指定的命令。例如:
在 myscript.sh 执行完成之前不会返回。
In TORQUE this is done using the -x and -I options. qsub -I specifies that it should be interactive and -x says run only the command specified. For example:
will not return until myscript.sh finishes execution.
在 PBS 中,您可以使用
qsub -Wblock=true
In PBS you can use
qsub -Wblock=true <command>