def test_key(self):
     """
     Test that the key was initialized correctly
     """
     self.assertEqual(
         self.rcm0.key(),
         construct_perf_analyzer_config(self.model_name).representation())
示例#2
0
    def test_max_concurrency(self):
        """ 
        Test Max Concurrency: 
            - Change max concurrency to non-default value
        
        Max Concurrency: 16
        Default (1) value will be used for batch size 
        and 5 configs (log2(16)+1) will be generated 
        """

        # yapf: disable
        yaml_content = convert_to_bytes("""
            profile_models:
                - my-model
            """)
        # yapf: enable

        concurrencies = utils.generate_log2_list(16)
        expected_configs = [
            construct_perf_analyzer_config(concurrency=c)
            for c in concurrencies
        ]

        pa_cli_args = ['--run-config-search-max-concurrency', '16']
        self._run_and_test_perf_analyzer_config_generator(
            yaml_content, expected_configs, pa_cli_args)
示例#3
0
    def test_c_api(self):
        """ 
        Test C_API: 
            - Launch mode is C_API
        
        Default (1) values will be used for batch size/concurrency 
        and only one config will be generated 
        """

        # yapf: disable
        yaml_content = convert_to_bytes("""
            profile_models:
                - my-model
            """)
        # yapf: enable

        concurrencies = utils.generate_log2_list(
            DEFAULT_RUN_CONFIG_MAX_CONCURRENCY)
        expected_configs = [
            construct_perf_analyzer_config(concurrency=c, launch_mode='c_api')
            for c in concurrencies
        ]

        self._run_and_test_perf_analyzer_config_generator(
            yaml_content, expected_configs, '--triton-launch-mode=c_api')
示例#4
0
    def test_default(self):
        """
        Test Default:  
            - No CLI options specified
        
        Default (1) value will be used for batch size
        and log2(DEFAULT_RUN_CONFIG_MAX_CONCURRENCY)+1 configs 
        will be generated by the auto-search
        """

        # yapf: disable
        yaml_content = convert_to_bytes("""
            profile_models:
                - my-model
            """)
        # yapf: enable

        concurrencies = utils.generate_log2_list(
            DEFAULT_RUN_CONFIG_MAX_CONCURRENCY)
        expected_configs = [
            construct_perf_analyzer_config(concurrency=c)
            for c in concurrencies
        ]

        self._run_and_test_perf_analyzer_config_generator(
            yaml_content, expected_configs)
示例#5
0
    def test_perf_analyzer_flags(self):
        """
        Test Perf Analyzer Flags:  
            - No CLI options specified
            - Percentile (PA flag) set in model's YAML
        
        Default (1) value will be used for batch size
        and log2(DEFAULT_RUN_CONFIG_MAX_CONCURRENCY)+1 configs 
        will be generated by the auto-search
        """

        # yapf: disable
        yaml_content = convert_to_bytes("""
            profile_models:
                - my-model:
                    perf_analyzer_flags:
                        percentile: 96
            """)
        # yapf: enable

        concurrencies = utils.generate_log2_list(
            DEFAULT_RUN_CONFIG_MAX_CONCURRENCY)
        expected_configs = [
            construct_perf_analyzer_config(
                concurrency=c, perf_analyzer_flags={'percentile': '96'})
            for c in concurrencies
        ]

        self._run_and_test_perf_analyzer_config_generator(
            yaml_content, expected_configs)
示例#6
0
    def test_batch_size_and_concurrency(self):
        """
        Test Batch Size and Concurrency:
            - Schmoo batch sizes and concurrency
            - Run Config Search enabled & disabled

        Batch sizes: 1,2,4
        Concurrency: 1-4
        

        12 configs will be generated
        """

        # yapf: disable
        yaml_content = convert_to_bytes("""
            profile_models:
                - my-model
            """)
        # yapf: enable

        batch_sizes = [1, 2, 4]
        concurrencies = [1, 2, 3, 4]

        expected_configs = [
            construct_perf_analyzer_config(batch_size=b, concurrency=c)
            for b in batch_sizes for c in concurrencies
        ]

        pa_cli_args = ['-b 1,2,4', '-c 1,2,3,4']
        self._run_and_test_perf_analyzer_config_generator(
            yaml_content, expected_configs, pa_cli_args)

        pa_cli_args = ['-b 1,2,4', '-c 1,2,3,4', '--run-config-search-disable']
        self._run_and_test_perf_analyzer_config_generator(
            yaml_content, expected_configs, pa_cli_args)
示例#7
0
    def test_concurrency(self):
        """ 
        Test Concurrency: 
            - Schmoo concurrency
            - Test with auto-search enabled & disabled
        
        Concurrency: 1-4
        Default (1) value will be used for batch size 
        and 4 configs will be generated 
        """

        # yapf: disable
        yaml_content = convert_to_bytes("""
            profile_models:
                - my-model
            """)
        # yapf: enable

        concurrencies = [1, 2, 3, 4]
        expected_configs = [
            construct_perf_analyzer_config(concurrency=c)
            for c in concurrencies
        ]

        pa_cli_args = ['-c 1,2,3,4']
        self._run_and_test_perf_analyzer_config_generator(
            yaml_content, expected_configs, pa_cli_args)

        pa_cli_args = ['-c 1,2,3,4', '--run-config-search-disable']
        self._run_and_test_perf_analyzer_config_generator(
            yaml_content, expected_configs, pa_cli_args)
