Skip to content

Commit

Permalink
Configure controller for K8S and Spack. Increse machine size
Browse files Browse the repository at this point in the history
  • Loading branch information
tmiddelkoop committed May 7, 2021
1 parent 1e9304d commit df89cc2
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 2 deletions.
4 changes: 2 additions & 2 deletions slurm-gcp/basic.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ login_disk_size_gb = 20

partitions = [
{ name = "debug"
machine_type = "n1-standard-2"
machine_type = "c2-standard-4"
static_node_count = 0
max_node_count = 10
max_node_count = 5
zone = "us-central1-c"
image = "projects/schedmd-slurm-public/global/images/family/schedmd-slurm-20-11-4-hpc-centos-7"
image_hyperthreads = false
Expand Down
47 changes: 47 additions & 0 deletions slurm-gcp/scripts/controller.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

# Run on class-controller node.
# gcloud compute ssh class-controller -- < setup.sh

echo "=== setup.sh $(hostname) $(date)"

# TODO: wait for slurm to configure
# MOTD displays:
# *** Slurm is currently being configured in the background. ***

echo "+++ configure"

CONTROLLER=$(hostname)
K8S=class-container-cluster

export ZONE=$(gcloud compute instances list --filter="name=('$CONTROLLER')" --format='value(zone)')

sudo yum install -y kubectl
gcloud container clusters get-credentials --zone=$ZONE $K8S

kubectl get nodes

echo "+++ spack"
sudo yum install -y epel-release
sudo yum install -y git python3 ca-certificates procps curl unzip jq
sudo yum install -y gcc gcc-c++ make patch file bzip2 xz

sudo install -dv /apps/spack
sudo chown $USER /apps/spack
git clone --depth=1 https://github.com/spack/spack.git /apps/spack


NODES=$(sinfo -p debug -h -Onodes)
CPUS=$(sinfo -p debug -h -Ocpus)

cat > build-spack.sh <<EOF
#!/bin/bash
echo "+++ \$(hostname) \$(date) \$SLURM_JOB_ID CPUS:\$SLURM_CPU_PER_TASK"
. /apps/spack/share/spack/setup-env.sh
srun -n $NODES --exclusive spack install lmod python py-pip miniconda3
EOF
sbatch -N $NODES --exclusive ./build-spack.sh

# for I in class-compute-0-{0..7} ; do echo $I ; ssh -o stricthostkeychecking=no $I ps -fe \| grep spack ; done

echo "=== setup.sh $(hostname) $(date) done"
3 changes: 3 additions & 0 deletions slurm-gcp/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

gcloud compute ssh class-controller -- < scripts/controller.sh

0 comments on commit df89cc2

Please sign in to comment.