Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- tmp_filename = 'tmp_res'
- array_size_fixed = 10_000_000
- array_sizes = [10_000_000, 20_000_000, 30_000_000, 40_000_000, 50_000_000, 60_000_000, 70_000_000]
- queries_fixed = 1
- queries_count = [10_000_000, 20_000_000, 30_000_000, 40_000_000, 50_000_000, 60_000_000, 70_000_000]
- threads_count = [1, 2, 4, 8, 16, 32, 64]
- launch_count = 20
- if __name__ == '__main__':
- queries_and_threads = []
- for threads in threads_count:
- cur_queries_times = []
- for queries in queries_count:
- print('array_size: {}, queries: {}, threads: {}'.format(array_size_fixed, queries, threads))
- os.system('./range_tree {} {} {} {} > {}'.format(threads, array_size_fixed, queries, launch_count, tmp_filename))
- with open(tmp_filename, 'r') as f:
- build_time, queries_time = map(float, f.readline().split())
- cur_queries_times.append(queries_time)
- queries_and_threads.append(cur_queries_times)
- print('row corresponds to queries count:', queries_count)
- print('column corresponds to threads count:', threads_count)
- print(queries_and_threads)
- arrays_and_threads = []
- for threads in threads_count:
- cur_array_times = []
- for array_size in array_sizes:
- print('array_size: {}, queries: {}, threads: {}'.format(array_size, queries_fixed, threads))
- os.system('./range_tree {} {} {} {} > {}'.format(threads, array_size, queries_fixed, launch_count, tmp_filename))
- with open(tmp_filename, 'r') as f:
- build_time, queries_time = map(float, f.readline().split())
- cur_array_times.append(build_time)
- arrays_and_threads.append(cur_array_times)
- print('row corresponds to array sizes:', array_sizes)
- print('column corresponds to threads count:', threads_count)
- print(arrays_and_threads)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement