Multiprocessing with Screen and Bash

我的未来我决定 提交于 2019-12-22 09:00:06

问题


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.

Is it more desirable to:

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

Are they equivalent?

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!


回答1:


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.

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.




回答2:


I would think they are about the same. I would prefer screen just because I have an easier time managing it. Depending on the scripts usage, that could also have some effect on time to process.



来源:https://stackoverflow.com/questions/24619330/multiprocessing-with-screen-and-bash

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!