slurm设置用户节点和分区权限
在使用SLURM(Simple Linux Utility for Resource Management)管理计算资源时,正确地配置用户节点和分区的权限是非常重要的。这可以帮助你控制谁可以访问哪些资源以及他们可以做什么。以下是一些基本步骤和概念,帮助你设置和管理SLURM中的用户节点和分区权限。
- 理解SLURM的基本组件
在开始配置之前,了解SLURM的基本组件是非常有帮助的:
节点(Nodes):计算资源的基本单元,可以是物理服务器或虚拟机。
分区(Partitions):节点的一个集合,可以定义不同的资源限制和优先级。
队列(Queues):用户提交作业的逻辑分组,通常与分区相关联。
- 配置分区
在slurm.conf文件中配置分区,你可以定义哪些节点属于哪个分区,以及该分区的特定属性(如最大任务数、时间限制等)。例如:
PartitionName=normal Nodes=node[01-10] Default=YES MaxTime=24:00:00 State=UP
PartitionName=gpu Nodes=node[11-20] Default=NO MaxTime=72:00:00 GPUs=1 State=UP
3. 用户权限设置
3.1 使用slurm_acct/slurm_acct.conf配置文件
你可以在slurm_acct/slurm_acct.conf中设置用户对特定分区的访问权限。例如:
Account admin AccountingGroup=admin Users=admin,root
Account student AccountingGroup=student Users=student1,student2
3.2 使用slurm.conf中的AccountingStorageEnforce和AccountingStorageTRES
你可以在slurm.conf中设置哪些资源类型(TRES)应该被记录和强制执行。例如:
AccountingStorageEnforce=JobDump,Force,billing,tres SelectTypeParameters=billing=billing_group,tres=billing_group*ConsumableJobFactor
4. 用户组和权限管理
为了更细粒度地控制访问权限,你可以创建用户组并在SLURM配置中引用这些组:
slurm.conf 中的示例
UserParameters=billing_group AllowAccounts=admin,student DefaultAccount=student DefaultBillingGroup=student BillingGroup=billing_groupConsumableJobFactor,billing_groupConsumableTimeFactor,billing_groupConsumableNodeFactor,billing_groupConsumableCoreFactor,billing_groupConsumableGPUTimeFactor,billing_groupConsumableGPUTimeFactor,billing_groupConsumableMemoryFactor,billing_groupConsumableSwapFactor,billing_groupConsumableTmpDiskFactor,billing_groupConsumableEnergyFactor,billing_groupConsumableWeightFactor,billing_groupConsumableQOSFactor,billing_groupConsumableAccountingStorageFactor,billing_groupConsumableWattsFactor,billing_groupConsumableWeightJobFactor,billing_groupConsumableWeightTimeFactor,billing_groupConsumableWeightNodeFactor,billing_groupConsumableWeightCoreFactor,billing_groupConsumableWeightGPUTimeFactor,billing_groupConsumableWeightMemoryFactor,billing_groupConsumableWeightSwapFactor,billing_groupConsumableWeightTmpDiskFactor,billing_groupConsumableWeightEnergyFactor,billing_groupConsumableWeightQOSFactor,billing_groupConsumableWeightAccountingStorageFactor,billing_groupConsumableWeightWattsFactor
5. 重新加载SLURM配置并测试
每次修改slurm.conf或相关配置文件后,你需要重新加载SLURM配置:
sudo scontrol reconfigure
然后,你可以使用squeue, sinfo, sacct等命令来检查配置是否按预期工作。例如:
sinfo -o “%P %n” # 查看分区和对应的节点信息
squeue -u # 查看指定用户的作业队列状态
通过以上步骤,你可以有效地管理和控制SLURM中的用户节点和分区权限。确保根据你的具体需求调整配置文件中的参数。