From 5ec4156d9c96309caaf290e23fda2b5afb218ffc Mon Sep 17 00:00:00 2001 From: Rishi Sharma <rishi.sharma@epfl.ch> Date: Wed, 5 Oct 2022 11:04:47 +0200 Subject: [PATCH] Add tutorial --- tutorial/96_nodes_random1.edges | 547 +++++++++++++++++++++++++++++ tutorial/96_regular.edges | 381 ++++++++++++++++++++ tutorial/config_celeba_sharing.ini | 35 ++ tutorial/ip.json | 8 + tutorial/regular_16.txt | 49 +++ tutorial/run_decentralized.sh | 24 ++ tutorial/run_federated.sh | 27 ++ 7 files changed, 1071 insertions(+) create mode 100644 tutorial/96_nodes_random1.edges create mode 100644 tutorial/96_regular.edges create mode 100644 tutorial/config_celeba_sharing.ini create mode 100644 tutorial/ip.json create mode 100644 tutorial/regular_16.txt create mode 100755 tutorial/run_decentralized.sh create mode 100755 tutorial/run_federated.sh diff --git a/tutorial/96_nodes_random1.edges b/tutorial/96_nodes_random1.edges new file mode 100644 index 0000000..80a3867 --- /dev/null +++ b/tutorial/96_nodes_random1.edges @@ -0,0 +1,547 @@ +96 +0 1 +0 67 +0 68 +0 9 +0 82 +0 19 +0 52 +0 91 +0 95 +1 0 +1 66 +1 2 +1 29 +1 51 +1 91 +1 93 +2 1 +2 3 +2 8 +2 41 +2 14 +2 89 +2 27 +2 93 +3 2 +3 4 +3 8 +3 11 +3 44 +3 77 +3 93 +4 3 +4 5 +4 76 +4 81 +4 18 +4 19 +4 59 +4 29 +5 37 +5 4 +5 53 +5 6 +6 5 +6 7 +6 72 +6 40 +6 47 +6 90 +7 8 +7 90 +7 19 +7 6 +8 2 +8 3 +8 7 +8 41 +8 9 +8 77 +8 78 +8 21 +9 0 +9 8 +9 10 +9 21 +9 89 +9 91 +9 28 +10 80 +10 9 +10 11 +10 93 +11 3 +11 10 +11 12 +11 45 +11 80 +11 87 +12 33 +12 11 +12 13 +12 18 +12 53 +12 55 +13 65 +13 50 +13 12 +13 14 +14 2 +14 13 +14 15 +14 81 +14 52 +14 21 +14 58 +14 91 +15 16 +15 60 +15 29 +15 14 +16 33 +16 15 +16 17 +16 21 +16 24 +16 60 +17 16 +17 81 +17 18 +17 63 +18 4 +18 12 +18 17 +18 51 +18 19 +18 89 +18 29 +19 0 +19 4 +19 37 +19 7 +19 40 +19 47 +19 18 +19 20 +19 22 +19 58 +20 69 +20 76 +20 79 +20 19 +20 21 +20 86 +20 95 +21 34 +21 8 +21 9 +21 74 +21 14 +21 16 +21 20 +21 22 +22 19 +22 21 +22 23 +23 66 +23 82 +23 22 +23 24 +23 89 +23 94 +24 37 +24 38 +24 16 +24 84 +24 23 +24 25 +24 58 +24 27 +25 24 +25 26 +25 61 +26 25 +26 27 +26 69 +27 64 +27 33 +27 2 +27 87 +27 24 +27 26 +27 28 +27 31 +28 69 +28 9 +28 74 +28 27 +28 29 +29 1 +29 4 +29 43 +29 15 +29 18 +29 91 +29 28 +29 30 +30 31 +30 29 +30 55 +31 32 +31 75 +31 27 +31 30 +32 65 +32 33 +32 39 +32 84 +32 31 +33 32 +33 34 +33 67 +33 68 +33 12 +33 77 +33 16 +33 27 +34 33 +34 35 +34 70 +34 21 +34 89 +34 92 +34 61 +35 66 +35 34 +35 36 +35 83 +35 58 +36 67 +36 35 +36 37 +36 85 +36 88 +37 36 +37 5 +37 38 +37 51 +37 19 +37 24 +37 61 +38 37 +38 39 +38 77 +38 82 +38 24 +39 32 +39 38 +39 40 +39 74 +39 43 +39 81 +40 68 +40 6 +40 39 +40 41 +40 19 +40 61 +41 2 +41 8 +41 40 +41 42 +41 43 +41 81 +42 41 +42 43 +42 70 +43 39 +43 41 +43 42 +43 44 +43 29 +44 43 +44 3 +44 45 +45 70 +45 75 +45 11 +45 44 +45 78 +45 79 +45 46 +46 45 +46 47 +47 6 +47 75 +47 46 +47 48 +47 19 +48 73 +48 47 +48 49 +49 48 +49 50 +49 52 +50 13 +50 49 +50 83 +50 51 +50 89 +50 92 +51 1 +51 37 +51 70 +51 80 +51 81 +51 18 +51 50 +51 52 +51 87 +52 0 +52 66 +52 14 +52 49 +52 51 +52 53 +52 62 +52 95 +53 5 +53 71 +53 12 +53 83 +53 52 +53 54 +54 55 +54 53 +54 87 +55 12 +55 54 +55 56 +55 92 +55 30 +55 95 +56 80 +56 81 +56 55 +56 57 +56 91 +57 56 +57 89 +57 90 +57 58 +58 35 +58 71 +58 14 +58 19 +58 24 +58 57 +58 59 +59 58 +59 4 +59 60 +60 15 +60 16 +60 84 +60 59 +60 61 +61 34 +61 37 +61 40 +61 25 +61 60 +61 62 +62 52 +62 61 +62 63 +63 64 +63 17 +63 68 +63 62 +64 65 +64 27 +64 63 +65 32 +65 64 +65 66 +65 13 +65 87 +66 1 +66 65 +66 67 +66 35 +66 52 +66 23 +67 0 +67 33 +67 66 +67 36 +67 68 +67 94 +68 0 +68 33 +68 67 +68 69 +68 40 +68 88 +68 94 +68 63 +69 68 +69 70 +69 20 +69 26 +69 28 +70 34 +70 69 +70 71 +70 42 +70 45 +70 51 +71 72 +71 58 +71 53 +71 70 +72 73 +72 71 +72 6 +72 95 +73 48 +73 74 +73 72 +73 84 +74 39 +74 73 +74 75 +74 21 +74 28 +75 74 +75 76 +75 45 +75 47 +75 93 +75 31 +76 4 +76 75 +76 77 +76 20 +76 87 +76 88 +76 95 +77 33 +77 3 +77 38 +77 8 +77 76 +77 78 +78 8 +78 77 +78 45 +78 79 +79 45 +79 78 +79 80 +79 20 +79 94 +80 88 +80 10 +80 11 +80 79 +80 81 +80 51 +80 56 +80 91 +81 4 +81 39 +81 41 +81 14 +81 80 +81 17 +81 82 +81 51 +81 56 +82 0 +82 38 +82 81 +82 83 +82 23 +82 89 +83 35 +83 82 +83 50 +83 84 +83 53 +84 32 +84 73 +84 83 +84 85 +84 24 +84 60 +85 36 +85 86 +85 84 +86 20 +86 85 +86 87 +87 65 +87 11 +87 76 +87 51 +87 54 +87 86 +87 88 +87 27 +88 36 +88 68 +88 76 +88 80 +88 87 +88 89 +89 2 +89 34 +89 9 +89 18 +89 50 +89 82 +89 23 +89 88 +89 57 +89 90 +90 6 +90 7 +90 89 +90 91 +90 57 +91 0 +91 1 +91 9 +91 14 +91 80 +91 56 +91 90 +91 92 +91 29 +92 34 +92 50 +92 55 +92 91 +92 93 +93 1 +93 2 +93 3 +93 10 +93 75 +93 92 +93 94 +94 67 +94 68 +94 79 +94 23 +94 93 +94 95 +95 0 +95 72 +95 76 +95 20 +95 52 +95 55 +95 94 diff --git a/tutorial/96_regular.edges b/tutorial/96_regular.edges new file mode 100644 index 0000000..0db09a2 --- /dev/null +++ b/tutorial/96_regular.edges @@ -0,0 +1,381 @@ +96 +0 24 +0 1 +0 26 +0 95 +1 2 +1 0 +1 82 +1 83 +2 33 +2 90 +2 3 +2 1 +3 2 +3 4 +3 14 +3 79 +4 3 +4 12 +4 5 +4 86 +5 64 +5 42 +5 4 +5 6 +6 9 +6 5 +6 62 +6 7 +7 24 +7 8 +7 45 +7 6 +8 81 +8 17 +8 9 +8 7 +9 8 +9 10 +9 53 +9 6 +10 9 +10 11 +10 29 +10 31 +11 80 +11 10 +11 36 +11 12 +12 11 +12 4 +12 13 +12 70 +13 12 +13 53 +13 30 +13 14 +14 3 +14 15 +14 13 +14 47 +15 16 +15 26 +15 14 +16 41 +16 17 +16 15 +17 8 +17 16 +17 18 +17 83 +18 17 +18 19 +18 95 +18 63 +19 82 +19 18 +19 20 +19 22 +20 19 +20 59 +20 21 +20 22 +21 72 +21 58 +21 20 +21 22 +22 19 +22 20 +22 21 +22 23 +23 24 +23 65 +23 85 +23 22 +24 0 +24 25 +24 23 +24 7 +25 32 +25 24 +25 26 +25 38 +26 0 +26 25 +26 27 +26 15 +27 32 +27 26 +27 28 +27 63 +28 27 +28 92 +28 29 +28 39 +29 10 +29 52 +29 28 +29 30 +30 66 +30 29 +30 13 +30 31 +31 32 +31 10 +31 36 +31 30 +32 25 +32 27 +32 31 +32 33 +33 32 +33 2 +33 84 +33 34 +34 33 +34 50 +34 35 +34 93 +35 57 +35 34 +35 43 +35 36 +36 35 +36 11 +36 37 +36 31 +37 88 +37 36 +37 38 +37 79 +38 25 +38 37 +38 39 +38 49 +39 40 +39 28 +39 77 +39 38 +40 41 +40 91 +40 39 +40 87 +41 16 +41 40 +41 42 +41 51 +42 41 +42 43 +42 5 +43 42 +43 35 +43 44 +44 72 +44 43 +44 75 +44 45 +45 67 +45 44 +45 46 +45 7 +46 76 +46 45 +46 54 +46 47 +47 48 +47 65 +47 14 +47 46 +48 56 +48 49 +48 61 +48 47 +49 48 +49 50 +49 38 +49 71 +50 49 +50 34 +50 51 +50 93 +51 41 +51 50 +51 52 +51 95 +52 51 +52 74 +52 53 +52 29 +53 9 +53 52 +53 13 +53 54 +54 75 +54 53 +54 46 +54 55 +55 56 +55 69 +55 85 +55 54 +56 48 +56 57 +56 69 +56 55 +57 56 +57 89 +57 58 +57 35 +58 57 +58 59 +58 21 +58 86 +59 73 +59 58 +59 20 +59 60 +60 62 +60 59 +60 61 +60 78 +61 48 +61 62 +61 60 +61 94 +62 60 +62 61 +62 6 +62 63 +63 64 +63 18 +63 27 +63 62 +64 65 +64 84 +64 5 +64 63 +65 64 +65 66 +65 23 +65 47 +66 65 +66 89 +66 67 +66 30 +67 80 +67 66 +67 68 +67 45 +68 67 +68 92 +68 69 +68 94 +69 56 +69 68 +69 70 +69 55 +70 90 +70 12 +70 69 +70 71 +71 72 +71 49 +71 70 +71 87 +72 73 +72 44 +72 21 +72 71 +73 72 +73 91 +73 59 +73 74 +74 73 +74 75 +74 52 +74 76 +75 74 +75 44 +75 54 +75 76 +76 74 +76 75 +76 77 +76 46 +77 81 +77 76 +77 78 +77 39 +78 88 +78 60 +78 77 +78 79 +79 80 +79 3 +79 37 +79 78 +80 81 +80 67 +80 11 +80 79 +81 8 +81 82 +81 80 +81 77 +82 81 +82 1 +82 83 +82 19 +83 1 +83 82 +83 84 +83 17 +84 64 +84 33 +84 83 +84 85 +85 84 +85 55 +85 86 +85 23 +86 58 +86 4 +86 85 +86 87 +87 40 +87 88 +87 86 +87 71 +88 89 +88 37 +88 78 +88 87 +89 88 +89 57 +89 66 +89 90 +90 89 +90 2 +90 91 +90 70 +91 40 +91 73 +91 90 +91 92 +92 93 +92 91 +92 68 +92 28 +93 50 +93 34 +93 94 +93 92 +94 93 +94 68 +94 61 +94 95 +95 0 +95 18 +95 51 +95 94 diff --git a/tutorial/config_celeba_sharing.ini b/tutorial/config_celeba_sharing.ini new file mode 100644 index 0000000..020d006 --- /dev/null +++ b/tutorial/config_celeba_sharing.ini @@ -0,0 +1,35 @@ +[DATASET] +dataset_package = decentralizepy.datasets.CIFAR10 +dataset_class = CIFAR10 +model_class = LeNet +train_dir = /mnt/nfs/shared/CIFAR +test_dir = /mnt/nfs/shared/CIFAR +; python list of fractions below +sizes = +random_seed = 90 +partition_niid = True +shards = 4 + +[OPTIMIZER_PARAMS] +optimizer_package = torch.optim +optimizer_class = SGD +lr = 0.01 + +[TRAIN_PARAMS] +training_package = decentralizepy.training.Training +training_class = Training +rounds = 3 +full_epochs = False +batch_size = 8 +shuffle = True +loss_package = torch.nn +loss_class = CrossEntropyLoss + +[COMMUNICATION] +comm_package = decentralizepy.communication.TCP +comm_class = TCP +addresses_filepath = /mnt/nfs/risharma/Gitlab/tutorial/ip.json + +[SHARING] +sharing_package = decentralizepy.sharing.Sharing +sharing_class = Sharing diff --git a/tutorial/ip.json b/tutorial/ip.json new file mode 100644 index 0000000..12eb205 --- /dev/null +++ b/tutorial/ip.json @@ -0,0 +1,8 @@ +{ + "0": "10.90.41.128", + "1": "10.90.41.129", + "2": "10.90.41.130", + "3": "10.90.41.131", + "4": "10.90.41.132", + "5": "10.90.41.133" +} \ No newline at end of file diff --git a/tutorial/regular_16.txt b/tutorial/regular_16.txt new file mode 100644 index 0000000..32800c8 --- /dev/null +++ b/tutorial/regular_16.txt @@ -0,0 +1,49 @@ +16 +0 12 +0 14 +0 15 +1 8 +1 3 +1 6 +2 9 +2 10 +2 5 +3 1 +3 11 +3 9 +4 9 +4 12 +4 13 +5 2 +5 6 +5 7 +6 1 +6 5 +6 7 +7 5 +7 6 +7 14 +8 1 +8 13 +8 14 +9 2 +9 3 +9 4 +10 2 +10 11 +10 13 +11 10 +11 3 +11 15 +12 0 +12 4 +12 15 +13 8 +13 10 +13 4 +14 0 +14 8 +14 7 +15 0 +15 11 +15 12 diff --git a/tutorial/run_decentralized.sh b/tutorial/run_decentralized.sh new file mode 100755 index 0000000..2fdf386 --- /dev/null +++ b/tutorial/run_decentralized.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +decpy_path=/mnt/nfs/risharma/Gitlab/decentralizepy/eval +cd $decpy_path + +env_python=~/miniconda3/envs/decpy/bin/python3 +graph=/mnt/nfs/risharma/Gitlab/tutorial/96_regular.edges +original_config=/mnt/nfs/risharma/Gitlab/tutorial/config_celeba_sharing.ini +config_file=~/tmp/config.ini +procs_per_machine=16 +machines=6 +iterations=80 +test_after=20 +eval_file=testingPeerSampler.py +log_level=INFO + +m=`cat $(grep addresses_filepath $original_config | awk '{print $3}') | grep $(/sbin/ifconfig ens785 | grep 'inet ' | awk '{print $2}') | cut -d'"' -f2` +echo M is $m +log_dir=$(date '+%Y-%m-%dT%H:%M')/machine$m +mkdir -p $log_dir + +cp $original_config $config_file +# echo "alpha = 0.10" >> $config_file +$env_python $eval_file -ro 0 -tea $test_after -ld $log_dir -mid $m -ps $procs_per_machine -ms $machines -is $iterations -gf $graph -ta $test_after -cf $config_file -ll $log_level -ctr 0 -cte 0 -wsd $log_dir \ No newline at end of file diff --git a/tutorial/run_federated.sh b/tutorial/run_federated.sh new file mode 100755 index 0000000..dfe360b --- /dev/null +++ b/tutorial/run_federated.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +decpy_path=/mnt/nfs/risharma/Gitlab/decentralizepy/eval +cd $decpy_path + +env_python=~/miniconda3/envs/decpy/bin/python3 +graph=/mnt/nfs/risharma/Gitlab/tutorial/96_regular.edges +original_config=/mnt/nfs/risharma/Gitlab/tutorial/config_celeba_sharing.ini +config_file=~/tmp/config.ini +procs_per_machine=16 +machines=6 +iterations=80 +test_after=20 +eval_file=testingFederated.py +log_level=INFO +server_rank=-1 +server_machine=0 +working_rate=0.5 + +m=`cat $(grep addresses_filepath $original_config | awk '{print $3}') | grep $(/sbin/ifconfig ens785 | grep 'inet ' | awk '{print $2}') | cut -d'"' -f2` +echo M is $m +log_dir=$(date '+%Y-%m-%dT%H:%M')/machine$m +mkdir -p $log_dir + +cp $original_config $config_file +# echo "alpha = 0.10" >> $config_file +$env_python $eval_file -ro 0 -tea $test_after -ld $log_dir -mid $m -ps $procs_per_machine -ms $machines -is $iterations -gf $graph -ta $test_after -cf $config_file -ll $log_level -ctr 0 -cte 0 -wsd $log_dir -sm $server_machine -sr $server_rank -wr $working_rate \ No newline at end of file -- GitLab