示例#8
0
    def test_batch_size_search_enabled(self):
        """ 
        Test Batch Size Search Enabled: 
            - Schmoo batch sizes
            - Run Config Search enabled
        
        Batch sizes: 1,2,4
        Concurrency: log2(DEFAULT_RUN_CONFIG_MAX_CONCURRENCY)+1
        """

        # yapf: disable
        yaml_content = convert_to_bytes("""
            profile_models:
                - my-model
            """)
        # yapf: enable

        batch_sizes = [1, 2, 4]
        concurrencies = utils.generate_log2_list(
            DEFAULT_RUN_CONFIG_MAX_CONCURRENCY)
        expected_configs = [
            construct_perf_analyzer_config(batch_size=b, concurrency=c)
            for b in batch_sizes for c in concurrencies
        ]

        pa_cli_args = ['-b 1,2,4']
        self._run_and_test_perf_analyzer_config_generator(
            yaml_content, expected_configs, pa_cli_args)
示例#9
0
    def test_batch_size_search_disabled(self):
        """ 
        Test Batch Size Search Disabled: 
            - Schmoo batch sizes
            - Run Config Search disabled
        
        Batch sizes: 1,2,4
        Default (1) value will be used concurrency 
        and 3 configs will be generated 
        """

        # yapf: disable
        yaml_content = convert_to_bytes("""
            profile_models:
                - my-model
            """)
        # yapf: enable

        batch_sizes = [1, 2, 4]
        expected_configs = [
            construct_perf_analyzer_config(batch_size=b) for b in batch_sizes
        ]

        pa_cli_args = ['-b 1,2,4', '--run-config-search-disable']
        self._run_and_test_perf_analyzer_config_generator(
            yaml_content, expected_configs, pa_cli_args)
示例#10
0
    def test_http(self):
        """ 
        Test HTTP: 
            - Client protocol is HTTP
        
        Default (1) values will be used for batch size/concurrency 
        and only one config will be generated 
        """

        # yapf: disable
        yaml_content = convert_to_bytes("""
            profile_models:
                - my-model
            """)
        # yapf: enable

        concurrencies = utils.generate_log2_list(
            DEFAULT_RUN_CONFIG_MAX_CONCURRENCY)
        expected_configs = [
            construct_perf_analyzer_config(concurrency=c,
                                           client_protocol='http')
            for c in concurrencies
        ]

        self._run_and_test_perf_analyzer_config_generator(
            yaml_content, expected_configs, '--client-protocol=http')
示例#11
0
    def test_perf_analyzer_config_ssl_options(self):
        """
        Test Perf Analyzer SSL options:  
            - No CLI options specified
        """

        # yapf: disable
        yaml_content = convert_to_bytes("""
            profile_models:
                - my-model:
                    perf_analyzer_flags:
                        ssl-grpc-root-certifications-file: a
                        ssl-grpc-private-key-file: b
                        ssl-grpc-certificate-chain-file: c
                        ssl-https-verify-peer: 1
                        ssl-https-verify-host: 2
                        ssl-https-ca-certificates-file: d
                        ssl-https-client-certificate-type: e
                        ssl-https-client-certificate-file: f
                        ssl-https-private-key-type: g
                        ssl-https-private-key-file: h
            """)
        # yapf: enable

        concurrencies = utils.generate_log2_list(
            DEFAULT_RUN_CONFIG_MAX_CONCURRENCY)
        expected_configs = [
            construct_perf_analyzer_config(
                concurrency=c,
                perf_analyzer_flags={
                    'ssl-grpc-root-certifications-file': 'a',
                    'ssl-grpc-private-key-file': 'b',
                    'ssl-grpc-certificate-chain-file': 'c',
                    'ssl-https-verify-peer': '1',
                    'ssl-https-verify-host': '2',
                    'ssl-https-ca-certificates-file': 'd',
                    'ssl-https-client-certificate-type': 'e',
                    'ssl-https-client-certificate-file': 'f',
                    'ssl-https-private-key-type': 'g',
                    'ssl-https-private-key-file': 'h',
                }) for c in concurrencies
        ]

        self._run_and_test_perf_analyzer_config_generator(
            yaml_content, expected_configs)
示例#12
0
    def test_search_disabled(self):
        """ 
        Test Search Disabled: 
            - Run Config Search disabled
        
        Default (1) value will be used for batch size
        and concurrency will be set to 1
        """

        # yapf: disable
        yaml_content = convert_to_bytes("""
            profile_models:
                - my-model
            """)
        # yapf: enable

        expected_configs = [construct_perf_analyzer_config()]

        self._run_and_test_perf_analyzer_config_generator(
            yaml_content, expected_configs, '--run-config-search-disable')