Clusters形式

Master」と「Worker」を別々の計算機に組み込みます
そしてジョブを実行する際、「Master-Worker」方式ではブラウザから利用する計算ノードを手動で選びますが、
この Cluster 形式ではその選択に ジョブ管理システム を使用します

目下使用できる ジョブ管理システム は

となっているみたい. ここでは OpenPBS を採用しています.

masterworkerの構築は cryoSPARC/Master-Workerを参照してください.

そしてジョブ管理システムの設定でmasterノードはジョブ発行ノードとしての機能を持たせて、
workerノードには計算ノードの機能を持たせます。

次にジョブ管理システム毎の設定シート(cluster_info.jsoncluster_script.sh)を作成します

slurmの場合cryoSPARC/sbatch
gridengineの場合cryoSPARC/sge

テンプレート作成

まずはそのテンプレートを取得.

[saber@cryosparc ~]$ cryosparcm cluster example
Writing example cluster_info.json and cluster_script.sh to current dir
Unknown cluster type. Supported templates are:
  pbs
  slurm
  gridengine
Any cluster scheduler is supported, but you may have to write your own custom submission script.
 
[saber@cryosparc ~]$

ここではOpenPBSを使用するので「pbs」のテンプレートを頂きます。

[saber@cryosparc ~]$ cryosparcm cluster example pbs
Writing example cluster_info.json and cluster_script.sh to current dir
[saber@cryosparc ~]$

すると、コマンドを実行した場所に設定ファイルのテンプレート「cluster_info.json」と「cluster_script.sh」が置かれます.

テンプレートcluster_info.jsonの中身は
*ここのpukiwikiの記述ルールの問題から「}}」を「} }」にしています

[saber@cryosparc ~]$ cat cluster_info.json
{
    "name" : "pbscluster",
    "worker_bin_path" : "/path/to/cryosparc_worker/bin/cryosparcw",
    "cache_path" : "/path/to/local/SSD/on/cluster/nodes"
    "send_cmd_tpl" : "ssh loginnode {{ command } }",
    "qsub_cmd_tpl" : "qsub {{ script_path_abs } }",
    "qstat_cmd_tpl" : "qstat -as {{ cluster_job_id } }",
    "qdel_cmd_tpl" : "qdel {{ cluster_job_id } }",
    "qinfo_cmd_tpl" : "qstat -q",
    "transfer_cmd_tpl" : "scp {{ src_path } } loginnode:{{ dest_path } }"
}
[saber@cryosparc ~]$

こんな感じ。もう一つのcluster_script.sh
*ここのpukiwikiの記述ルールの問題から「}}」を「} }」にしています

[cryosparc@c ~]$ cat cluster_script.sh
[saber@cryosparc ~]$ cat cluster_script.sh
#!/usr/bin/env bash
#### cryoSPARC cluster submission script template for PBS
## Available variables:
## {{ run_cmd } }            - the complete command string to run the job
## {{ num_cpu } }            - the number of CPUs needed
## {{ num_gpu } }            - the number of GPUs needed.
##                            Note: the code will use this many GPUs starting from dev id 0
##                                  the cluster scheduler or this script have the responsibility
##                                  of setting CUDA_VISIBLE_DEVICES so that the job code ends up
##                                  using the correct cluster-allocated GPUs.
## {{ ram_gb } }             - the amount of RAM needed in GB
## {{ job_dir_abs } }        - absolute path to the job directory
## {{ project_dir_abs } }    - absolute path to the project dir
## {{ job_log_path_abs } }   - absolute path to the log file for the job
## {{ worker_bin_path } }    - absolute path to the cryosparc worker command
## {{ run_args } }           - arguments to be passed to cryosparcw run
## {{ project_uid } }        - uid of the project
## {{ job_uid } }            - uid of the job
## {{ job_creator } }        - name of the user that created the job (may contain spaces)
## {{ cryosparc_username } } - cryosparc username of the user that created the job (usually an email)
##
## What follows is a simple PBS script:
 
#PBS -N cryosparc_{{ project_uid } }_{{ job_uid } }
#PBS -l select=1:ncpus={{ num_cpu } }:ngpus={{ num_gpu } }:mem={{ (ram_gb*1000)|int } }mb:gputype=P100
#PBS -o {{ job_dir_abs } }
#PBS -e {{ job_dir_abs } }
 
