Beispiel #1
0
        public string GetValue(Resource resource, LaunchDestination destination)
        {
            var nodes = resource.Nodes.Join(destination.NodeNames, n => n.DNSName, n => n, (n, name) => n).Distinct();
            var cores = nodes.Select(n => Int32.Parse(ClusterParameterReader.GetValue(TotalNodeCores.TCORES, n), CultureInfo.InvariantCulture)).Sum();
            var perf  = nodes.Select(n => Double.Parse(ClusterParameterReader.GetValue(PERF, n), CultureInfo.InvariantCulture.NumberFormat)).Sum();

            return((perf / cores).ToString(CultureInfo.InvariantCulture.NumberFormat));
        }
Beispiel #2
0
        public EstimationResult Estimate(IDictionary <string, string> parameters, Common.Resource resource, Common.LaunchDestination destination, bool optimize)
        {
            var models = new List <IModel>();

            models.AddRange(_models.Values);
            models.Sort(new ModelOrderer());
            EstimationResult result = null;

            foreach (var model in models)
            {
                var hwParameters = model.GetParameters(ParameterSourceType.Hardware);
                foreach (var hwParameter in hwParameters)
                {
                    model.SetParameterValue(hwParameter.Name, ClusterParameterReader.GetValue(hwParameter.Name, resource, destination));
                }
                result = model.Estimate(parameters, result, optimize);
            }
            if (!result.Parameters.Exists(p => p.Name == NodesCountExtractor.NODES))
            {
                result.Parameters.Add(new EstimationResult.ParameterValue()
                {
                    Name         = NodesCountExtractor.NODES,
                    InitialValue = (1).ToString(),
                    NewValue     = (1).ToString()
                });
            }
            if (!result.Parameters.Exists(p => p.Name == ProcessorCountPerNode.P))
            {
                result.Parameters.Add(new EstimationResult.ParameterValue()
                {
                    Name         = ProcessorCountPerNode.P,
                    InitialValue = (1).ToString(),
                    NewValue     = (1).ToString()
                });
            }
            return(result);
        }