def test_get_gpu_model(self, run_command_mock): # Tests get gpu info parses expected value into expected components. run_command_mock.return_value = [ 0, 'driver_version, name\n381.99, GTX 1080 \n' ] gpu_model = utils.get_gpu_info()['gpu_model'] self.assertEqual('GTX 1080', gpu_model) # Tests gpu info returns second entry if first entry is a Quadro. run_command_mock.return_value = [ 0, 'blah\n200.99, Quadro K900 \n381.99, GTX 1080\n' ] gpu_model = utils.get_gpu_info()['gpu_model'] self.assertEqual('GTX 1080', gpu_model)
def test_get_gpu_count(self, run_command_mock): """Tests gpu info returns second entry if first entry is a Quadro.""" run_command_mock.return_value = [ 0, 'blah\n200.99, Quadro K900 \n381.99, GTX 1080\n' ] gpu_count = utils.get_gpu_info()['gpu_count'] self.assertEqual(2, gpu_count)
def test_get_gpu_info(self, run_command_mock): """Tests get gpu info parses expected value into expected components.""" run_command_mock.return_value = [ 0, 'driver_version, name\n381.99, GTX 1080 \n' ] gpu_model = utils.get_gpu_info()['gpu_model'] self.assertEqual('GTX 1080', gpu_model)
def build_execution_summary(execution_timestamp, execution_id, ml_framework_build_label, execution_label, platform_name, system_name, output_gcs_url, benchmark_result, env_vars, flags, site_package_info, has_exception): """Builds summary of the execution.""" # Avoids module not found during setup phase when tf is not installed yet. # pylint: disable=C6204 import tensorflow as tf benchmark_info = {} benchmark_info['harness_name'] = 'perfzero' benchmark_info['has_exception'] = has_exception if execution_label: benchmark_info['execution_label'] = execution_label if output_gcs_url: benchmark_info['output_url'] = '{}/{}/'.format(output_gcs_url, execution_id) if env_vars: benchmark_info['env_vars'] = env_vars if flags: benchmark_info['flags'] = flags benchmark_info['site_package_info'] = site_package_info ml_framework_info = {} ml_framework_info['name'] = 'tensorflow' ml_framework_info['version'] = tf.__version__ # tf.__git_version__ in Python3 has format b'version_string' if tf.__git_version__[0] == 'b': ml_framework_info['build_version'] = tf.__git_version__[2:-1] else: ml_framework_info['build_version'] = tf.__git_version__ if ml_framework_build_label: ml_framework_info['build_label'] = ml_framework_build_label system_info = {} gpu_info = utils.get_gpu_info() if platform_name: system_info['platform_name'] = platform_name if system_name: system_info['system_name'] = system_name system_info['accelerator_driver_version'] = gpu_info['gpu_driver_version'] system_info['accelerator_model'] = gpu_info['gpu_model'] system_info['accelerator_count'] = gpu_info['gpu_count'] system_info['cpu_model'] = utils.get_cpu_name() system_info['cpu_core_count'] = utils.get_cpu_core_count() system_info['cpu_socket_count'] = utils.get_cpu_socket_count() execution_summary = {} execution_summary['execution_id'] = execution_id execution_summary['execution_timestamp'] = execution_timestamp execution_summary['benchmark_result'] = benchmark_result execution_summary['benchmark_info'] = benchmark_info execution_summary['setup_info'] = {} execution_summary['ml_framework_info'] = ml_framework_info execution_summary['system_info'] = system_info return execution_summary
def build_execution_summary(execution_id, test_environment, platform_name, system_name, output_url, benchmark_result): import tensorflow as tf benchmark_info = {} benchmark_info['test_environment'] = test_environment benchmark_info['date_time'] = unicode( datetime.datetime.now().strftime('%Y-%m-%d-%H-%M-%S')) benchmark_info['output_url'] = output_url ml_framework_info = {} ml_framework_info['framework'] = 'tensorflow' ml_framework_info['version'] = tf.__version__ # tf.__git_version__ in Python3 has format b'version_string' if tf.__git_version__[0] == 'b': ml_framework_info['git_version'] = tf.__git_version__[2:-1] else: ml_framework_info['git_version'] = tf.__git_version__ ml_framework_info['channel'] = 'NIGHTLY' ml_framework_info['build_type'] = 'OTB' system_info = {} gpu_info = utils.get_gpu_info() system_info['platform_name'] = platform_name system_info['system_name'] = system_name system_info['gpu_driver_version'] = gpu_info['gpu_driver_version'] system_info['gpu_model'] = gpu_info['gpu_model'] system_info['gpu_count'] = gpu_info['gpu_count'] system_info['cpu_model'] = utils.get_cpu_name() system_info['cpu_core_count'] = utils.get_cpu_core_count() system_info['cpu_socket_count'] = utils.get_cpu_socket_count() execution_summary = {} execution_summary['execution_id'] = execution_id execution_summary['benchmark_result'] = benchmark_result execution_summary['benchmark_info'] = benchmark_info execution_summary['ml_framework_info'] = ml_framework_info execution_summary['system_info'] = system_info return execution_summary