From b5c9f14deaee0139f779c6662f90adbe0a7bbdea Mon Sep 17 00:00:00 2001 From: Erick Lavoie <erick.lavoie@epfl.ch> Date: Tue, 28 Sep 2021 12:23:06 +0200 Subject: [PATCH] Added scripts for intro --- .../intro-mnist-2-shards-eq-classes-fc.sh | 38 ++++++++++++++++++ .../intro-mnist-2-shards-eq-classes-grid.sh | 39 +++++++++++++++++++ .../intro-mnist-2-shards-eq-classes-ring.sh | 39 +++++++++++++++++++ results-v2/intro-mnist-iid-eq-classes-fc.sh | 38 ++++++++++++++++++ results-v2/intro-mnist-iid-eq-classes-grid.sh | 39 +++++++++++++++++++ results-v2/intro-mnist-iid-eq-classes-ring.sh | 39 +++++++++++++++++++ results-v2/intro-mnist-max-local-skew-fc.sh | 38 ++++++++++++++++++ results-v2/intro-mnist-max-local-skew-grid.sh | 39 +++++++++++++++++++ results-v2/intro-mnist-max-local-skew-ring.sh | 39 +++++++++++++++++++ results-v2/mnist/grid/iid/experiments.sh | 5 ++- results-v2/mnist/ring/iid/experiments.sh | 16 +++++--- results-v2/mnist/ring/non-iid/experiments.sh | 7 +++- 12 files changed, 366 insertions(+), 10 deletions(-) create mode 100755 results-v2/intro-mnist-2-shards-eq-classes-fc.sh create mode 100755 results-v2/intro-mnist-2-shards-eq-classes-grid.sh create mode 100755 results-v2/intro-mnist-2-shards-eq-classes-ring.sh create mode 100755 results-v2/intro-mnist-iid-eq-classes-fc.sh create mode 100755 results-v2/intro-mnist-iid-eq-classes-grid.sh create mode 100755 results-v2/intro-mnist-iid-eq-classes-ring.sh create mode 100755 results-v2/intro-mnist-max-local-skew-fc.sh create mode 100755 results-v2/intro-mnist-max-local-skew-grid.sh create mode 100755 results-v2/intro-mnist-max-local-skew-ring.sh diff --git a/results-v2/intro-mnist-2-shards-eq-classes-fc.sh b/results-v2/intro-mnist-2-shards-eq-classes-fc.sh new file mode 100755 index 0000000..dc3fa5f --- /dev/null +++ b/results-v2/intro-mnist-2-shards-eq-classes-fc.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +# Path to current script +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +TOOLS=$SCRIPT_DIR/$(cat toolspath); cd $TOOLS + +# Add current working directory to executable namespace +export PATH=$PATH:$TOOLS +# Setup root directory for resolution of imports: +# the path of all local python libraries are relative to this +export PYTHONPATH=$TOOLS + +# Each command outputs the run directory, which is then used +# by the next command to add parameters and generate information +# used by the simulator. For a list of available options for each +# command, run 'export PYTHONPATH=.; <command> --help'. +for SEED in 1 2 3; do +setup/meta.py \ + --results-directory $SCRIPT_DIR/tmp \ + --seed $SEED | +setup/dataset.py \ + --name mnist \ + --train-examples-per-class 4500 4500 4500 4500 4500 4500 4500 4500 4500 4500 | +setup/nodes/google-fl.py \ + --name 2-shards-eq-classes \ + --nb-nodes 100 \ + --local-shards 2 \ + --shard-size 225 | +setup/topology/fully-connected.py | +setup/model/linear.py | +simulate/algorithm/d_sgd.py \ + --batch-size 128 \ + --learning-momentum 0.0 \ + --learning-rate 0.1 | +simulate/logger.py \ + --nb-processes 8 | +simulate/run.py \ + --nb-epochs 100; +done diff --git a/results-v2/intro-mnist-2-shards-eq-classes-grid.sh b/results-v2/intro-mnist-2-shards-eq-classes-grid.sh new file mode 100755 index 0000000..dae95c6 --- /dev/null +++ b/results-v2/intro-mnist-2-shards-eq-classes-grid.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# Path to current script +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +TOOLS=$SCRIPT_DIR/$(cat toolspath); cd $TOOLS + +# Add current working directory to executable namespace +export PATH=$PATH:$TOOLS +# Setup root directory for resolution of imports: +# the path of all local python libraries are relative to this +export PYTHONPATH=$TOOLS + +# Each command outputs the run directory, which is then used +# by the next command to add parameters and generate information +# used by the simulator. For a list of available options for each +# command, run 'export PYTHONPATH=.; <command> --help'. +for SEED in 1 2 3; do +setup/meta.py \ + --results-directory $SCRIPT_DIR/tmp \ + --seed $SEED | +setup/dataset.py \ + --name mnist \ + --train-examples-per-class 4500 4500 4500 4500 4500 4500 4500 4500 4500 4500 | +setup/nodes/google-fl.py \ + --name 2-shards-eq-classes \ + --nb-nodes 100 \ + --local-shards 2 \ + --shard-size 225 | +setup/topology/grid.py \ + --metric random | +setup/model/linear.py | +simulate/algorithm/d_sgd.py \ + --batch-size 128 \ + --learning-momentum 0.0 \ + --learning-rate 0.1 | +simulate/logger.py \ + --nb-processes 8 | +simulate/run.py \ + --nb-epochs 100; +done diff --git a/results-v2/intro-mnist-2-shards-eq-classes-ring.sh b/results-v2/intro-mnist-2-shards-eq-classes-ring.sh new file mode 100755 index 0000000..60e8056 --- /dev/null +++ b/results-v2/intro-mnist-2-shards-eq-classes-ring.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# Path to current script +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +TOOLS=$SCRIPT_DIR/$(cat toolspath); cd $TOOLS + +# Add current working directory to executable namespace +export PATH=$PATH:$TOOLS +# Setup root directory for resolution of imports: +# the path of all local python libraries are relative to this +export PYTHONPATH=$TOOLS + +# Each command outputs the run directory, which is then used +# by the next command to add parameters and generate information +# used by the simulator. For a list of available options for each +# command, run 'export PYTHONPATH=.; <command> --help'. +for SEED in 1 2 3; do +setup/meta.py \ + --results-directory $SCRIPT_DIR/tmp \ + --seed $SEED | +setup/dataset.py \ + --name mnist \ + --train-examples-per-class 4500 4500 4500 4500 4500 4500 4500 4500 4500 4500 | +setup/nodes/google-fl.py \ + --name 2-shards-eq-classes \ + --nb-nodes 100 \ + --local-shards 2 \ + --shard-size 225 | +setup/topology/ring.py \ + --metric random | +setup/model/linear.py | +simulate/algorithm/d_sgd.py \ + --batch-size 128 \ + --learning-momentum 0.0 \ + --learning-rate 0.1 | +simulate/logger.py \ + --nb-processes 8 | +simulate/run.py \ + --nb-epochs 100; +done diff --git a/results-v2/intro-mnist-iid-eq-classes-fc.sh b/results-v2/intro-mnist-iid-eq-classes-fc.sh new file mode 100755 index 0000000..4ed9f6b --- /dev/null +++ b/results-v2/intro-mnist-iid-eq-classes-fc.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +# Path to current script +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +TOOLS=$SCRIPT_DIR/$(cat toolspath); cd $TOOLS + +# Add current working directory to executable namespace +export PATH=$PATH:$TOOLS +# Setup root directory for resolution of imports: +# the path of all local python libraries are relative to this +export PYTHONPATH=$TOOLS + +# Each command outputs the run directory, which is then used +# by the next command to add parameters and generate information +# used by the simulator. For a list of available options for each +# command, run 'export PYTHONPATH=.; <command> --help'. +for SEED in 1 2 3; do +setup/meta.py \ + --results-directory $SCRIPT_DIR/tmp \ + --seed $SEED | +setup/dataset.py \ + --name mnist \ + --train-examples-per-class 4500 4500 4500 4500 4500 4500 4500 4500 4500 4500 | +setup/nodes.py \ + --name iid-eq-classes \ + --nb-nodes 100 \ + --local-classes 10 \ + --nodes-per-class 100 100 100 100 100 100 100 100 100 100 | +setup/topology/fully-connected.py | +setup/model/linear.py | +simulate/algorithm/d_sgd.py \ + --batch-size 128 \ + --learning-momentum 0.0 \ + --learning-rate 0.1 | +simulate/logger.py \ + --nb-processes 8 | +simulate/run.py \ + --nb-epochs 100; +done diff --git a/results-v2/intro-mnist-iid-eq-classes-grid.sh b/results-v2/intro-mnist-iid-eq-classes-grid.sh new file mode 100755 index 0000000..b7ac1f8 --- /dev/null +++ b/results-v2/intro-mnist-iid-eq-classes-grid.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# Path to current script +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +TOOLS=$SCRIPT_DIR/$(cat toolspath); cd $TOOLS + +# Add current working directory to executable namespace +export PATH=$PATH:$TOOLS +# Setup root directory for resolution of imports: +# the path of all local python libraries are relative to this +export PYTHONPATH=$TOOLS + +# Each command outputs the run directory, which is then used +# by the next command to add parameters and generate information +# used by the simulator. For a list of available options for each +# command, run 'export PYTHONPATH=.; <command> --help'. +for SEED in 1 2 3; do +setup/meta.py \ + --results-directory $SCRIPT_DIR/tmp \ + --seed $SEED | +setup/dataset.py \ + --name mnist \ + --train-examples-per-class 4500 4500 4500 4500 4500 4500 4500 4500 4500 4500 | +setup/nodes.py \ + --name iid-eq-classes \ + --nb-nodes 100 \ + --local-classes 10 \ + --nodes-per-class 100 100 100 100 100 100 100 100 100 100 | +setup/topology/grid.py \ + --metric random | +setup/model/linear.py | +simulate/algorithm/d_sgd.py \ + --batch-size 128 \ + --learning-momentum 0.0 \ + --learning-rate 0.1 | +simulate/logger.py \ + --nb-processes 8 | +simulate/run.py \ + --nb-epochs 100; +done diff --git a/results-v2/intro-mnist-iid-eq-classes-ring.sh b/results-v2/intro-mnist-iid-eq-classes-ring.sh new file mode 100755 index 0000000..5c1ff97 --- /dev/null +++ b/results-v2/intro-mnist-iid-eq-classes-ring.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# Path to current script +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +TOOLS=$SCRIPT_DIR/$(cat toolspath); cd $TOOLS + +# Add current working directory to executable namespace +export PATH=$PATH:$TOOLS +# Setup root directory for resolution of imports: +# the path of all local python libraries are relative to this +export PYTHONPATH=$TOOLS + +# Each command outputs the run directory, which is then used +# by the next command to add parameters and generate information +# used by the simulator. For a list of available options for each +# command, run 'export PYTHONPATH=.; <command> --help'. +for SEED in 1 2 3; do +setup/meta.py \ + --results-directory $SCRIPT_DIR/tmp \ + --seed $SEED | +setup/dataset.py \ + --name mnist \ + --train-examples-per-class 4500 4500 4500 4500 4500 4500 4500 4500 4500 4500 | +setup/nodes.py \ + --name iid-eq-classes \ + --nb-nodes 100 \ + --local-classes 10 \ + --nodes-per-class 100 100 100 100 100 100 100 100 100 100 | +setup/topology/ring.py \ + --metric random | +setup/model/linear.py | +simulate/algorithm/d_sgd.py \ + --batch-size 128 \ + --learning-momentum 0.0 \ + --learning-rate 0.1 | +simulate/logger.py \ + --nb-processes 8 | +simulate/run.py \ + --nb-epochs 100; +done diff --git a/results-v2/intro-mnist-max-local-skew-fc.sh b/results-v2/intro-mnist-max-local-skew-fc.sh new file mode 100755 index 0000000..12af7bb --- /dev/null +++ b/results-v2/intro-mnist-max-local-skew-fc.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +# Path to current script +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +TOOLS=$SCRIPT_DIR/$(cat toolspath); cd $TOOLS + +# Add current working directory to executable namespace +export PATH=$PATH:$TOOLS +# Setup root directory for resolution of imports: +# the path of all local python libraries are relative to this +export PYTHONPATH=$TOOLS + +# Each command outputs the run directory, which is then used +# by the next command to add parameters and generate information +# used by the simulator. For a list of available options for each +# command, run 'export PYTHONPATH=.; <command> --help'. +for SEED in 1 2 3; do +setup/meta.py \ + --results-directory $SCRIPT_DIR/tmp \ + --seed $SEED | +setup/dataset.py \ + --name mnist \ + --train-examples-per-class 4500 4500 4500 4500 4500 4500 4500 4500 4500 4500 | +setup/nodes.py \ + --name max-local-skew \ + --nb-nodes 100 \ + --local-classes 1 \ + --nodes-per-class 10 10 10 10 10 10 10 10 10 10 | +setup/topology/fully-connected.py | +setup/model/linear.py | +simulate/algorithm/d_sgd.py \ + --batch-size 128 \ + --learning-momentum 0.0 \ + --learning-rate 0.1 | +simulate/logger.py \ + --nb-processes 8 | +simulate/run.py \ + --nb-epochs 100; +done diff --git a/results-v2/intro-mnist-max-local-skew-grid.sh b/results-v2/intro-mnist-max-local-skew-grid.sh new file mode 100755 index 0000000..7846d94 --- /dev/null +++ b/results-v2/intro-mnist-max-local-skew-grid.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# Path to current script +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +TOOLS=$SCRIPT_DIR/$(cat toolspath); cd $TOOLS + +# Add current working directory to executable namespace +export PATH=$PATH:$TOOLS +# Setup root directory for resolution of imports: +# the path of all local python libraries are relative to this +export PYTHONPATH=$TOOLS + +# Each command outputs the run directory, which is then used +# by the next command to add parameters and generate information +# used by the simulator. For a list of available options for each +# command, run 'export PYTHONPATH=.; <command> --help'. +for SEED in 1 2 3; do +setup/meta.py \ + --results-directory $SCRIPT_DIR/tmp \ + --seed $SEED | +setup/dataset.py \ + --name mnist \ + --train-examples-per-class 4500 4500 4500 4500 4500 4500 4500 4500 4500 4500 | +setup/nodes.py \ + --name max-local-skew \ + --nb-nodes 100 \ + --local-classes 1 \ + --nodes-per-class 10 10 10 10 10 10 10 10 10 10 | +setup/topology/grid.py \ + --metric random | +setup/model/linear.py | +simulate/algorithm/d_sgd.py \ + --batch-size 128 \ + --learning-momentum 0.0 \ + --learning-rate 0.1 | +simulate/logger.py \ + --nb-processes 8 | +simulate/run.py \ + --nb-epochs 100; +done diff --git a/results-v2/intro-mnist-max-local-skew-ring.sh b/results-v2/intro-mnist-max-local-skew-ring.sh new file mode 100755 index 0000000..35eeb14 --- /dev/null +++ b/results-v2/intro-mnist-max-local-skew-ring.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# Path to current script +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +TOOLS=$SCRIPT_DIR/$(cat toolspath); cd $TOOLS + +# Add current working directory to executable namespace +export PATH=$PATH:$TOOLS +# Setup root directory for resolution of imports: +# the path of all local python libraries are relative to this +export PYTHONPATH=$TOOLS + +# Each command outputs the run directory, which is then used +# by the next command to add parameters and generate information +# used by the simulator. For a list of available options for each +# command, run 'export PYTHONPATH=.; <command> --help'. +for SEED in 1 2 3; do +setup/meta.py \ + --results-directory $SCRIPT_DIR/tmp \ + --seed $SEED | +setup/dataset.py \ + --name mnist \ + --train-examples-per-class 4500 4500 4500 4500 4500 4500 4500 4500 4500 4500 | +setup/nodes.py \ + --name max-local-skew \ + --nb-nodes 100 \ + --local-classes 1 \ + --nodes-per-class 10 10 10 10 10 10 10 10 10 10 | +setup/topology/ring.py \ + --metric random | +setup/model/linear.py | +simulate/algorithm/d_sgd.py \ + --batch-size 128 \ + --learning-momentum 0.0 \ + --learning-rate 0.1 | +simulate/logger.py \ + --nb-processes 8 | +simulate/run.py \ + --nb-epochs 100; +done diff --git a/results-v2/mnist/grid/iid/experiments.sh b/results-v2/mnist/grid/iid/experiments.sh index 875acd3..16464ba 100755 --- a/results-v2/mnist/grid/iid/experiments.sh +++ b/results-v2/mnist/grid/iid/experiments.sh @@ -18,7 +18,7 @@ setup/meta.py \ --seed 1 | setup/dataset.py \ --name mnist \ - --global-train-ratios 0.802568 0.802568 0.802568 0.802568 0.802568 0.802568 0.802568 0.802568 0.802568 0.802568 | + --train-examples-per-class 4500 4500 4500 4500 4500 4500 4500 4500 4500 4500 | setup/nodes.py \ --nb-nodes 100 \ --local-classes 10 \ @@ -30,6 +30,7 @@ simulate/algorithm/d_sgd.py \ --batch-size 128 \ --learning-momentum 0.0 \ --learning-rate 0.1 | -simulate/logger.py | +simulate/logger.py \ + --accuracy-logging-interval 10 | simulate/run.py \ --nb-epochs 100 diff --git a/results-v2/mnist/ring/iid/experiments.sh b/results-v2/mnist/ring/iid/experiments.sh index 93b1047..e24b85c 100755 --- a/results-v2/mnist/ring/iid/experiments.sh +++ b/results-v2/mnist/ring/iid/experiments.sh @@ -9,16 +9,18 @@ export PATH=$PATH:$TOOLS # the path of all local python libraries are relative to this export PYTHONPATH=$TOOLS +for LR in 0.04 0.05; do # Each command outputs the run directory, which is then used # by the next command to add parameters and generate information # used by the simulator. For a list of available options for each # command, run 'export PYTHONPATH=.; <command> --help'. setup/meta.py \ - --results-directory $SCRIPT_DIR/all \ + --results-directory $SCRIPT_DIR/test \ --seed 1 | setup/dataset.py \ --name mnist \ - --global-train-ratios 0.802568 0.802568 0.802568 0.802568 0.802568 0.802568 0.802568 0.802568 0.802568 0.802568 | + --train-examples-per-class 4500 4500 4500 4500 4500 4500 4500 4500 4500 4500 | + #--global-train-ratios 0.802568 0.802568 0.802568 0.802568 0.802568 0.802568 0.802568 0.802568 0.802568 0.802568 | setup/nodes.py \ --nb-nodes 100 \ --local-classes 10 \ @@ -29,8 +31,10 @@ setup/model/linear.py | simulate/algorithm/d_sgd.py \ --batch-size 128 \ --learning-momentum 0.0 \ - --learning-rate 0.1 | -simulate/logger.py | + --learning-rate $LR | +simulate/logger.py \ + --accuracy-logging-interval 5 \ + --nb-processes 2 | simulate/run.py \ - --nb-epochs 100 - + --nb-epochs 20; +done diff --git a/results-v2/mnist/ring/non-iid/experiments.sh b/results-v2/mnist/ring/non-iid/experiments.sh index 205028c..6c24f1d 100755 --- a/results-v2/mnist/ring/non-iid/experiments.sh +++ b/results-v2/mnist/ring/non-iid/experiments.sh @@ -18,7 +18,8 @@ setup/meta.py \ --seed 1 | setup/dataset.py \ --name mnist \ - --global-train-ratios 0.802568 0.802568 0.802568 0.802568 0.802568 0.802568 0.802568 0.802568 0.802568 0.802568 | + --train-examples-per-class 4500 4500 4500 4500 4500 4500 4500 4500 4500 4500 | + #--global-train-ratios 0.802568 0.802568 0.802568 0.802568 0.802568 0.802568 0.802568 0.802568 0.802568 0.802568 | setup/nodes.py \ --nb-nodes 100 \ --local-classes 1 \ @@ -30,6 +31,8 @@ simulate/algorithm/d_sgd.py \ --batch-size 128 \ --learning-momentum 0.0 \ --learning-rate 0.1 | -simulate/logger.py | +simulate/logger.py \ + --accuracy-logging-interval 5 \ + --nb-processes 2 | simulate/run.py \ --nb-epochs 100 -- GitLab