def test_sampling(self): # FIXME: bogotest, extend tests! dist = PDist.lognorm(0.25) sampler = BoundRejectionSampler(dist, 0.5, 2) x = sampler.sample(10000) self.assertGreater(x.min(), 0.5) self.assertLess(x.max(), 2)
def inject_workload_generator(self, env, deployment: Tuple[int, Pod, Pod, Pod]): i, pod0, pod1, pod2 = deployment logger.debug('%.2f injecting request generators for deployment %d', env.now, i) prep_function_name = f'wf_0_preprocess_{i}' training_trigger = request_generator( env, ParameterizedDistribution.expon(((200, 100,), None, None)), lambda: FunctionRequest(prep_function_name, empty) ) inference_function_name = f'wf_2_inference_{i}' inference_trigger = request_generator( env, ParameterizedDistribution.expon(((25, 50,), None, None)), lambda: FunctionRequest(inference_function_name, empty) ) env.process(training_trigger) env.process(inference_trigger)
import random from srds import ParameterizedDistribution as PDist # python-pi was made with req=10000, except xeongpu - this one was req=2000, due to the inexplicable slow response execution_time_distributions = { ('rpi3', 'faas-workloads/python-pi'): (1.909987211227417, 2.203219413757324, PDist.lognorm( ((1.5561351906586467, ), 1.9092154433285176, 0.03832589013392289))), ('rpi4', 'faas-workloads/python-pi'): (1.6961045265197754, 1.7755048274993896, PDist.lognorm( ((2.0378973843923234, ), 1.6960468751471511, 0.017276257000211737))), ('xeongpu', 'faas-workloads/python-pi'): (2.9558749198913574, 3.0182230472564697, PDist.lognorm( ((0.33924794244178996, ), 2.9421626090307855, 0.03231526504686262))), ('xeoncpu', 'faas-workloads/python-pi'): (2.9558749198913574, 3.0182230472564697, PDist.lognorm( ((0.33924794244178996, ), 2.9421626090307855, 0.03231526504686262))), ('nx', 'faas-workloads/python-pi'): (1.280782699584961, 1.3314659595489502, PDist.lognorm( ((0.3204243885534094, ), 1.2658584067446368, 0.029294830565182426))), ('tx2', 'faas-workloads/python-pi'): (0.9472050666809082, 0.973700761795044, PDist.lognorm( ((0.34123939468038056, ), 0.9407173896320605, 0.015806120791955418))), ('nano', 'faas-workloads/python-pi'):
from srds import ParameterizedDistribution from ether.blocks import nodes from ether.blocks.cells import Cloudlet, IoTComputeBox, MobileConnection, FiberToExchange from ether.cell import GeoCell, SharedLinkCell from ether.topology import Topology default_num_cells = 3 default_cloudlet_size = (5, 2) default_cell_density = ParameterizedDistribution.lognorm((0.82, 2.02)) class UrbanSensingScenario: def __init__(self, num_cells=default_num_cells, cell_density=default_cell_density, cloudlet_size=default_cloudlet_size, internet='internet') -> None: """ The UrbanSensingScenario builds on ideas from the Array of Things project, but extends it with proximate compute resources and adds a cloudlet to the city. The city is divided into cells, e.g., neighborhoods, and each cell has multiple urban sensing nodes and proximate compute resources. The devices in a cell are connected via a shared link. The city also hosts a cloudlet composed of server computers. The high-level parameters are: the number of cells, the cell density (number of nodes per cell), and the cloudlet size. :param num_cells: the number of cells to create, e.g., the neighborhoods in a city :param cell_density: the distribution describing the number of nodes in each neighborhood
from srds import ParameterizedDistribution as PDist execution_time_distributions = { ('cloud', 'alexrashed/ml-wf-1-pre'): (0.584, 1.1420000000000001, PDist.lognorm( ((0.31449780857108944, ), 0.36909628354997315, 0.41583220283981315))), ('tegra', 'alexrashed/ml-wf-1-pre'): (0.434, 0.491, PDist.lognorm( ((0.4040891723912467, ), 0.42388853817361616, 0.026861281861394234))), ('pi', 'alexrashed/ml-wf-1-pre'): (23.89, 108.743, PDist.lognorm( ((0.20506023311489027, ), -20.283277542855338, 73.25412435048207))), ('nuc', 'alexrashed/ml-wf-1-pre'): (0.10099999999999999, 0.105, PDist.lognorm( ((23.561803013427763, ), 0.10099999999999998, 0.00012383535141814733))), ('cloud', 'alexrashed/ml-wf-2-train'): (156.256, 166.702, PDist.lognorm( ((0.0955189827829152, ), 140.38073254297746, 20.5799433435967))), ('tegra', 'alexrashed/ml-wf-2-train'): (17.641, 20.333, PDist.lognorm( ((0.07553515034079655, ), 12.501696816822736, 6.339535271582099))), ('nuc', 'alexrashed/ml-wf-2-train'): (31.326999999999998, 42.355, PDist.lognorm(
from srds import ParameterizedDistribution as PDist lan = PDist.lognorm((0.25, 0.35, 0.16)) wlan = PDist.lognorm((0.635, 1.18, 3.27)) business_isp = PDist.lognorm((0.87, 5.95, 1.21)) mobile_isp = PDist.lognorm((0.49, 16.2, 8.02))
def exp_sampler(lambd): sampler = BufferedSampler(PDist.expon(lambd)) while True: yield sampler.sample()