R编程-使用PBS在多节点Linux集群上提交作业 [英] R programming - submitting jobs on a multiple node linux cluster using PBS

查看:824
本文介绍了R编程-使用PBS在多节点Linux集群上提交作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在多节点Linux群集上运行R.我想使用脚本或批处理模式在R上运行分析,而无需使用MPI或snow等并行计算软件.

I am running R on a multiple node Linux cluster. I would like to run my analysis on R using scripts or batch mode without using parallel computing software such as MPI or snow.

我知道这可以通过划分输入数据以使每个节点运行数据的不同部分来完成.

I know this can be done by dividing the input data such that each node runs different parts of the data.

我的问题是我该怎么做?我不确定应该如何编写脚本代码.一个例子将非常有帮助!

My question is how do I go about this exactly? I am not sure how I should code my scripts. An example would be very helpful!

到目前为止,我一直在使用PBS运行脚本,但是由于R是单线程程序,因此它似乎只能在一个节点上运行.因此,我需要弄清楚如何调整我的代码,以便它可以将劳力分配给所有节点.

I have been running my scripts so far using PBS but it only seems to run on one node as R is a single thread program. Hence, I need to figure out how to adjust my code so it distributes labor to all of the nodes.

这是我到目前为止一直在做的事情:

Here is what I have been doing so far:

1)命令行:

> qsub myjobs.pbs

2)myjobs.pbs:

2) myjobs.pbs:

> #!/bin/sh
> #PBS -l nodes=6:ppn=2
> #PBS -l walltime=00:05:00
> #PBS -l arch=x86_64
> 
> pbsdsh -v $PBS_O_WORKDIR/myscript.sh

3)myscript.sh:

3) myscript.sh:

#!/bin/sh
cd $PBS_O_WORKDIR
R CMD BATCH --no-save my_script.R

4)my_script.R:

4) my_script.R:

> library(survival)
> ...
> write.table(test,"TESTER.csv",
> sep=",", row.names=F, quote=F)

任何建议将不胜感激!谢谢!

Any suggestions will be appreciated! Thank you!

-CC

推荐答案

这是一个PBS问题;我通常制作一个R脚本(在#!之后带有Rscript路径),并使其收集一个参数(使用commandArgs函数),该参数控制此当前实例应执行的一部分工作".因为我经常使用multicore,所以我通常只需要使用3-4个节点,所以我只提交了几个调用此R脚本的作业,每个作业都有一个可能的控制参数值.
另一方面,您应该使用pbsdsh来完成工作...然后PBS_TASKNUM的值可以用作控制参数.

This is rather a PBS question; I usually make an R script (with Rscript path after #!) and make it gather a parameter (using commandArgs function) that controls which "part of the job" this current instance should make. Because I use multicore a lot I usually have to use only 3-4 nodes, so I just submit few jobs calling this R script with each of a possible control argument values.
On the other hand your use of pbsdsh should do its job... Then the value of PBS_TASKNUM can be used as a control parameter.

这篇关于R编程-使用PBS在多节点Linux集群上提交作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