LoginSignup
1
3

More than 3 years have passed since last update.

システムまぎちゃんへの道~SLURMを入れよう~

Last updated at Posted at 2019-09-14

SLURM はバッチジョブスケジューラと呼ばれる、スケジューラの一種です。
その昔はPBS一択のようなことがありましたが、今はSLURMなど少々スケジューラ周りも変化が起きています。

そこで、SLURM を入れるのに必要な回りのライブラリから準備をしていきましょう。

あくまでも、ラズパイでの出来事です。もう少し楽な方法がほかのアーキテクチャでは用意されています。
わざと茨の道を歩んでいるのです。

まず munge(なんて読むのか良くわからない)をインストールします。これは計算機同士の認証に使われるもので、これがないとちょっと面倒になる可能性があります。
少し古いかもしれませんが、以下のようにダウンロードしてインストールします。これは、すべてのノードでおこないます。

$ wget https://github.com/dun/munge/releases/download/munge-0.5.13/munge-0.5.13.tar.xz
# rpmbuild -tb --clean munge-0.5.13.tar.xz
# yum localinstall -y ./rpmbuild//RPMS/armv7hl/munge-*.rpm

何をしているかというと、単純に munge をとってきて rpmbuild コマンドで RPM パッケージにして、それを YUM でインストールしているのです。

意外と簡単ですが、結構時間がかかるので覚悟してビルドしてください。

で、ビルドとインストールが終わると、いよいよ本丸である SLURM のインストールに入ります。
これも先と一緒で、SLURM を落として、rpmbuild して、YUM でインストールします。
これも各マシンで一斉におこなうといいでしょう。
もしくは1台でビルドして、各マシンにばら撒きましょう。

$ wget https://download.schedmd.com/slurm/slurm-18.08.6-2.tar.bz2

# systemctl enable munge
# systemctl start munge
# rpmbuild -ta slurm-18.08.6-2.tar.bz2

# yum localinstall ./rpmbuild/RPMS/armv7hl/slurm-*.rpm

これであらからたの設定は終了…といいたいところですが、まだ設定は続きます。
ひとつは、ファイアーウォールの設定です。
6817 番ポートと6818 番ポートを開けます。

# firewall-cmd --permanent --add-port 6817/tcp
# firewall-cmd --permanent --add-port 6817/udp
# firewall-cmd --permanent --add-port 6818/tcp
# firewall-cmd --permanent --add-port 6818/udp

リロードをお忘れなく、

#firewall-cmd --reload

次に、SLURM を起動させるのに必要なディレクトリが足りないのでそれを作成してみました。

# mkdir /var/spool/slurm/d/

ここからが少し面倒で、SLURM の設定ファイルを書きます。そうです、システムまぎちゃんをきちんとスケジューラの支配下に置かないといけません。
ということで、雛形からコピーしたものを編集します。
これは、たしかマスターノードだけでよかったような…。

# cp /etc/slurm/slurm.conf.example /etc/slurm/slurm.conf
slurm.conf
#
# Example slurm.conf file. Please run configurator.html
# (in doc/html) to build a configuration file customized
# for your environment.
#
#
# slurm.conf file generated by configurator.html.
#
# See the slurm.conf man page for more information.
#
ClusterName=magi
ControlMachine=ctl
#ControlAddr=
#BackupController=
#BackupAddr=
#
SlurmUser=slurm
#SlurmdUser=root
SlurmctldPort=6817
SlurmdPort=6818
AuthType=auth/munge
#JobCredentialPrivateKey=
#JobCredentialPublicCertificate=
StateSaveLocation=/var/spool/slurm/ctld
SlurmdSpoolDir=/var/spool/slurm/d
SwitchType=switch/none
MpiDefault=none
SlurmctldPidFile=/var/run/slurmctld.pid
SlurmdPidFile=/var/run/slurmd.pid
ProctrackType=proctrack/pgid
#PluginDir=
#FirstJobId=
ReturnToService=0
#MaxJobCount=
#PlugStackConfig=
#PropagatePrioProcess=
#PropagateResourceLimits=
#PropagateResourceLimitsExcept=
#Prolog=
#Epilog=
#SrunProlog=
#SrunEpilog=
#TaskProlog=
#TaskEpilog=
#TaskPlugin=
#TrackWCKey=no
#TreeWidth=50
#TmpFS=
#UsePAM=
#
# TIMERS
SlurmctldTimeout=300
SlurmdTimeout=300
InactiveLimit=0
MinJobAge=300
KillWait=30
Waittime=0
#
# SCHEDULING
SchedulerType=sched/backfill
#SchedulerAuth=
#SelectType=select/linear
FastSchedule=1
#PriorityType=priority/multifactor
#PriorityDecayHalfLife=14-0
#PriorityUsageResetPeriod=14-0
#PriorityWeightFairshare=100000
#PriorityWeightAge=1000
#PriorityWeightPartition=10000
#PriorityWeightJobSize=1000
#PriorityMaxAge=1-0
#
# LOGGING
SlurmctldDebug=3
SlurmctldLogFile=/var/log/slurmctld.log
SlurmdDebug=3
SlurmdLogFile=/var/log/slurmd.log
JobCompType=jobcomp/none
#JobCompLoc=
#
# ACCOUNTING
#JobAcctGatherType=jobacct_gather/linux
#JobAcctGatherFrequency=30
#
#AccountingStorageType=accounting_storage/slurmdbd
#AccountingStorageHost=
#AccountingStorageLoc=
#AccountingStoragePass=
#AccountingStorageUser=
#
# COMPUTE NODES
#NodeName=linux[1-32] Procs=1 State=UNKNOWN
NodeName=melchior Sockets=1 CoresPerSocket=4 ThreadsPerCore=1 Procs=4 State=UNKNOWN
NodeName=balthasar Sockets=1 CoresPerSocket=4 ThreadsPerCore=1 Procs=4 State=UNKNOWN
NodeName=casper Sockets=1 CoresPerSocket=4 ThreadsPerCore=1 Procs=4 State=UNKNOWN
PartitionName=MAGISystem Nodes=ALL Default=YES MaxTime=INFINITE State=UP
#PartitionName=debug Nodes=ALL Default=YES MaxTime=INFINITE State=UP

特に重要なのは、最後の5行くらいで、ノード名とそれを束ねるパーティション名を決めます。
あとは、SLURM を起動してみます。

# systemctl enable slurmd
# systemctl start slurmd

しかし、これだけではあまりスマートとはいえません。
/home 領域を NFS で共有しないとめんどくさいことが起きるのです。

というわけで マスターノードで NFS サーバを作成します。

# yum -y install nfs-utils

おやくそくのexportsの設定をします。

# vi /etc/exports
/etc/exports
/home 192.168.1.0/24(rw,no_root_squash)

そしたら、またファイアーウォールに穴を開けます。

# firewall-cmd --permanent --add-service nfs
# firewall-cmd --reload

これでほとんどの設定は終了しました。
・・・と思ったのですが、SLURM などはいいのですが、MPI がどのポートから通信するか、正直わかっていません。
また、SELinuxが邪魔をしてうまく運用できません。
そこで必殺、SELinux Disable と Firewall をきるという荒業に出ざるを得ませんでした。

vi /etc/selinux/config
/etc/selinux/config
SELINUX=disabled
# systemctl disable firewalld

これでリブートすればうまくいくはずです。

 # reboot

運用編はまた今度。

参考URL:
https://slurm.schedmd.com/
https://github.com/dun/munge/wiki

1
3
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3