我可以访问使用“扭矩”(我认为)的集群,我们使用PBS脚本来提交作业。 我需要运行超过200个我在java中开发的应用程序的实例。 该应用程序作为P2Pnetworking的对等体,这意味着这些实例通过套接字相互通信。
我能够在集群上的单个节点上运行100个实例进行testing,但是在单个节点上运行200个实例时无法运行,而且我不能要求更多资源(mem,cores等)。 )
我的问题是:我应该这样做吗? 用一个串口脚本,我将所有的实例一个接一个地发送到后台,然后等待它们?
这可以通过一个并行脚本完成吗?在这个脚本中,我可以请求2个节点,并在每个节点中实例化我的应用程序的100个实例? 在这种情况下,我还有其他一些问题:我该怎么做? 有没有保证两个职位同时运行? 所有200个实例必须同时运行。
这是我目前正在使用的脚本的一部分…
#PBS -l nodes=1:ppn=4 #PBS -l pmem=6GB #PBS -l walltime=00:20:00 IP=`/sbin/ifconfig eth0 | grep 'inet ' | awk '{print $2}' | sed 's/addr://'` PORT_PEER=3000 java -jar $JAR $JAR_PARAMS -ip=$IP -port=$PORT_PEER & # first peer, others connect to this one.. for i in {1..99} do PORT_PEER=`expr $PORT_PEER + 2`; java -jar $JAR $JAR_PARAMS -ip=$IP -port=$PORT_PEER -bootstrap=$IP:3000 & sleep 1s done wait # wait here until all instances terminates
如果您将脚本更改为如下所示:
#PBS -l nodes=2:ppn=4
你会得到2个节点,每个节点至less有4个可用的核心。 你可能已经知道了。
您的TORQUEpipe理员可能也启用了pbsdsh 。 通过适当的参数,您可以使用该参数在作业保留的每个节点上运行命令。 如果没有pbsdsh ,如果他们至less在一个队列中的系统之间启用rsh访问,则可以通过环境variables$PBS_NODEFILE和rsh给出的文件内容parsing每个不是主要主机的文件,然后运行shell脚本每。
所以,未经testing,但是像这样:
# main-script.sh (runs on primary node, spawns off java processes on all # nodes in job) #PBS -l nodes=2:ppn=4 MASTER_IP=`/sbin/ifconfig eth0 | grep 'inet ' | awk '{print $2}' \ | sed 's/addr://'` PORT_PEER=3000 # first peer, others connect to this one.. java -jar ${JAR} ${JAR_PARAMS} -ip=${MASTER_IP} -port=${PORT_PEER} & # run 2 copies of smaller-script.sh on unique hostnames in this job pbsdsh -u -c 2 /path/to/smaller-script.sh ${MASTER_IP}
和
# smaller-script.sh (runs on each node in job) MASTER_IP=$1 PORT_PEER=3000 IP=`/sbin/ifconfig eth0 | grep 'inet ' | awk '{print $2}' | sed 's/addr://'` # other peers, connecting back to first peer from other script for i in {1..99} do PORT_PEER=`expr $PORT_PEER + 2`; java -jar ${JAR} ${JAR_PARAMS} -ip=${IP} -port=${PORT_PEER} \ -bootstrap=${MASTER_IP}:3000 & sleep 1s done wait # wait here until all instances terminates
应该让你开始。