Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(787)

Side by Side Diff: build/toolchain/get_concurrent_links.py

Issue 1518353003: Reduce concurrency for LTO builds. Reserve 32 GB per link job. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # This script computs the number of concurrent links we want to run in the build 5 # This script computs the number of concurrent links we want to run in the build
6 # as a function of machine spec. It's based on GetDefaultConcurrentLinks in GYP. 6 # as a function of machine spec. It's based on GetDefaultConcurrentLinks in GYP.
7 7
8 import optparse 8 import optparse
9 import os 9 import os
10 import re 10 import re
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 for line in meminfo: 48 for line in meminfo:
49 match = memtotal_re.match(line) 49 match = memtotal_re.match(line)
50 if not match: 50 if not match:
51 continue 51 continue
52 mem_total_gb = float(match.group(1)) / (2 ** 20) 52 mem_total_gb = float(match.group(1)) / (2 ** 20)
53 # Allow 8Gb per link on Linux because Gold is quite memory hungry 53 # Allow 8Gb per link on Linux because Gold is quite memory hungry
54 mem_per_link_gb = 8 54 mem_per_link_gb = 8
55 if is_lto: 55 if is_lto:
56 mem_total_gb -= 20 # Reserve 56 mem_total_gb -= 20 # Reserve
57 # For LTO builds the RAM requirements are even higher 57 # For LTO builds the RAM requirements are even higher
58 mem_per_link_gb = 20 58 mem_per_link_gb = 32
59 return int(max(1, mem_total_gb / mem_per_link_gb)) 59 return int(max(1, mem_total_gb / mem_per_link_gb))
60 return 1 60 return 1
61 elif sys.platform == 'darwin': 61 elif sys.platform == 'darwin':
62 try: 62 try:
63 avail_bytes = int(subprocess.check_output(['sysctl', '-n', 'hw.memsize'])) 63 avail_bytes = int(subprocess.check_output(['sysctl', '-n', 'hw.memsize']))
64 # A static library debug build of Chromium's unit_tests takes ~2.7GB, so 64 # A static library debug build of Chromium's unit_tests takes ~2.7GB, so
65 # 4GB per ld process allows for some more bloat. 65 # 4GB per ld process allows for some more bloat.
66 return max(1, avail_bytes / (4 * (2 ** 30))) # total / 4GB 66 return max(1, avail_bytes / (4 * (2 ** 30))) # total / 4GB
67 except Exception: 67 except Exception:
68 return 1 68 return 1
69 else: 69 else:
70 # TODO(scottmg): Implement this for other platforms. 70 # TODO(scottmg): Implement this for other platforms.
71 return 1 71 return 1
72 72
73 def main(): 73 def main():
74 parser = optparse.OptionParser() 74 parser = optparse.OptionParser()
75 parser.add_option('--lto', action="store_true", default=False, 75 parser.add_option('--lto', action="store_true", default=False,
76 help='This is an LTO build with higher memory requirements') 76 help='This is an LTO build with higher memory requirements')
77 parser.disable_interspersed_args() 77 parser.disable_interspersed_args()
78 options, args = parser.parse_args() 78 options, args = parser.parse_args()
79 79
80 print _GetDefaultConcurrentLinks(is_lto=options.lto) 80 print _GetDefaultConcurrentLinks(is_lto=options.lto)
81 return 0 81 return 0
82 82
83 if __name__ == '__main__': 83 if __name__ == '__main__':
84 sys.exit(main()) 84 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698