说明
Slurm is an open-source workload manager designed for Linux clusters of all sizes. It provides three key functions. First it allocates exclusive and/or non-exclusive access to resources (computer nodes) to users for some duration of time so they can perform work. Second, it provides a framework for starting, executing, and monitoring work (typically a parallel job) on a set of allocated nodes. Finally, it arbitrates contention for resources by managing a queue of pending work.
系统:ubuntu 14.04。slurm版本2.6.5。
节点:2个独立的ubuntu14.04计算机。
安装
在ubuntu中,最简单的安装方法是使用apt-get,目前自动安装的slurm版本为2.6.5,并不是最新版本。
安装slurm的同时,会自动创建一个蛋疼的slurm用户,但是这个用户没有home文件,所以无法切换到该用户下进行工作。我的建议是删除旧的slurm用户,同时也是为了munge的正确运行做准备。
使用slurm,所有的节点必须在相同的用户下工作,建议新建一个slurm用户,必须指定UID,保证所有节点slurm用户的UID也相同:
Munge
在安装slurm的同时,也会安装munge。
MUNGE (MUNGE Uid ‘N’ Gid Emporium) is an authentication service for creating and validating credentials. It is designed to be highly scalable for use in an HPC cluster environment. It allows a process to authenticate the UID and GID of another local or remote process within a group of hosts having common users and groups. These hosts form a security realm that is defined by a shared cryptographic key. Clients within this security realm can create and validate credentials without the use of root privileges, reserved ports, or platform-specific methods.
1.生成key
首先生成key,自动生成至/ete/munge/munge.key
:
2.部署
将key拷贝至所有节点。拷贝/etc/munge/munge.key
到所有节点的/etc/munge/
目录下。
3.启动
启动munge。
出现错误:
出现上述错误需要修改log文件权限:
出现错误:
首先尝试使用sudo启动,若不成功,则参考如下。munge安装的所有文件,默认用户为munge:munge,当前用户如果不是munge,启动出现错误:
需要修改如下文件的用户:
/etc/munge/
/var/lib/munge/
/var/log/munge/
/var/run/munge/
修改文件用户的命令:
修改/ete/init.d/munge,将USER变量修改为你的用户名。
4.验证
在slurm用户下验证本机:
验证其它节点:
注意!munge自动认证的是相同的用户,即UID和GID相同,并不是按照用户名称来匹配,所以在创建slurm用户时必须指定相同的UID和GID。
slurm配置文件
在安装文件中有配置工具:slurm-xxx/doc/html/configurator.html.in
如果使用apt-get安装,则需要根据自己slurm的版本信息下载相应的tar文件,解压后使用,slurm所有版本。
配置文件样例:
将该配置文件拷贝至所有节点,放置于/etc/slurm-llnl/slurm.conf中。
启动和测试slurm
到所有节点中启动:
查看节点信息:
测试脚本test:
运行测试脚本:
当某一个job因为某些I/O原因阻塞以后,会导致某个节点一直处于comp状态,重启该节点可以使用如下命令: