def measure_bw(type_, total_size, threads_per_core, max_threads_per_core, cores_per_socket,<EOL>sockets):
groups = []<EOL>for s in range(sockets):<EOL><INDENT>groups += [<EOL>'<STR_LIT>',<EOL>'<STR_LIT:S>' + str(s) + '<STR_LIT::>' + str(total_size) + '<STR_LIT>' +<EOL>str(threads_per_core * cores_per_socket) +<EOL>'<STR_LIT>' + str(int(max_threads_per_core / threads_per_core))]<EOL><DEDENT>cmd = ['<STR_LIT>', '<STR_LIT>', type_] + groups<EOL>sys.stderr.write('<STR_LIT:U+0020>'.join(cmd))<EOL>output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[<NUM_LIT:0>].decode('<STR_LIT:utf-8>')<EOL>if not output:<EOL><INDENT>print('<STR_LIT:U+0020>'.join(cmd) + '<STR_LIT>'<EOL>'<STR_LIT>', file=sys.stderr)<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>bw = float(get_match_or_break(r'<STR_LIT>', output)[<NUM_LIT:0>])<EOL>print('<STR_LIT:U+0020>', PrefixedUnit(bw, '<STR_LIT>'), file=sys.stderr)<EOL>return PrefixedUnit(bw, '<STR_LIT>')<EOL>
*size* is given in kilo bytes