3 from __future__
import print_function
12 device_re = re.compile(
"Device.*allocated new device block.*\((?P<bytes>\d+) bytes")
13 host_re = re.compile(
"Host.*allocated new host block.*\((?P<bytes>\d+) bytes")
17 m = device_re.search(line)
19 device.append(m.group(
"bytes"))
21 m = host_re.search(line)
23 host.append(m.group(
"bytes"))
26 print(
"process.CUDAService.allocator.devicePreallocate = cms.untracked.vuint32(%s)" %
",".
join(device))
27 print(
"process.CUDAService.allocator.hostPreallocate = cms.untracked.vuint32(%s)" %
",".
join(host))
29 if __name__ ==
"__main__":
30 parser = argparse.ArgumentParser(description=
"""Extract CUDAService preallocation parameters from a log file.
32 To use, run the job once with "process.CUDAService.allocator.debug =
33 True" and direct the output to a file. Then run this script by passing
34 the file as an argument, and copy the output of this script back to
35 the configuration file.""")
36 parser.add_argument(
"file", type=str, help=
"Log file to parse")
37 opts = parser.parse_args()
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
static std::string join(char **cmd)