リモートノードにアクセスしてメモリ使用量を取得するスクリプト

リモートノードにアクセスしてメモリ使用量を取得するスクリプト

50個のコンピューティングノードを使用するコンピュータクラスタで大規模なシミュレーションを実行しています。ソルバーは、ノードごとに(非常に)異なる動的に増加するデータ構造を使用します。使用するメモリが各ノードのメモリ制限を超えていないことを確認する必要があります。

私はこれまでで最も効率的な方法でこれを行っています。各ノードのターミナルタブを開き、実行して使用されているtopメモリの割合を確認します。

スクリプトでこれを行う方法はありますか?アイデアは、各ノードでsshを実行し、メモリ使用量を保存し、次のノードにsshを送信するなどです。

ベストアンサー1

大きすぎるプロセスを終了したい場合は、これがulimitあなたの友人です。

マニュアルから:

  -S        use the `soft' resource limit
  -H        use the `hard' resource limit
  -a        all current limits are reported
  -b        the socket buffer size
  -c        the maximum size of core files created
  -d        the maximum size of a process's data segment
  -e        the maximum scheduling priority (`nice')
  -f        the maximum size of files written by the shell and its children
  -i        the maximum number of pending signals
  -l        the maximum size a process may lock into memory
  -m        the maximum resident set size
  -n        the maximum number of open file descriptors
  -p        the pipe buffer size
  -q        the maximum number of bytes in POSIX message queues
  -r        the maximum real-time scheduling priority
  -s        the maximum stack size
  -t        the maximum amount of cpu time in seconds
  -u        the maximum number of user processes
  -v        the size of virtual memory
  -x        the maximum number of file locks
  -T    the maximum number of threads

おすすめ記事