#!/usr/bin/env bash

# ========================================
# This file must be sourced, NOT executed!
# ========================================

JOB_NAME="interactive_node"
GPUS_PER_NODE=8
NODES=1
NTASKS=8
PARTITION="gpu"
ACCOUNT="???"
TIME="6:00:00"
CONF_FILE="$HOME/.internode_vars"

# Allocate interactive node with the set variables above.
salloc \
    --gpus-per-node=$GPUS_PER_NODE \
    --exclusive \
    --nodes=$NODES \
    --ntasks=$NTASKS \
    --partition=$PARTITION \
    --account=$ACCOUNT \
    --time=$TIME \
    --mem=0 \
    --job-name=$JOB_NAME \
    --q dev

# Create new config file.
rm -f $CONF_FILE
touch $CONF_FILE

# Store the variables set by the salloc call in the config file.
env | grep SLURM >> $CONF_FILE

