Skip to content

Instantly share code, notes, and snippets.

@klmr
Last active March 31, 2017 16:02
Show Gist options
  • Save klmr/461c303862ec4cf5ac4dd6947911457d to your computer and use it in GitHub Desktop.
Save klmr/461c303862ec4cf5ac4dd6947911457d to your computer and use it in GitHub Desktop.
R launcher for Nvim-R on an LSF cluster
#!/usr/bin/env bash
while getopts ":n:c:q:" option; do
case "$option" in
n)
cores="$OPTARG"
;;
m)
mem="$OPTARG"
;;
q)
queue="$OPTARG"
;;
*)
break
esac
done
shift $(($OPTIND - 1))
mem=${mem-12000}
cores=${cores-4}
queue=${queue-long}
bsub -q$queue -Is -n$cores -M$mem -R "span[hosts=1] select[mem>$mem] rusage[mem=$mem]" "$(which R) $@"

Nvim-R R launcher on an LSF cluster

Usage

Configure Nvim-R inside ~/.vimrc as follows:

let R_path = "~/.R" " or whatever
let R_launcher = "r-launcher.sh"

To launch R, either use the default options and <leader>rf, or perform a custom launch with <leader>rc and enter the desired command line options, .e.g.

-n2 --quiet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment