remote/bin/slurm-shell @ 46c8ae0df6cc default tip

More
author Steve Losh <steve@stevelosh.com>
date Thu, 30 Jan 2025 09:44:14 -0500
parents 417f91fae3c2
children (none)
#!/usr/bin/env bash

set -euo pipefail

read -p "Account? "
acct="$REPLY"

read -p "Hours? "
hours="$REPLY"

read -p "CPUs? "
cpus="$REPLY"

read -p "Memory (gb)? "
mem_gb="$REPLY"
mem_kb=$(( mem_gb * 1024 * 1024 / cpus ))

read -p "X11? "
case $REPLY in
    y | yes | Y | YES)
    x11="--x11"
    ;;

    *)
    x11=""
    ;;
esac

if test -z "$x11"; then
    exec salloc --account="$acct" --nodes=1 --ntasks-per-node=1 --mem-per-cpu="$mem_kb"K --cpus-per-task="$cpus" --time="$hours":00:00
else
    exec salloc --account="$acct" --nodes=1 --ntasks-per-node=1 --mem-per-cpu="$mem_kb"K --cpus-per-task="$cpus" --time="$hours":00:00 --x11
fi