#!/bin/sh
set -e

cat > /etc/slurm/slurm.conf <<EOF
SlurmctldHost=localhost
ProctrackType=proctrack/pgid
ReturnToService=1
SlurmctldPidFile=/run/slurmctld.pid
SlurmctldPort=6817
SlurmdPidFile=/run/slurmd.pid
SlurmdPort=6818
SlurmdSpoolDir=/var/lib/slurm/slurmd
SlurmUser=slurm
StateSaveLocation=/var/lib/slurm/slurmctld
TaskPlugin=task/none
SlurmctldTimeout=300
SchedulerType=sched/backfill
SelectType=select/linear
AccountingStorageType=accounting_storage/none
ClusterName=cluster
JobCompType=jobcomp/none
JobAcctGatherType=jobacct_gather/none
SlurmctldDebug=3
SlurmctldLogFile=/var/log/slurm/slurmctld.log
SlurmdDebug=3
SlurmdLogFile=/var/log/slurm/slurmd.log
NodeName=localhost Procs=1 State=UNKNOWN
PartitionName=test Nodes=localhost Default=YES MaxTime=INFINITE State=UP
EOF

service slurmctld restart
service slurmd restart

sleep 10

service slurmctld status
service slurmd status

sinfo
sinfo --Node

mpicc -o cpi /usr/share/doc/mpich/examples/cpi.c
srun --mpi=pmix cpi