available_devs=""
for devidx in $(seq 1 16);
do
    if [[ -z $(nvidia-smi -i $devidx --query-compute-apps=pid --format=csv,noheader) ]] ; then
        if [[ -z "$available_devs" ]] ; then
            available_devs=$devidx
        else
            available_devs=$available_devs,$devidx
        fi
    fi
done
export CUDA_VISIBLE_DEVICES=$available_devs
 
{{ run_cmd } }
 
[saber@cryosparc ~]$

こんな感じ。これら2つを既設のジョブ管理システムに会うように調整します

cluster_info.json

変更箇所

*ここのpukiwikiの記述ルールの問題から「}}」を「} }」にしています

--- cluster_info.json.orig      2021-04-25 01:21:00.555984725 +0900
+++ cluster_info.json   2021-04-25 05:22:37.673773344 +0900
@@ -1,11 +1,11 @@
 {
     "name" : "pbscluster",
-    "worker_bin_path" : "/path/to/cryosparc_worker/bin/cryosparcw",
-    "cache_path" : "/path/to/local/SSD/on/cluster/nodes"
-    "send_cmd_tpl" : "ssh loginnode {{ command } }",
+    "worker_bin_path" : "/home/saber/cryoSPARC/cryosparc_worker/bin/cryosparcw",
+    "cache_path" : "",
+    "send_cmd_tpl" : "{{ command } }",
     "qsub_cmd_tpl" : "qsub {{ script_path_abs } }",
     "qstat_cmd_tpl" : "qstat -as {{ cluster_job_id } }",
     "qdel_cmd_tpl" : "qdel {{ cluster_job_id } }",
     "qinfo_cmd_tpl" : "qstat -q",
-    "transfer_cmd_tpl" : "scp {{ src_path } } loginnode:{{ dest_path } }"
+    "transfer_cmd_tpl" : "cp {{ src_path } } {{ dest_path } }"
 }

cluster_script.sh

既定では ngpus や mem もリソース要因として載せてますが、ここではそれらを削ってます.

*ここのpukiwikiの記述ルールの問題から「}}」を「} }」にしています

--- cluster_script.sh.orig      2021-04-25 01:21:00.565984935 +0900
+++ cluster_script.sh   2021-04-25 03:03:48.525679266 +0900
@@ -22,12 +22,12 @@
 ## What follows is a simple PBS script:
 
 #PBS -N cryosparc_{{ project_uid } }_{{ job_uid } }
-#PBS -l select=1:ncpus={{ num_cpu } }:ngpus={{ num_gpu } }:mem={{ (ram_gb*1000)|int } }mb:gputype=P100
+#PBS -l select=1:ncpus={{ num_cpu } }
 #PBS -o {{ job_dir_abs } }
 #PBS -e {{ job_dir_abs } }
 
 available_devs=""
-for devidx in $(seq 1 16);
+for devidx in $(seq 0 16);
 do
     if [[ -z $(nvidia-smi -i $devidx --query-compute-apps=pid --format=csv,noheader) ]] ; then
         if [[ -z "$available_devs" ]] ; then

*「for devidx in $(seq 1 16);」は間違いだと思っている. 「1」ならGPU-ID:0を飛ばしてそれ以外を探すことになる. 4GPUで計算したいのに3つしか使えない事が起こりえる. slurm版だとここが「0」なんだよなぁ. 親切に「0」をモニター用として使わない? qsubで動かす前提ならそのような枷は不要だと思うのだが..

カスタマイズしたテンプレートの取り込み

こうしてカスタマイズしたcluster_info.jsoncluster_script.shをシステムに反映させるには、
これらのファイルが置かれた場所で「cryosparcm cluster connect」を実行します

[saber@cryosparc ~]$ cryosparcm cluster connect
 :
Successfully added cluster lane pbscluster
 
(確認は下記コマンドで)
[saber@cryosparc ~]$ cryosparcm cli "get_scheduler_lanes()"
 
(削除はcluster_info.jsonのnameを使います)
[saber@cryosparc ~]$ cryosparcm cluster remove pbscluster

これで反映できました。

複数のqueueを作りたい

例えば、特定の計算機にcryoSPARCジョブを流したいとかがある。
リソースの最適な分配は ジョブ管理システム で行うが、そうであっても特定の計算機にジョブを流したいことはある
加えて、ジョブ管理システム を経ないでジョブを勝手に流すと他のユーザのジョブに影響が及ぶ. なのであくまでもジョブ管理システムの下で指定する必要がある

例えば、OpenPBSで特定の計算機を指定するには

qsub -q workq -l select=1:ncpus=8:host=s -I
 「1ノードでcore数が8のhost名がsなノードをインターラクティヴモードで接続」

と指定します。 「-l」の後にhostが来るとダメみたい. selectが来ないと

これを模します.

「cluster_info.json」は

--- cluster_info.json.pbscluster        2021-04-25 04:07:49.614387651 +0900
+++ cluster_info.json   2021-04-25 04:07:19.611757357 +0900
@@ -1,5 +1,5 @@
 {
-    "name" : "pbscluster",
+    "name" : "run-on-s",
     "worker_bin_path" : "/home/saber/cryoSPARC/cryosparc_worker/bin/cryosparcw",
     "cache_path" : "",
     "send_cmd_tpl" : "{{ command } }",

として、「cluster_script.sh」は下記のようにします.

--- cluster_script.sh.pbscluster        2021-04-25 03:40:45.286240573 +0900
+++ cluster_script.sh   2021-04-25 03:41:40.361398185 +0900
@@ -22,7 +22,7 @@
 ## What follows is a simple PBS script:
 
 #PBS -N cryosparc_{{ project_uid } }_{{ job_uid } }
-#PBS -l select=1:ncpus={{ num_cpu } }
+#PBS -l select=1:ncpus={{ num_cpu } }:host=s
 #PBS -o {{ job_dir_abs } }
 #PBS -e {{ job_dir_abs } }

これを取り込み当たなlane 「run-on-s」が用意されます.

[saber@cryosparc ~]$ cryosparcm cluster connect
 :
Successfully added cluster lane run-on-s
[saber@cryosparc ~]$

今登録されているclusterは?

cryosparcm cli "get_scheduler_lanes()"

にて表示される
っで削除は

cryosparcm cli "remove_scheduler_lane('em-g1-a01')"

とlaneの名前を入れます

メモ

cryoSPARCではどのGPUを使うかはスクリプトで決めている.
「nvidia-smi -i $i --query-compute-apps=pid --format=csv,noheader」
この「$i」を0から16まで動かしてエラーではなく値の無いもので計算をさせる.

っが、やっすいGPUカードだとこの「nvidia-smi -i 0 --query-compute-apps=pid --format=csv,noheader」が正しく動かない.
それで対応GPUがないとかでジョブが停止します.

あと使われていないGPUを探すのはいいのだが、2つGPUを使って計算していて、他のジョブ(relion)が来たとして
その使っているGPU-IDを避けてGPU-IDが指定されるか微妙...

そこらは cgroupやHookを使う必要があり、結構面倒. 可能な限り1台で済ませるようなジョブ投入が宜しいかと.

「[Errno 2] No such file or directory: 'qsub': 'qsub'」と表示されたらそれはmasterでqsubへのPATHが入っていない可能性

Clusters形式で自動起動する場合、/etc/profile.d/slurm.sh もしくは /etc/profile.d/pbs.sh を噛んで立ち上がる必要があり.
その際「cryosparc.service」で

ExecStart=/home/cryosparc/cryosparc_master/bin/cryosparcm start
  ↓
ExecStart=/bin/bash -l /home/cryosparc/cryosparc_master/bin/cryosparcm start

とする. そうしないとsbatchやqsubコマンドが見つからずに落ちる

メモ clusterでのpatchの当て方

master側には

cryosparcm patch

でいいのだが、worker側にはpatchがあたらない. なので

cryosparcm patch --download
あるいは
cryosparcm patch --download --force

にてパッチファイルを取得して、

cd cryosparc_worker/
cp ../cryosparc_master/cryosparc_worker_patch.tar.gz .
bin/cryosparcw patch

で行う

最新の60件
2025-02-17 2025-02-15 2025-02-14 2025-02-12 2025-02-03 2025-02-02 2025-02-01 2025-01-27 2025-01-26 2025-01-25 2025-01-24 2025-01-23 2025-01-20 2025-01-13 2025-01-12 2025-01-08 2024-12-30 2024-12-29 2024-12-22 2024-12-20 2024-12-17
  • cryoSPARC/qsub
2024-12-15 2024-12-14 2024-12-12 2024-12-11 2024-12-10 2024-12-09 2024-12-08 2024-11-28 2024-11-22 2024-11-15 2024-11-14 2024-11-12 2024-11-06 2024-11-05 2024-11-04 2024-11-02 2024-11-01 2024-10-28 2024-10-27 2024-10-23 2024-10-18 2024-10-17 2024-10-15 2024-10-14

edit


トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2024-12-17 (火) 05:19:05