0

I have multiple machines on the same LAN, and I would like to get the top/nvidia-smi status of all machines in a single command, E.g by dispatching

nvidia-smi-all

from one of the machines. The output will be a simple concatenation of the textual outputs from all machines, order doesn't matter.

We prefer not to install any resource management software (Kubernetes, slarm). I assume it shouldn't be tricky once I have a list of all the machine ips, but couldn't find something online, probably didn't know what to look for.

Hope the question is clear, thanks.

3
  • What have you already tried, and what was the result ? Please update your question with that.
    – Soren A
    Feb 11 at 8:09
  • There might be several options for you to look at. One might be GNU Parallel, which I'm not very familiar with - but it should be possible. Feb 11 at 8:52
  • Another option would be tmux. With tmux, you can log in to each machine with SSH, and syncronize the terminal input to all panes. Then you can run 1 command on multiple computers at once. Feb 11 at 8:53
2

For this kind of Unix shell based operation I have used Pssh (Parallel ssh) it allows you create lists of servers and then the ssh command issues requests to them in parallel using multiple threads.

To install on Ubuntu 20.04 and 20.10 just run

sudo apt install pssh

The package includes the pssh command for this purpose..
Example Create your hosts/cluster file (Say myCluster.hosts)

192.168.0.100:2222
192.168.0.101:22
192.168.0.102:22

Then this file with the pssh command to execute the 'uptime' command on each host.

parallel-ssh -h myCluster.hosts uptime
[1] 16:09:03 [SUCCESS] 192.168.0.100:2222 16:09:01 up  1:00,  2 users,  load average: 0.07, 0.02, 0.00
[2] 16:09:03 [SUCCESS] 192.168.0.101:22 06:39:03 up  1:00,  2 users,  load average: 0.00, 0.06, 0.09
[3] 16:09:03 [SUCCESS] 192.168.0.102:22 08:00:01 up  1:00,  8 users,  load average: 0.00, 0.09, 0.18

The package also comes with parallel versions of scp, rsync etc. very powerful tools. Suggest that you use the dry run option/ testing on a single machine first to avoid breaking an entire cluster.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.