2023-02-24 18:08:41 +00:00
|
|
|
"""Example configuration file
|
|
|
|
|
|
|
|
This file illustrates how to define options and simulation parameter ranges.
|
|
|
|
It also defines the traversal order of the simulation space. As the file
|
|
|
|
extension suggests, configuration is pure python code, allowing complex
|
|
|
|
setups. Use at your own risk.
|
|
|
|
|
|
|
|
To use this example, run
|
|
|
|
python3 study.py config_example
|
|
|
|
|
|
|
|
Otherwise copy it and modify as needed. The default traversal order defined
|
|
|
|
in the nested loop of nextShape() is good for most cases, but customizable
|
|
|
|
if needed.
|
|
|
|
"""
|
|
|
|
|
|
|
|
import logging
|
2023-03-06 21:46:17 +00:00
|
|
|
import itertools
|
2023-03-07 12:24:11 +00:00
|
|
|
import numpy as np
|
2023-02-24 18:08:41 +00:00
|
|
|
from DAS.shape import Shape
|
|
|
|
|
|
|
|
dumpXML = 1
|
2023-04-21 09:45:17 +00:00
|
|
|
|
|
|
|
# save progress vectors to XML
|
|
|
|
saveProgress = 1
|
|
|
|
|
|
|
|
# plot progress for each run to PNG
|
|
|
|
plotProgress = 1
|
|
|
|
|
2023-02-24 18:08:41 +00:00
|
|
|
visualization = 1
|
|
|
|
logLevel = logging.INFO
|
|
|
|
|
2023-03-13 13:22:14 +00:00
|
|
|
# number of parallel workers. -1: all cores; 1: sequential
|
|
|
|
# for more details, see joblib.Parallel
|
2023-03-30 11:24:30 +00:00
|
|
|
numJobs = -1
|
2023-02-24 18:08:41 +00:00
|
|
|
|
2023-03-06 14:15:57 +00:00
|
|
|
# distribute rows/columns evenly between validators (True)
|
|
|
|
# or generate it using local randomness (False)
|
2023-03-23 19:10:27 +00:00
|
|
|
evenLineDistribution = True
|
2023-03-06 14:15:57 +00:00
|
|
|
|
2023-02-24 18:08:41 +00:00
|
|
|
# Number of simulation runs with the same parameters for statistical relevance
|
2023-03-30 11:24:30 +00:00
|
|
|
runs = range(3)
|
2023-02-24 18:08:41 +00:00
|
|
|
|
|
|
|
# Number of validators
|
2023-04-21 09:45:17 +00:00
|
|
|
numberNodes = range(128, 513, 128)
|
2023-02-24 18:08:41 +00:00
|
|
|
|
|
|
|
# Percentage of block not released by producer
|
2023-04-21 09:45:17 +00:00
|
|
|
failureRates = range(40, 81, 20)
|
2023-02-24 18:08:41 +00:00
|
|
|
|
|
|
|
# Block size in one dimension in segments. Block is blockSizes * blockSizes segments.
|
2023-04-21 09:45:17 +00:00
|
|
|
blockSizes = range(64, 113, 128)
|
2023-02-24 18:08:41 +00:00
|
|
|
|
|
|
|
# Per-topic mesh neighborhood size
|
2023-04-21 09:45:17 +00:00
|
|
|
netDegrees = range(8, 9, 2)
|
2023-02-24 18:08:41 +00:00
|
|
|
|
2023-03-13 14:00:43 +00:00
|
|
|
# number of rows and columns a validator is interested in
|
2023-04-21 09:45:17 +00:00
|
|
|
chis = range(2, 3, 2)
|
2023-03-13 14:00:43 +00:00
|
|
|
|
|
|
|
# ratio of class1 nodes (see below for parameters per class)
|
2023-04-21 09:45:17 +00:00
|
|
|
class1ratios = [0.8]
|
2023-03-07 12:24:11 +00:00
|
|
|
|
2023-03-13 14:00:43 +00:00
|
|
|
# Number of validators per beacon node
|
2023-04-21 09:45:17 +00:00
|
|
|
validatorsPerNode1 = [2]
|
|
|
|
validatorsPerNode2 = [4]
|
2023-02-24 18:08:41 +00:00
|
|
|
|
2023-03-03 17:41:12 +00:00
|
|
|
# Set uplink bandwidth. In segments (~560 bytes) per timestep (50ms?)
|
|
|
|
# 1 Mbps ~= 1e6 / 20 / 8 / 560 ~= 11
|
2023-03-07 12:24:11 +00:00
|
|
|
bwUplinksProd = [2200]
|
2023-03-13 14:27:23 +00:00
|
|
|
bwUplinks1 = [110]
|
|
|
|
bwUplinks2 = [2200]
|
2023-03-03 17:41:12 +00:00
|
|
|
|
2023-03-15 12:18:02 +00:00
|
|
|
# Set to True if you want your run to be deterministic, False if not
|
2023-03-30 11:24:30 +00:00
|
|
|
deterministic = True
|
2023-02-24 18:08:41 +00:00
|
|
|
|
2023-03-15 12:18:02 +00:00
|
|
|
# If your run is deterministic you can decide the random seed. This is ignore otherwise.
|
|
|
|
randomSeed = "DAS"
|
|
|
|
|
2023-04-21 09:45:17 +00:00
|
|
|
saveProgress = 1
|
|
|
|
saveRCdist = 1
|
|
|
|
|
|
|
|
# If True, print diagnostics when the block is not available
|
|
|
|
diagnostics = False
|
|
|
|
|
|
|
|
# Number of steps without progress to stop simulation
|
|
|
|
steps4StopCondition = 7
|
|
|
|
|
|
|
|
saveGit = False
|
|
|
|
|
|
|
|
successCondition = 0.9
|
|
|
|
stepDuration = 50
|
|
|
|
|
2023-02-24 18:08:41 +00:00
|
|
|
def nextShape():
|
2023-03-13 14:03:55 +00:00
|
|
|
for run, fr, class1ratio, chi, vpn1, vpn2, blockSize, nn, netDegree, bwUplinkProd, bwUplink1, bwUplink2 in itertools.product(
|
|
|
|
runs, failureRates, class1ratios, chis, validatorsPerNode1, validatorsPerNode2, blockSizes, numberNodes, netDegrees, bwUplinksProd, bwUplinks1, bwUplinks2):
|
2023-03-06 21:46:17 +00:00
|
|
|
# Network Degree has to be an even number
|
|
|
|
if netDegree % 2 == 0:
|
2023-03-13 14:03:55 +00:00
|
|
|
shape = Shape(blockSize, nn, fr, class1ratio, chi, vpn1, vpn2, netDegree, bwUplinkProd, bwUplink1, bwUplink2, run)
|
2023-03-06 21:46:17 +00:00
|
|
|
yield shape
|