예제 #1
0
파일: perf.py 프로젝트: gideonla/w2014
def waits():
    ratios = np.zeros((len(sizes), len(threads)), dtype='float64')
    o_avg = np.zeros((len(sizes), len(threads)), dtype='float64')
    o_std = np.zeros((len(sizes), len(threads)), dtype='float64')

    for (n_ind, n) in enumerate(sizes):
        adj = gen_random_adj(n)
        for t_ind, t in enumerate(threads):
            ratios[n_ind, t_ind], o_avg[n_ind, t_ind], o_std[n_ind, t_ind] = wrapper.fw_parallel(adj, n, t)[1:]

    return ratios, o_avg, o_std
예제 #2
0
파일: perf.py 프로젝트: gideonla/w2014
def parallel_overhead():
    overheads = {}
    for n in sizes:
        serial_times = np.zeros(9, dtype='float64')
        parallel_times = np.zeros(9, dtype='float64')
        for i in range(9):
            adj = gen_random_adj(n)
            serial_times[i] = wrapper.fw_serial(adj, n)[1]
            parallel_times[i] = wrapper.fw_parallel(adj, n, 1)[1]

        overheads[n] = ((serial_times/parallel_times).mean(), (serial_times/parallel_times).std())
    
    return overheads
예제 #3
0
파일: perf.py 프로젝트: lesleyDeng/w2014
def parallel_overhead():
    overheads = {}
    for n in sizes:
        serial_times = np.zeros(9, dtype='float64')
        parallel_times = np.zeros(9, dtype='float64')
        for i in range(9):
            adj = gen_random_adj(n)
            serial_times[i] = wrapper.fw_serial(adj, n)[1]
            parallel_times[i] = wrapper.fw_parallel(adj, n, 1)[1]

        overheads[n] = ((serial_times / parallel_times).mean(),
                        (serial_times / parallel_times).std())

    return overheads
예제 #4
0
파일: perf.py 프로젝트: lesleyDeng/w2014
def waits():
    ratios = np.zeros((len(sizes), len(threads)), dtype='float64')
    o_avg = np.zeros((len(sizes), len(threads)), dtype='float64')
    o_std = np.zeros((len(sizes), len(threads)), dtype='float64')

    for (n_ind, n) in enumerate(sizes):
        adj = gen_random_adj(n)
        for t_ind, t in enumerate(threads):
            ratios[n_ind,
                   t_ind], o_avg[n_ind,
                                 t_ind], o_std[n_ind,
                                               t_ind] = wrapper.fw_parallel(
                                                   adj, n, t)[1:]

    return ratios, o_avg, o_std
예제 #5
0
파일: test.py 프로젝트: gideonla/w2014
    def verify_expectations(self, expected, adj, name):
        thread_cts = [1, 2, 4, 8, 16, 32]
        serial_result, time = wrapper.fw_serial(adj, adj.shape[0])
        if not np.all(serial_result == expected):
            raise AssertionError('Serial version failed in {0}'.format(name))

        failures = []
        for t in thread_cts:
            result = wrapper.fw_parallel(adj, adj.shape[0], t)[0]
            if not np.all(result == expected):
                print result
                failures.append(t)

        if len(failures) > 0:
            raise AssertionError('Parallel version failed on T={0} in {1}'.format(failures, name))
예제 #6
0
파일: perf.py 프로젝트: lesleyDeng/w2014
def speedups():
    spds = np.zeros((len(sizes), len(threads)), dtype='float64')
    spd_stddevs = np.zeros((len(sizes), len(threads)), dtype='float64')

    for (n_ind, n) in enumerate(sizes):
        this_n_spds = np.zeros((9, len(threads)), dtype='float64')
        for i in range(9):
            adj = gen_random_adj(n)
            serial_time = wrapper.fw_serial(adj, n)[1]
            for (t_ind, t) in enumerate(threads):
                p_time = wrapper.fw_parallel(adj, n, t)[1]
                this_n_spds[i, t_ind] = serial_time / p_time

        spds[n_ind] = this_n_spds.mean(0)
        spd_stddevs[n_ind] = this_n_spds.std(0)

    return spds, spd_stddevs
예제 #7
0
    def verify_expectations(self, expected, adj, name):
        thread_cts = [1, 2, 4, 8, 16, 32]
        serial_result, time = wrapper.fw_serial(adj, adj.shape[0])
        if not np.all(serial_result == expected):
            raise AssertionError('Serial version failed in {0}'.format(name))

        failures = []
        for t in thread_cts:
            result = wrapper.fw_parallel(adj, adj.shape[0], t)[0]
            if not np.all(result == expected):
                print result
                failures.append(t)

        if len(failures) > 0:
            raise AssertionError(
                'Parallel version failed on T={0} in {1}'.format(
                    failures, name))
예제 #8
0
파일: perf.py 프로젝트: gideonla/w2014
def speedups():
    spds = np.zeros((len(sizes), len(threads)), dtype='float64')
    spd_stddevs = np.zeros((len(sizes), len(threads)), dtype='float64')

    for (n_ind, n) in enumerate(sizes):
        this_n_spds = np.zeros((9, len(threads)), dtype='float64')
        for i in range(9):
            adj = gen_random_adj(n)
            serial_time = wrapper.fw_serial(adj, n)[1]
            for (t_ind, t) in enumerate(threads):
                p_time = wrapper.fw_parallel(adj, n, t)[1]
                this_n_spds[i, t_ind] = serial_time / p_time

        spds[n_ind] = this_n_spds.mean(0)
        spd_stddevs[n_ind] = this_n_spds.std(0)

    return spds, spd_stddevs