MyCluster
V2.0.6
庫和命令行接口,以支持與多個HPC群集交互
提供了使用單個接口與最流行的HPC作業計劃系統進行交互的能力,並啟用了作業提交腳本的創建。
用SGE,LSF和Slurm測試(正在開發的PBS/扭矩支持)
可以從PYPI安裝mycluster。
pip install mycluster
MyCluster將將您的電子郵件地址寫入任何提交文件中,因此您可以從調度程序中收到更新。您可以在命令行中提供此信息,也可以將其存儲在配置文件中。將您的電子郵件存儲在“配置文件”運行中:
mycluster configure
默認情況下,mycluster將嘗試檢測基礎調度程序,但可以通過設置myCluster_sched環境變量來覆蓋這。應該將其設置為實現mycluster.schedulers.base.Scheduler類的Python類的字符串名稱。
在某些情況下,您可能需要覆蓋提交模板,例如,如果要包含其他參數或調度程序命令。為此,將MyCluster_Template環境變量設置為您希望使用的Jinja模板。有關基本模板,請參見MyCluster/調度程序/模板。
MyClusyter安裝“ mycluster” CLI命令,通過命令行與本地調度程序進行交互。
打印命令幫助
mycluster <command> --help
列出所有隊列
mycluster queues
列出工作
mycluster list
創建一個新的提交文件,請參閱-help,以獲取更多提交選項。
mycluster create JOBFILE QUEUE RUNSCRIPT
提交工作文件
mycluster submit JOBFILE
取消工作
mycluster cancel JOBID
job_script執行的runscript可以利用以下預定義的環境變量
export NUM_TASKS=
export TASKS_PER_NODE=
export THREADS_PER_TASK=
export NUM_NODES=
# OpenMP configuration
export OMP_NUM_THREADS= $THREADS_PER_TASK
# Default mpiexec commnads for each flavour of mpi
export OMPI_CMD= " mpiexec -n $NUM_TASKS -npernode $TASKS_PER_NODE -bysocket -bind-to-socket "
export MVAPICH_CMD= " mpiexec -n $NUM_TASKS -ppn $TASKS_PER_NODE -bind-to-socket "
export IMPI_CMD= " mpiexec -n $NUM_TASKS -ppn $TASKS_PER_NODE " 可以使用mycluster模塊以編程方式使用mycluster。所有調度程序都實現基本mycluster.schedulers.base.Scheduler類。
import mycluster
# Detect the local scheduler
scheduler = mycluster . detect_scheduling_sys ()
print ( f"Scheduler loaded: { scheduler . scheduler_type () } " )
# Create a batch script to submit a 48 task run of script.sh to the skylake queue
script = scheduler . create ( "skylake" , 48 , "my_job" , "script.sh" , "01:00:00" , tasks_per_node = 24 )
# Write to a file
with open ( "mysub.job" , "w" ) as f :
f . write ( script )
# Submit the batch script
job_id = scheduler . submit ( "mysub.job" )
# Check the status of the job
print ( scheduler . get_job_details ( job_id ))
# Cancel the job
scheduler . delete ( job_id )