使用屏幕和Bash多 [英] Multiprocessing with Screen and Bash

查看:132
本文介绍了使用屏幕和Bash多的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在不同的节点在学校使用SSH运行python脚本。每个节点有8个内核。我使用GNU屏幕,可以从一个单一的过程中脱落。

Running a python script on different nodes at school using SSH. Each node has 8 cores. I use GNU Screen to be able to detach from a single process.

是更可取的:


  1. 运行屏幕的几个不同的会话。

  2. 运行一个屏幕过程,并使用&功放;在bash终端

  1. Run several different sessions of screen.
  2. Run a single screen process and use & in a bash terminal.

他们是否相同呢?

我不知道如果我的实验是很差codeD,并采取过多的时间量(很可能),或者我选择使用1是跌大大减慢的过程。谢谢!

I am not sure if my experiments are poorly coded and taking an inordinate amount of time (very possible) OR my choice to use 1. is slowing the process down considerably. Thank you!

推荐答案

通过庆典我想像你正在做这样的事情(假设 /家庭正在网络安装):

With bash I imagine you're doing something like this (assuming /home is under network mount):

#!/bin/bash    

for i in {1..$NUM_NODES}
do
    ssh node$i 'python /home/ryan/my_script.py' &
done

启动从后面一个屏幕这个剧本将正常工作。启动屏幕的几次会议没有提供任何的性能提升,但在启动多个屏幕的额外复杂性增加了。

Launching this script from behind a single screen will work fine. Starting up several sessions of screen provides no performance gains but adds in the extra complication of starting multiple screens.

请记住,有很多更好的方法来跨群集分布负载(例如,如果有人在使用了所有node7的你想要的方式来检测和其他地方发送作业)。我使用过的大多数集群具有扭矩,的茂宜岛或安装在的qsub 命令。我建议给那些一起来看看。

Keep in mind that there are much better ways to distribute load across a cluster (e.g. if someone else is using up all of node7 you'd want a way to detect that and send your job elsewhere). Most clusters I've worked with have Torque, Maui or the qsub command installed. I suggest giving those a look.

这篇关于使用屏幕和Bash多的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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