OpenPBS

您可以在叢集定義的組態區段中修改 「run_list」,輕鬆地在 CycleCloud 叢集上啟用OpenPBS。 PBS Professional 叢集的兩個基本元件是 'master' 節點,提供 PBS Professional 軟體執行所在的共用檔案系統,以及裝載共用檔案系統並執行所提交作業的「執行」節點。 例如,簡單的叢集範本程式碼片段看起來可能如下:

[cluster my-pbspro]

[[node master]]
    ImageName = cycle.image.centos7
    MachineType = Standard_A4 # 8 cores

    [[[configuration]]]
    run_list = role[pbspro_master_role]

[[nodearray execute]]
    ImageName = cycle.image.centos7
    MachineType = Standard_A1  # 1 core

    [[[configuration]]]
    run_list = role[pbspro_execute_role]

在 CycleCloud 中使用定義匯入和啟動叢集會產生單一「主要」節點。 您可以透過 cyclecloud add_node 命令將執行節點新增至叢集。 例如,若要新增 10 個更多執行節點:

cyclecloud add_node my-pbspro -t execute -c 10

PBS 資源型自動調整

Cyclecloud 會維護兩個資源,以擴充動態布建功能。 這些資源是 nodearraymachinetype

如果您提交作業並指定 nodearray 資源 qsub -l nodearray=highmem -- /bin/hostname ,CycleCloud 會將節點新增至名為 'highmem' 的 nodearray。 如果沒有這類 nodearray,作業會保持閒置狀態。

同樣地,如果指定了作業提交的 machinetype 資源,例如 qsub -l machinetype:Standard_L32s_v2 my-job.sh ,則 CycleCloud 會在 'execute' 中自動調整 'execute' 中的 'Standard_L32s_v2', (預設) nodearray。 如果 'execute' 節點陣列中無法使用該機器類型,作業將會保持閒置狀態。

這些資源可以組合使用為:

qsub -l nodes=8:ppn=16:nodearray=hpc:machinetype=Standard_HB60rs my-simulation.sh

只有在 'Standard_HB60rs' 機器指定了 'hpc' 節點陣列時,才會自動調整。

新增指派給 nodearrays 的其他佇列

在具有多個 nodearray 的叢集上,通常會建立個別的佇列,以自動將作業路由至適當的 VM 類型。 在此範例中,我們將假設已在叢集範本中定義下列 「gpu」 nodearray:

    [[nodearray gpu]]
    Extends = execute
    MachineType = Standard_NC24rs

        [[[configuration]]]
        pbspro.slot_type = gpu

匯入叢集範本並啟動叢集之後,可以在伺服器節點上執行下列命令,以建立 「gpu」 佇列:

/opt/pbs/bin/qmgr -c "create queue gpu"
/opt/pbs/bin/qmgr -c "set queue gpu queue_type = Execution"
/opt/pbs/bin/qmgr -c "set queue gpu resources_default.ungrouped = false"
/opt/pbs/bin/qmgr -c "set queue gpu resources_default.place = scatter"
/opt/pbs/bin/qmgr -c "set queue gpu resources_default.slot_type = gpu"
/opt/pbs/bin/qmgr -c "set queue gpu default_chunk.ungrouped = false"
/opt/pbs/bin/qmgr -c "set queue gpu default_chunk.slot_type = gpu"
/opt/pbs/bin/qmgr -c "set queue gpu enabled = true"
/opt/pbs/bin/qmgr -c "set queue gpu started = true"

注意

上述佇列定義會將佇列中的所有 VM 封裝成單一 VM 擴展集,以支援 MPI 作業。 若要定義序列作業的佇列並允許多個 VM 擴展集,請針對 resources_defaultdefault_chunk 設定 ungrouped = true 。 如果您想要排程器將作業封裝到 VM,而不是迴圈配置作業,也可以設定 resources_default.place = pack 。 如需 PBS 作業封裝的詳細資訊,請參閱官方 PBS 專業 OSS 檔

PBS 專業設定參考

以下是您可以切換以自訂功能的 PBS Professional 特定組態選項:

PBS Pro 選項 描述
pbspro.slots 要向 PBS Pro 回報之指定節點的插槽數目。 位置數目是節點可執行檔並行作業數目,此值預設為指定電腦上的 CPU 數目。 在未根據 CPU 但記憶體、GPU 等執行作業的情況下,您可以覆寫此值。
pbspro.slot_type 節點提供的 'slot' 類型名稱。 預設值為 'execute'。 當作業以硬式資源 slot_type=<type> 標記時,該作業 只會 在相同位置類型的電腦上執行。 這可讓您為每個節點建立不同的軟體和硬體組態,並確保適當作業一律排程在正確的節點類型上。
pbspro.version 預設值:'18.1.3-0'。 這是要安裝和執行的 PBS Professional 版本。 這是目前預設且 唯一 的選項。 未來可能會支援 PBS Professional 軟體的其他版本。

使用 CycleCloud 連線 PBS

CycleCloud 會透過稱為 azpbs 的可安裝代理程式來管理OpenPBS叢集。 此代理程式會連線到 CycleCloud 以讀取叢集和 VM 組態,並與 OpenPBS 整合,以有效地處理作業和主機資訊。 所有 azpbs 組態都位於 檔案中 autoscale.json ,通常是 /opt/cycle/pbspro/autoscale.json

  "password": "260D39rWX13X",
  "url": "https://cyclecloud1.contoso.com",
  "username": "cyclecloud_api_user",
  "logging": {
    "config_file": "/opt/cycle/pbspro/logging.conf"
  },
  "cluster_name": "mechanical_grid",

重要檔案

代理 azpbs 程式會在每次呼叫時剖析 PBS 組態 - 作業、佇列、資源。 在命令的 stderr 和 stdout 中提供資訊,以及可設定層級的記錄檔。 所有 PBS 管理命令 (qcmd) 引數也會記錄到檔案中。

所有這些檔案都可以在安裝代理程式的 /opt/cycle/pbspro/ 目錄中找到。

檔案 Location 描述
自動調整設定 autoscale.json 自動調整、資源對應、CycleCloud 存取訊號的設定
自動調整記錄檔 autoscale.log 代理程式主要執行緒記錄,包括 CycleCloud 主機管理
需求記錄檔 demand.log 資源比對的詳細記錄
qcmd 追蹤記錄 qcmd.log 記錄代理程式 qcmd 呼叫
記錄設定 logging.conf 記錄遮罩和檔案位置的設定

定義 OpenPBS 資源

此專案允許透過 cyclecloud-pbspro (azpbs) 專案,將 OpenPBS 資源與 Azure VM 資源建立一般關聯。 在 中 autoscale.json 定義的這個資源關聯性。

我們隨附的叢集範本所定義的預設資源為

{"default_resources": [
   {
      "select": {},
      "name": "ncpus",
      "value": "node.vcpu_count"
   },
   {
      "select": {},
      "name": "group_id",
      "value": "node.placement_group"
   },
   {
      "select": {},
      "name": "host",
      "value": "node.hostname"
   },
   {
      "select": {},
      "name": "mem",
      "value": "node.memory"
   },
   {
      "select": {},
      "name": "vm_size",
      "value": "node.vm_size"
   },
   {
      "select": {},
      "name": "disk",
      "value": "size::20g"
   }]
}

名為 mem 的 OpenPBS 資源等同于名為 的 node.memory 節點屬性,這是任何虛擬機器的總記憶體。 此組態可藉 azpbs 由比較作業資源需求的值與節點資源,來處理資源要求,例如 -l mem=4gb

請注意,磁片目前已硬式編碼為 size::20g 。 以下是處理 VM 大小特定磁片大小的範例

   {
      "select": {"node.vm_size": "Standard_F2"},
      "name": "disk",
      "value": "size::20g"
   },
   {
      "select": {"node.vm_size": "Standard_H44rs"},
      "name": "disk",
      "value": "size::2t"
   }

自動調整和調整集

CycleCloud 會以不同的方式處理 OpenPBS 叢集中的跨越和序列作業。 跨越作業會落在屬於相同放置群組一部分的節點上。 放置群組具有特定的平臺意義, (VirtualMachineScaleSet 與 SinglePlacementGroup=true) ,而 CC 會針對每個跨越的節點集管理具名放置群組。 使用此放置組名的 PBS 資源 group_id

佇列 hpc 會使用原生佇列預設值附加 的 -l place=scatter:group=group_id 對等專案。

安裝 CycleCloud OpenPBS 代理程式 azpbs

OpenPBS CycleCloud 叢集會管理伺服器節點上代理程式的安裝和設定。 準備包括設定 PBS 資源、佇列和勾點。 您也可以在 CycleCloud 外部完成腳本安裝。

# Prerequisite: python3, 3.6 or newer, must be installed and in the PATH
wget https://github.com/Azure/cyclecloud-pbspro/releases/download/2.0.5/cyclecloud-pbspro-pkg-2.0.5.tar.gz
tar xzf cyclecloud-pbspro-pkg-2.0.5.tar.gz
cd cyclecloud-pbspro

# Optional, but recommended. Adds relevant resources and enables strict placement
./initialize_pbs.sh

# Optional. Sets up workq as a colocated, MPI focused queue and creates htcq for non-MPI workloads.
./initialize_default_queues.sh

# Creates the azpbs autoscaler
./install.sh  --venv /opt/cycle/pbspro/venv

# Otherwise insert your username, password, url, and cluster name here.
./generate_autoscale_json.sh --install-dir /opt/cycle/pbspro \
                             --username user \
                             --password password \
                             --url https://fqdn:port \
                             --cluster-name cluster_name

azpbs validate

CycleCloud 支援跨排程器的標準自動停止屬性集:

屬性 描述
cyclecloud.cluster.autoscale.stop_enabled 此節點上是否已啟用自動停止功能? [true/false]
cyclecloud.cluster.autoscale.idle_time_after_jobs 節點在相應減少之前完成作業之後,) 以秒為單位的時間量 (閒置。
cyclecloud.cluster.autoscale.idle_time_before_jobs 節點在相應減少作業之前,) 以秒為單位 (的時間量。

注意

CycleCloud 不支援使用 Open PBS 的高載設定。

注意

雖然 Windows 是正式支援的 Open PBS 平臺,但 CycleCloud 目前不支援在 Windows 上執行 Open PBS。