From ab34b12e50d5f1266b17b56e14ec45b4d23140be Mon Sep 17 00:00:00 2001 From: Craig Tiller <ctiller@google.com> Date: Mon, 28 Nov 2016 13:19:12 -0800 Subject: [PATCH] Make a better educated guess about CPU costs of a benchmark --- test/cpp/qps/gen_build_yaml.py | 3 +-- tools/run_tests/run_tests.py | 7 +++-- tools/run_tests/tests.json | 48 +++++++++++++++++----------------- 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/test/cpp/qps/gen_build_yaml.py b/test/cpp/qps/gen_build_yaml.py index 1e00e0cd2c..7fccf01261 100755 --- a/test/cpp/qps/gen_build_yaml.py +++ b/test/cpp/qps/gen_build_yaml.py @@ -63,8 +63,7 @@ def guess_cpu(scenario_json): server = threads_of_type(scenario_json, 'server_config/async_server_threads') # make an arbitrary guess if set to auto-detect # about the size of the jenkins instances we have for unit tests - if client == 0: client = 16 - if server == 0: server = 16 + if client == 0 or server == 0: return 'capacity' return (scenario_json['num_clients'] * client + scenario_json['num_servers'] * server) diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index fe8ad5f6ad..e503b82f0e 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -242,6 +242,9 @@ class CLanguage(object): target['name']) else: binary = 'bins/%s/%s' % (self.config.build_config, target['name']) + cpu_cost = target['cpu_cost'] + if cpu_cost == 'capacity': + cpu_cost = multiprocessing.cpu_count() if os.path.isfile(binary): if 'gtest' in target and target['gtest']: # here we parse the output of --gtest_list_tests to build up a @@ -265,7 +268,7 @@ class CLanguage(object): cmdline = [binary] + ['--gtest_filter=%s' % test] out.append(self.config.job_spec(cmdline, shortname='%s --gtest_filter=%s %s' % (binary, test, shortname_ext), - cpu_cost=target['cpu_cost'], + cpu_cost=cpu_cost, environ=env)) else: cmdline = [binary] + target['args'] @@ -274,7 +277,7 @@ class CLanguage(object): pipes.quote(arg) for arg in cmdline) + shortname_ext, - cpu_cost=target['cpu_cost'], + cpu_cost=cpu_cost, flaky=target.get('flaky', False), timeout_seconds=target.get('timeout_seconds', _DEFAULT_TIMEOUT_SECONDS), environ=env)) diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index eca6301a9d..5db4e43070 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -36783,7 +36783,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 16, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [], "flaky": false, @@ -36804,7 +36804,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [], "flaky": false, @@ -36825,7 +36825,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 16, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [], "flaky": false, @@ -36846,7 +36846,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 16, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [], "flaky": false, @@ -36888,7 +36888,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 16, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [], "flaky": false, @@ -36909,7 +36909,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 16, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [], "flaky": false, @@ -36951,7 +36951,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 16, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [], "flaky": false, @@ -36972,7 +36972,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 16, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [], "flaky": false, @@ -37014,7 +37014,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 16, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [], "flaky": false, @@ -37035,7 +37035,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 16, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [], "flaky": false, @@ -37077,7 +37077,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 16, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [], "flaky": false, @@ -37098,7 +37098,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 16, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [], "flaky": false, @@ -37140,7 +37140,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 16, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [], "flaky": false, @@ -37161,7 +37161,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [], "flaky": false, @@ -37182,7 +37182,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 16, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [], "flaky": false, @@ -37203,7 +37203,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 16, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [], "flaky": false, @@ -37245,7 +37245,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 16, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [], "flaky": false, @@ -37266,7 +37266,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 16, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [], "flaky": false, @@ -37308,7 +37308,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 16, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [], "flaky": false, @@ -37329,7 +37329,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 16, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [], "flaky": false, @@ -37371,7 +37371,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 16, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [], "flaky": false, @@ -37392,7 +37392,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 16, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [], "flaky": false, @@ -37434,7 +37434,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 16, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [], "flaky": false, @@ -37455,7 +37455,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 16, + "cpu_cost": "capacity", "defaults": "boringssl", "exclude_configs": [], "flaky": false, -- GitLab