コード例 #1
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
コード例 #2
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
コード例 #3
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))
コード例 #4
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
コード例 #5
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))
コード例 #6
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