From 928cb1a0e6a4b516854c9ed6d71bb41b51132579 Mon Sep 17 00:00:00 2001 From: Mark Evenson Date: Sun, 4 Sep 2022 12:33:53 +0200 Subject: [PATCH] Possible to run simulation asynchronously But the async version causes panics thread 'main' panicked at 'could not create DataFrame from iterator: Duplicate("Column with name: '1' has more than one occurrences")', /Users/evenson/.cargo/registry/src/github.com-1ecc6299db9ec823/polars-core-0.22.7/src/frame/upstream_traits.rs:11:27 --- mevenson/simulation/glacier.lisp | 1 + mevenson/simulation/runner.lisp | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/mevenson/simulation/glacier.lisp b/mevenson/simulation/glacier.lisp index fbfbceb..5a9e98a 100644 --- a/mevenson/simulation/glacier.lisp +++ b/mevenson/simulation/glacier.lisp @@ -23,6 +23,7 @@ ("distribution" :OBJ ("honest" . 1) ("infantile" . 0) ("random" . 0) ("omniscient" . 0))) ("wards" (:OBJ ("time_to_finality" :OBJ ("ttf_threshold" . 100)))) + ("simulation_style" . "Sync") ("network_modifiers" (:OBJ ("random_drop" :OBJ ("drop_rate" . 0)))))) ;;; N.b. assumes that all JSON keys are 1) lowercase, and 2) unique diff --git a/mevenson/simulation/runner.lisp b/mevenson/simulation/runner.lisp index 8519cb9..0a953af 100644 --- a/mevenson/simulation/runner.lisp +++ b/mevenson/simulation/runner.lisp @@ -94,4 +94,21 @@ template." `(($.byzantine_settings.total_size ,(expt 10 4)) ($.distribution.yes ,(coerce yes 'single-float)) ($.distribution.no ,(coerce no 'single-float)))))) - + +(defun search-parameters-async () + "A parameter search run" + ;; not exactly sure why something like + ;; (loop :for yes :from 0.4 :to 0.6 :by 0.05… has rounding problems + ;; + (loop :for yes :from 2/5 :to 3/5 :by 1/20 + :for no :from 3/5 :downto 2/5 :by 1/20 + :doing + (run 10 + :parameters + `(($.byzantine_settings.total_size ,(expt 10 3)) + ($.distribution.yes ,(coerce yes 'single-float)) + ($.simulation_style (:obj ("Async" :obj ("chunks" . 20)))) + ($.distribution.no ,(coerce no 'single-float)))))) + + +