Exemple #1
0
def simulate_bdc(lmrs, cache=None):
    # BDC
    print('BDC')
    for lmr in lmrs:
        optimize.set_wait_for(
            lmr=lmr,
            overhead=1.0,
            decodingf=complexity.decoding0,
            wait_for=1,
        )
    df = droplets.simulate(
        partial(
            delay.delay_mean_simulated,
            overhead=1.0,
            n=100,
            order=delay.ROUND_ROBIN,
        ),
        lmrs,
        cache=cache,
    )

    # add decoding/straggling delay
    for i, lmr in enumerate(lmrs):
        if i >= len(df):
            break
        q, d = bdc.optimize_bdc(lmr)
        tmp = df['delay'][i]
        df.loc[i, 'delay'] += d

    return df
Exemple #2
0
def simulate_lt(lmrs):
    for lmr in lmrs:
        decodingf = partial(complexity.lt_complexity, reloverhead=1.3)
        optimize.set_wait_for(
            lmr=lmr,
            overhead=1.3,
            decodingf=decodingf,
        )
    return droplets.simulate(
        partial(delay.delay_mean, overhead=1.3),
        lmrs,
    )
Exemple #3
0
def simulate_ideal(lmrs):
    for lmr in lmrs:
        decodingf = complexity.decoding0
        optimize.set_wait_for(
            lmr=lmr,
            overhead=1.0,
            decodingf=decodingf,
            wait_for=1,
        )
    return droplets.simulate(
        partial(delay.delay_mean, overhead=1.0),
        lmrs,
    )
Exemple #4
0
def approximate_r10(lmrs):
    '''Approximation of R10 performance.'''
    print('R10 approximation')
    for lmr in lmrs:
        decodingf = partial(complexity.r10_complexity, reloverhead=1.02)
        optimize.set_wait_for(
            lmr=lmr,
            overhead=1.02,
            decodingf=decodingf,
        )
    r10 = droplets.simulate(
        partial(delay.delay_mean, overhead=1.020148),
        lmrs,
    )
    return r10
Exemple #5
0
def simulate_r10_opt(lmrs, cache=None):
    '''R10 simulated, optimal droplet order.'''
    for lmr in lmrs:
        decodingf = partial(complexity.r10_complexity, reloverhead=1.02)
        optimize.set_wait_for(
            lmr=lmr,
            overhead=1.02,
            decodingf=decodingf,
            # wait_for=int(round(lmr['nservers']/2))
        )
        print(lmr['wait_for'])
    return droplets.simulate(
        partial(
            delay.delay_mean_empiric,
            overhead=1.020148,
        ),
        lmrs,
        cache=cache,
    )
Exemple #6
0
def simulate_mds(lmrs):
    print('MDS')
    for lmr in lmrs:
        decodingf = partial(
            complexity.bdc_decoding_complexity,
            code_length=lmr['nservers'],
            partitions=1,
            algorithm='fft',
        )
        optimize.set_wait_for(lmr=lmr,
                              overhead=1.0,
                              decodingf=decodingf,
                              wait_for=int(
                                  round(lmr['code_rate'] * lmr['nservers'])))
    df = droplets.simulate(
        delay.delay_classical,
        lmrs,
    )
    return df
Exemple #7
0
def simulate_centralized_lt(lmrs):
    print('LT cent.')
    for lmr in lmrs:
        decodingf = partial(
            complexity.lt_complexity,
            reloverhead=1.3,
        )
        optimize.set_wait_for(
            lmr=lmr,
            overhead=1.3,
            decodingf=decodingf,
        )
    return droplets.simulate(
        partial(
            delay.delay_mean_centralized,
            overhead=1.3,
        ),
        lmrs,
    )
Exemple #8
0
def simulate_centralized_r10(lmrs):
    print('R10 cent.')
    for lmr in lmrs:
        decodingf = partial(
            complexity.r10_complexity,
            reloverhead=1.02,
        )
        optimize.set_wait_for(
            lmr=lmr,
            overhead=1.02,
            decodingf=decodingf,
        )

    df = droplets.simulate(
        partial(
            delay.delay_mean_centralized,
            overhead=1.020148,
        ),
        lmrs,
    )
    return df
Exemple #9
0
def simulate_r10_rr(lmrs, cache=None, rerun=False):
    '''R10 simulated, round-robin droplet order.'''
    print('R10 simulated round-robin')
    for lmr in lmrs:
        decodingf = partial(complexity.r10_complexity, reloverhead=1.02)
        optimize.set_wait_for(
            lmr=lmr,
            overhead=1.02,
            decodingf=decodingf,
        )
    df = droplets.simulate(
        partial(
            delay.delay_mean_simulated,
            overhead=1.020148,
            n=100,
            order=delay.ROUND_ROBIN,
        ),
        lmrs,
        cache=cache,
        rerun=rerun,
    )
    return df
    def test_optimize(self):
        lmr = self.lmr1()
        t1 = delay.delay_mean(lmr)
        lmr = optimize.set_wait_for(
            lmr=lmr,
            overhead=1.02,
            decodingf=complexity.testf,
        )
        t2 = delay.delay_mean(lmr)

        # make sure optimization didn't increase the delay
        self.assertLessEqual(t2, t1)
        return
 def lmr1(self):
     lmr = typedefs.lmr_factory(
         nservers=100,
         nrows=100,
         ncols=100,
         nvectors=100,
         ndroplets=200,
         wait_for=80,
         straggling_factor=1,
         decodingf=lambda x: 0,
     )
     lmr = optimize.set_wait_for(
         lmr=lmr,
         overhead=1.02,
         decodingf=complexity.testf,
         wait_for=50,
     )
     return lmr