Skip to content

Instantly share code, notes, and snippets.

@parsa
Created March 16, 2020 16:48
Show Gist options
  • Save parsa/b5b28ac9705e9dafb8b74b56a0200eaa to your computer and use it in GitHub Desktop.
Save parsa/b5b28ac9705e9dafb8b74b56a0200eaa to your computer and use it in GitHub Desktop.

Revisions

  1. parsa created this gist Mar 16, 2020.
    14 changes: 14 additions & 0 deletions idev.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    # SLURM {{{ #
    function idev() {
    local nodes="1"
    if [[ "$(sinfo -h -o "%P")" =~ .*^$1$.* ]]; then
    local partition="$1"
    shift
    fi
    if [[ "$1" =~ [0-9]+ ]]; then
    nodes="$1"
    shift
    fi
    echo "Starting interactive job, ${partition+Partition: \"${partition}\", }Number of nodes: \"${nodes}\""${@:+, Arguments: \"${@}\"}
    srun ${partition+-p} $partition -N ${nodes} --pty "/bin/bash" -l "${@}"
    }