summaryrefslogtreecommitdiff
path: root/scripts/aimos
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/aimos')
-rwxr-xr-xscripts/aimos/alloc7
-rwxr-xr-xscripts/aimos/cnr28
-rwxr-xr-xscripts/aimos/getactivenode2
3 files changed, 37 insertions, 0 deletions
diff --git a/scripts/aimos/alloc b/scripts/aimos/alloc
new file mode 100755
index 0000000..46e23f6
--- /dev/null
+++ b/scripts/aimos/alloc
@@ -0,0 +1,7 @@
+#!/bin/bash
+if [ "$#" -ne 2 ]; then
+ echo "Provide two arguments (number of minutes to allocate)" >&2
+ exit 1
+fi
+
+salloc -N 1 --partition=$2 --gres=gpu:4 -t $1
diff --git a/scripts/aimos/cnr b/scripts/aimos/cnr
new file mode 100755
index 0000000..e8d5ce5
--- /dev/null
+++ b/scripts/aimos/cnr
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# cnr - compile and run
+
+path=$(realpath $1)
+out="$path.out"
+shift
+args="$@"
+
+
+# compile
+echo "===> COMPILING..."
+nvcc -g -G -gencode arch=compute_70,code=sm_70 "$path" -o "$out"
+if [[ $? -ne 0 ]]; then
+ exit 1
+fi
+echo "Success"
+
+# get node
+node=$(getactivenode)
+if [[ -z "$node" || "$node" == "(Priority)" || "$node" == "(Resources)" ]]; then
+ echo "No active nodes to run on, exiting."
+ exit 1
+fi
+
+# run
+echo "===> EXECUTING ON NODE $node ..."
+ssh $node "$out $args"
diff --git a/scripts/aimos/getactivenode b/scripts/aimos/getactivenode
new file mode 100755
index 0000000..b088853
--- /dev/null
+++ b/scripts/aimos/getactivenode
@@ -0,0 +1,2 @@
+#!/bin/bash
+squeue | awk 'NR > 1 {print $8; exit}'