Skip to content

Commit

Permalink
Adding an example that can launch with SLURM (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
kephale authored Jun 6, 2017
1 parent 88ad87e commit a3c4cc2
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject brevis "0.10.3"
(defproject brevis "0.10.4-SNAPSHOT"
:description "A Functional Scientific and Artificial Life Simulator"
:url "http://brevis.us"
:license {:name "Apache License v2"
Expand Down
40 changes: 40 additions & 0 deletions src/brevis/distributed_computing/slurm_test.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
(ns brevis.distributed-computing.slurm-test
(:use [clojure.test])
(:require [brevis.distributed-computing.slurm :as slurm]
[brevis.distributed-computing.dc-utils :as dc-utils]))

(defn -main [& args]
(let [;; First put everything into a map
argmap (apply hash-map
(mapcat #(vector (read-string (first %)) (second %) #_(read-string (second %)))
(partition 2 args)))
;; Then read-string on *some* args, but ignore others
argmap (apply hash-map
(apply concat
(for [[k v] argmap]
[k (cond (= k :output-file) v
:else (read-string v))])))]
(println argmap)
(spit (:output-file argmap)
(with-out-str
(println "Slurm test")
(println argmap)))))

(defn cluster-launch-slurm
[]
(let [experiment-name "slurm_test_001"
argmaps [{:tag "testrun"
:output-file "testfile.txt"}]]
(dotimes [k (count argmaps)]
(let [argmap (nth argmaps k)
experiment-name (str experiment-name "_" k)]
(slurm/start-runs
[argmap]
"brevis.distributed-computing.slurm-test"
experiment-name
"kharrington"
"fortyfour.ibest.uidaho.edu"
1
"/Users/kharrington/git/brevis/"
"brevis_dir/"
"00:05:00")))))

0 comments on commit a3c4cc2

Please sign in to comment.