slurm_acct user: slurm token: 5cc26c76-0587-4a2a-81f5-e3ad791de0b3目标:在不设硬限额的前提下,完成 Slurm 计费管道、项目(Account)与用户关联、提交权限与校验、GPU 计费权重,以及 OOD 相关权限修正,使用户可通过 --account 选择项目并形成可统计数据。
cons_tres,GPU via GRES),分区 cpu / gpu-4070。.htpasswd),REMOTE_USER 与系统同名用户存在。testuser{1,2,3} 等测试用户;家目录权限按 700。epic-control-node 同时运行 slurmctld 与 slurmdbd(DbdHost 指向它)。安装并启动 MariaDB/MySQL(省略包管理细节),初始化库与用户
CREATE DATABASE slurm_acct CHARACTER SET utf8mb4;
CREATE USER 'slurm'@'localhost' IDENTIFIED BY 'StrongPass!';
GRANT ALL PRIVILEGES ON slurm_acct.* TO 'slurm'@'localhost';
FLUSH PRIVILEGES;
验证
mysql -uslurm -pStrongPass! -e "SHOW TABLES FROM slurm_acct;"(启动前为空)
写 /etc/slurm/slurmdbd.conf(chmod 600,chown slurm:slurm)
DbdHost=epic-control-node
DbdPort=6819
SlurmUser=slurm
LogFile=/var/log/slurm/slurmdbd.log
StorageType=accounting_storage/mysql
StorageHost=localhost
StorageUser=slurm
StoragePass=StrongPass!
StorageLoc=slurm_acct
验证
sudo -u slurm test -r /etc/slurm/slurmdbd.conf && echo OK
启动 slurmdbd
systemctl enable --now slurmdbd
tail -n 50 /var/log/slurm/slurmdbd.log
mysql -uslurm -pStrongPass! -e "SHOW TABLES FROM slurm_acct;" | head
期望:日志无报错,DB 出现大量 Slurm 会计表。
全局打开会计与优先级
AccountingStorageType=accounting_storage/slurmdbd
AccountingStorageHost=epic-control-node
JobAcctGatherType=jobacct_gather/cgroup
PriorityType=priority/multifactor
# 开启关联强制(禁止未授权账户回退到默认账户)
AccountingStorageEnforce=associations
验证
scontrol show config | egrep -i 'AccountingStorage(Type|Host)|JobAcctGatherType|PriorityType|AccountingStorageEnforce'
分区设置 GPU 计费权重(只影响排队,不限额)
PartitionName=cpu ... TRESBillingWeights="CPU=1.0,Mem=0.0"
PartitionName=gpu-4070 ... TRESBillingWeights="CPU=1.0,Mem=0.0,GRES/gpu=10.0"
# 若使用 typed GRES(如 gpu:rtx4070),再加:GRES/gpu:rtx4070=10.0
应用:scontrol reconfigure
验证
scontrol show partition gpu-4070 | grep -i TRESBillingWeights
期望:显示 CPU=1.0,Mem=0.0,GRES/gpu=10.0