Пример #1
0
        /// <summary>
        /// Parses command line argument options
        /// </summary>
        /// <param name="options">Options to be parsed.</param>
        /// <returns>Model Analyzer configuration with parsed options.</returns>
        private ModelAnalyzerConfig ParseBaseOptions(Options options)
        {
            var analyzerConfig = new ModelAnalyzerConfig();



            if (!options.ExportFlag)
            {
                if (!string.IsNullOrWhiteSpace(options.ExportPath))
                {
                    Console.WriteLine("Export-path specified without --export flag: skipping exporting metrics");
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(options.ExportPath) && !Directory.Exists(options.ExportPath))
                {
                    throw new ArgumentException("Export path does not exist");
                }
            }

            if (options.BatchSizes.Count != 0)
            {
                analyzerConfig.BatchSize = options.BatchSizes;
            }

            if (options.ConcurrencyValues.Count != 0)
            {
                analyzerConfig.ConcurrencyValues = options.ConcurrencyValues;
            }

            if (options.MaxRetrySec > 0)
            {
                analyzerConfig.MaxRetryTime = TimeSpan.FromSeconds(options.MaxRetrySec);
            }

            if (options.PerfClientBufferSec > 0)
            {
                analyzerConfig.PerfClientBufferTime = TimeSpan.FromSeconds(options.PerfClientBufferSec);
            }

            if (options.ServerMetricsDuration < 0)
            {
                options.ServerMetricsDuration = 5;
            }

            if (!string.IsNullOrWhiteSpace(options.TritonVersion))
            {
                analyzerConfig.TritonVersion = options.TritonVersion;
            }

            if (options.UpdateFrequencyMs > 0)
            {
                analyzerConfig.UpdateFrequency = TimeSpan.FromMilliseconds(options.UpdateFrequencyMs);
            }

            return(analyzerConfig);
        }
Пример #2
0
 /// <summary>
 /// Constructor for ModelAnalyzer
 /// Used for gathering and exporting metrics to screen
 /// </summary>
 /// <param name="config">Configuration object for Model Analyzer</param>
 /// <returns>Model Analyzer instance</returns>
 public ModelAnalyzer(ModelAnalyzerConfig config, MetricsCollector metricsCollectorServerOnly, MetricsCollector metricsCollectorModel)
 {
     _BatchSize                  = config.BatchSize;
     _ConcurrencyValues          = config.ConcurrencyValues;
     _MetricsCollectorModel      = metricsCollectorModel;
     _MetricsCollectorServerOnly = metricsCollectorServerOnly;
     _ModelFolder                = config.ModelFolder;
     _ModelName                  = config.ModelName;
     _TritonVersion              = config.TritonVersion;
     _MaxRetryTime               = config.MaxRetryTime;
     _PerfClientBufferTime       = config.PerfClientBufferTime;
     _UpdateFrequency            = config.UpdateFrequency;
 }