Exemplo n.º 1
0
        public void AssignTo(string clusterName)
        {
            ResourceNode[] nodes = ClustersProxy.GetNodes(clusterName);

            for (int i = 0; i < nodes.Length; i++)
            {
                // no package = no available cores on this node
                if (!nodes[i].HavePackage(Package))
                    nodes[i].CoresAvailable = 0;
            }

            Estimation minEst = null;
            foreach (LaunchModel model in TaskManager.LaunchModels)
            {
                Estimation curEst = model.EstimateIfMathces(this, nodes);

                if (model.Mathces(this))
                {
                    Log.Info(String.Format(
                        "Задача {1}, на кластере {2} получена оценка в {3} очков от модели запуска {0}",
                            model.ToString(), this.TaskId, nodes[0].ClusterName,
                            (curEst == null)? "--" : "" + ((int) curEst.Time.TotalSeconds).ToString()
                    ));
                }

                if (curEst != null && (minEst == null || curEst.Time < minEst.Time))
                    minEst = new Estimation(curEst.Time, curEst.ClusterName, curEst.Cores);
            }

            AssignTo(minEst);
        }
Exemplo n.º 2
0
        public TaskSchedule(TaskSchedule other)
            : this()
        {
            if (other != null)
            {
                TaskId = other.TaskId;
                Action = other.Action;

                var newNodes = new List<NodeConfig>();
                foreach (var node in other.Nodes)
                {
                    var newNode = node;
                    newNodes.Add(newNode);
                }
                Nodes = newNodes;

                FailReason = other.FailReason;

                if (other.Estimation != null)
                    Estimation = new Estimation(other.Estimation);
                //EstimatedStartTime  = other.EstimatedStartTime;
                //EstimatedFinishTime = other.EstimatedFinishTime;

                if (other.ModifiedParams != null)
                    ModifiedParams = new Dictionary<string, string>(other.ModifiedParams);
            }
        }
Exemplo n.º 3
0
 // todo : Schedule class
 public void AssignTo(Estimation estimation)
 {
     if (estimation == null)
     {
         this.Time.Estimated = null;
         _assignedTo = new ClusterConfig(null, null);
         _state = TaskState.NotAssigned;
     }
     else
         AssignTo(estimation.ClusterName, estimation.Cores, estimation.Time);
 }
Exemplo n.º 4
0
        // todo : Schedule class

        public void AssignTo(Estimation estimation)
        {
            if (estimation == null)
            {
                this.Time.Estimated = null;
                _assignedTo         = new ClusterConfig(null, null);
                _state = TaskState.NotAssigned;
            }
            else
            {
                AssignTo(estimation.ClusterName, estimation.Cores, estimation.Time);
            }
        }
Exemplo n.º 5
0
        public Estimation(Estimation otherEstimation)
        {
            _durationSurrogate = otherEstimation._durationSurrogate;

            if (otherEstimation.FromHistory != null)
            {
                FromHistory = new HistoryEstimation(otherEstimation.FromHistory);
            }

            if (otherEstimation.ModelCoeffs != null)
            {
                ModelCoeffs = new Dictionary <string, double>(otherEstimation.ModelCoeffs);
            }

            if (otherEstimation.ByModel != null)
            {
                ByModel = new ModelEstimation();

                ByModel.CalculationTime = new ValueWithDispersion <double>()
                {
                    Value      = otherEstimation.ByModel.CalculationTime.Value,
                    Dispersion = otherEstimation.ByModel.CalculationTime.Dispersion
                };

                ByModel.TotalOutputFileSize = new ValueWithDispersion <ulong>()
                {
                    Value      = otherEstimation.ByModel.TotalOutputFileSize.Value,
                    Dispersion = otherEstimation.ByModel.TotalOutputFileSize.Dispersion
                };

                if (otherEstimation.ByModel.ExtraValues != null)
                {
                    foreach (var pair in otherEstimation.ByModel.ExtraValues)
                    {
                        ByModel.ExtraValues[pair.Key] = pair.Value; // ExtraValues field is created in constructor of ModelEstimation
                    }
                }

                if (otherEstimation.ByModel.OutputFileSize != null)
                {
                    foreach (var pair in otherEstimation.ByModel.OutputFileSize)
                    {
                        ByModel.OutputFileSize[pair.Key] = new ValueWithDispersion <ulong>()
                        {
                            Value      = pair.Value.Value,
                            Dispersion = pair.Value.Dispersion
                        };
                    }
                }
            }
        }
Exemplo n.º 6
0
        public Estimation(Estimation otherEstimation)
        {
            _durationSurrogate = otherEstimation._durationSurrogate;

            if (otherEstimation.FromHistory != null)
                FromHistory = new HistoryEstimation(otherEstimation.FromHistory);

            if (otherEstimation.ModelCoeffs != null)
                ModelCoeffs = new Dictionary<string, double>(otherEstimation.ModelCoeffs);

            if (otherEstimation.ByModel != null)
            {
                ByModel = new ModelEstimation();

                ByModel.CalculationTime = new ValueWithDispersion<double>()
                {
                    Value = otherEstimation.ByModel.CalculationTime.Value,
                    Dispersion = otherEstimation.ByModel.CalculationTime.Dispersion
                };

                ByModel.TotalOutputFileSize = new ValueWithDispersion<ulong>()
                {
                    Value = otherEstimation.ByModel.TotalOutputFileSize.Value,
                    Dispersion = otherEstimation.ByModel.TotalOutputFileSize.Dispersion
                };

                if (otherEstimation.ByModel.ExtraValues != null)
                {
                    foreach (var pair in otherEstimation.ByModel.ExtraValues)
                        ByModel.ExtraValues[pair.Key] = pair.Value; // ExtraValues field is created in constructor of ModelEstimation
                }

                if (otherEstimation.ByModel.OutputFileSize != null)
                {
                    foreach (var pair in otherEstimation.ByModel.OutputFileSize)
                    {
                        ByModel.OutputFileSize[pair.Key] = new ValueWithDispersion<ulong>()
                        {
                            Value = pair.Value.Value,
                            Dispersion = pair.Value.Dispersion
                        };
                    }
                }
            }
        }
Exemplo n.º 7
0
        public void AutoAssign()
        {
            string[]   clusters = ClustersProxy.GetClusterNames();
            Estimation minEst   = null;

            foreach (string cluster in clusters)
            {
                AssignTo(cluster);

                if (this.Time.Estimated.HasValue)
                {
                    TimeSpan curTime = this.Time.Estimated.Value;

                    if (minEst == null || curTime < minEst.Time)
                    {
                        minEst = new Estimation(curTime, this.AssignedTo);
                    }
                }
            }

            AssignTo(minEst);
        }
Exemplo n.º 8
0
        public void AssignTo(string clusterName)
        {
            ResourceNode[] nodes = ClustersProxy.GetNodes(clusterName);

            for (int i = 0; i < nodes.Length; i++)
            {
                // no package = no available cores on this node
                if (!nodes[i].HavePackage(Package))
                {
                    nodes[i].CoresAvailable = 0;
                }
            }

            Estimation minEst = null;

            foreach (LaunchModel model in TaskManager.LaunchModels)
            {
                Estimation curEst = model.EstimateIfMathces(this, nodes);

                if (model.Mathces(this))
                {
                    Log.Info(String.Format(
                                 "Задача {1}, на кластере {2} получена оценка в {3} очков от модели запуска {0}",
                                 model.ToString(), this.TaskId, nodes[0].ClusterName,
                                 (curEst == null)? "--" : "" + ((int)curEst.Time.TotalSeconds).ToString()
                                 ));
                }

                if (curEst != null && (minEst == null || curEst.Time < minEst.Time))
                {
                    minEst = new Estimation(curEst.Time, curEst.ClusterName, curEst.Cores);
                }
            }

            AssignTo(minEst);
        }
Exemplo n.º 9
0
        public void AutoAssign()
        {
            string[] clusters = ClustersProxy.GetClusterNames();
            Estimation minEst = null;

            foreach (string cluster in clusters)
            {
                AssignTo(cluster);

                if (this.Time.Estimated.HasValue)
                {
                    TimeSpan curTime = this.Time.Estimated.Value;

                    if (minEst == null || curTime < minEst.Time)
                        minEst = new Estimation(curTime, this.AssignedTo);
                }
            }

            AssignTo(minEst);
        }
Exemplo n.º 10
0
        protected override Estimation Estimate(TaskDescription task, Resource resource)
        {
			if (task == null || resource == null || !resource.Nodes.Any())
				return null;

			var limits = new[]
			{
				new { pack = "",             otherSoft = "",        maxCores = 1,  maxNodes = 1},
				new { pack = "GAMESS",       otherSoft = "",        maxCores = 1,  maxNodes = 1},
				new { pack = "ORCA",         otherSoft = "windows", maxCores = 1,  maxNodes = 1},
				new { pack = "ORCA",         otherSoft = "",        maxCores = 8,  maxNodes = 1},
				new { pack = "SEMP",         otherSoft = "",        maxCores = 1,  maxNodes = 1},
				new { pack = "Plasmon",      otherSoft = "",        maxCores = 1,  maxNodes = 1},
				new { pack = "QDLaser",      otherSoft = "",        maxCores = 1,  maxNodes = 1},
				new { pack = "JAggregate",   otherSoft = "",        maxCores = 1,  maxNodes = 1},
                //new { pack = "Plasmon",      otherSoft = "",        maxCores = 1,  maxNodes = 1},
                //new { pack = "QDLaser",      otherSoft = "",        maxCores = 8,  maxNodes = 1},
                //new { pack = "JAggregate",   otherSoft = "",        maxCores = 8,  maxNodes = 1},
				//new { pack = "NanoFlow",     otherSoft = "",        maxCores = 16*3, maxNodes = 3},
				new { pack = "NanoFlow",     otherSoft = "",        maxCores = 8,  maxNodes = 1},
				new { pack = "MD_KMC",       otherSoft = "",        maxCores = 8,  maxNodes = 1},
				new { pack = "MD_KMC",       otherSoft = "windows", maxCores = 0,  maxNodes = 0},
				new { pack = "NTDMFT",       otherSoft = "",        maxCores = 8,  maxNodes = 1},
				new { pack = "Dalton",       otherSoft = "",        maxCores = 1,  maxNodes = 1},
				new { pack = "NAEN",         otherSoft = "",        maxCores = 1,  maxNodes = 1},
				new { pack = "Upconversion", otherSoft = "",        maxCores = 8,  maxNodes = 1},
				new { pack = "TestP",        otherSoft = "",        maxCores = 1,  maxNodes = 1},
				new { pack = "Belman",       otherSoft = "",        maxCores = 8,  maxNodes = 1},
				new { pack = "SWAN",         otherSoft = "",        maxCores = 1,  maxNodes = 1},
			};

            var packLimits = limits.Where(l => String.IsNullOrWhiteSpace(l.pack));
            if (limits.Any(limit => limit.pack.ToLower() == task.Package.ToLower()))
                packLimits = limits.Where(limit => limit.pack.ToLower() == task.Package.ToLower());

			// selecting proper limit (maximize software matches):
            
            var properPackLimit = packLimits.First();
			int maxSoftMatches = 0;
            
            foreach (var packLimit in packLimits)
			{
				int softMathcesCount = 0;
				string[] otherSoft = packLimit.otherSoft.Split(new char[] { ' ', '\t', '\r', '\n', ',', ';' }, StringSplitOptions.RemoveEmptyEntries);

				foreach (string soft in otherSoft)
				{
					// todo : [future] packs on different nodes can be different
					if (resource.Nodes.First().OtherSoftware.Contains(soft.ToLower()))
						softMathcesCount++;
				}

				if (softMathcesCount > maxSoftMatches || (packLimit.maxCores > properPackLimit.maxCores && softMathcesCount == maxSoftMatches))
				{
					maxSoftMatches = softMathcesCount;
					properPackLimit = packLimit;
				}
			}

            // Choose number of cores for each node:

            var coresOnNode = new List<int>();
			int coresToDo = properPackLimit.maxCores;
			int nodesToDo = properPackLimit.maxNodes;

			foreach (var node in resource.Nodes)
			{
                if (coresToDo > 0 && nodesToDo > 0)
                {
                    int coresOnCurrentNode = Math.Min(node.CoresAvailable, coresToDo);

                    coresOnNode.Add(coresOnCurrentNode);
                    coresToDo -= coresOnCurrentNode;
                    nodesToDo -= (coresOnCurrentNode == 0) ? 0 : 1;
                }
                else
                    coresOnNode.Add(0);
			}

			int coresFound = coresOnNode.Sum();
			if (coresFound == 0) // haven't found anything
				return null;

            // Estimate (clusters with more nodes are preferable, so subtract it's nodes.Count from time estimation):

			TimeSpan time = new TimeSpan((long) ((Math.Round(18000.0 / coresFound) - resource.Nodes.Count + 60)*SEC_IN_TICKS));
            Estimation estimation = new Estimation(task.TaskId, resource.ProviderName, resource.ResourceName, coresOnNode.ToArray()) 
                { ExecutionTime = time };

			return estimation;
		}
Exemplo n.º 11
0
        protected override Estimation Estimate(TaskDescription task, Resource resource)
        {
            if (task == null || resource == null || !resource.Nodes.Any())
            {
                return(null);
            }

            var limits = new[]
            {
                new { pack = "", otherSoft = "", maxCores = 1, maxNodes = 1 },
                new { pack = "GAMESS", otherSoft = "", maxCores = 1, maxNodes = 1 },
                new { pack = "ORCA", otherSoft = "windows", maxCores = 1, maxNodes = 1 },
                new { pack = "ORCA", otherSoft = "", maxCores = 8, maxNodes = 1 },
                new { pack = "SEMP", otherSoft = "", maxCores = 1, maxNodes = 1 },
                new { pack = "Plasmon", otherSoft = "", maxCores = 1, maxNodes = 1 },
                new { pack = "QDLaser", otherSoft = "", maxCores = 1, maxNodes = 1 },
                new { pack = "JAggregate", otherSoft = "", maxCores = 1, maxNodes = 1 },
                //new { pack = "Plasmon",      otherSoft = "",        maxCores = 1,  maxNodes = 1},
                //new { pack = "QDLaser",      otherSoft = "",        maxCores = 8,  maxNodes = 1},
                //new { pack = "JAggregate",   otherSoft = "",        maxCores = 8,  maxNodes = 1},
                //new { pack = "NanoFlow",     otherSoft = "",        maxCores = 16*3, maxNodes = 3},
                new { pack = "NanoFlow", otherSoft = "", maxCores = 8, maxNodes = 1 },
                new { pack = "MD_KMC", otherSoft = "", maxCores = 8, maxNodes = 1 },
                new { pack = "MD_KMC", otherSoft = "windows", maxCores = 0, maxNodes = 0 },
                new { pack = "NTDMFT", otherSoft = "", maxCores = 8, maxNodes = 1 },
                new { pack = "Dalton", otherSoft = "", maxCores = 1, maxNodes = 1 },
                new { pack = "NAEN", otherSoft = "", maxCores = 1, maxNodes = 1 },
                new { pack = "Upconversion", otherSoft = "", maxCores = 8, maxNodes = 1 },
                new { pack = "TestP", otherSoft = "", maxCores = 1, maxNodes = 1 },
                new { pack = "Belman", otherSoft = "", maxCores = 8, maxNodes = 1 },
                new { pack = "SWAN", otherSoft = "", maxCores = 1, maxNodes = 1 },
            };

            var packLimits = limits.Where(l => String.IsNullOrWhiteSpace(l.pack));

            if (limits.Any(limit => limit.pack.ToLower() == task.Package.ToLower()))
            {
                packLimits = limits.Where(limit => limit.pack.ToLower() == task.Package.ToLower());
            }

            // selecting proper limit (maximize software matches):

            var properPackLimit = packLimits.First();
            int maxSoftMatches  = 0;

            foreach (var packLimit in packLimits)
            {
                int      softMathcesCount = 0;
                string[] otherSoft        = packLimit.otherSoft.Split(new char[] { ' ', '\t', '\r', '\n', ',', ';' }, StringSplitOptions.RemoveEmptyEntries);

                foreach (string soft in otherSoft)
                {
                    // todo : [future] packs on different nodes can be different
                    if (resource.Nodes.First().OtherSoftware.Contains(soft.ToLower()))
                    {
                        softMathcesCount++;
                    }
                }

                if (softMathcesCount > maxSoftMatches || (packLimit.maxCores > properPackLimit.maxCores && softMathcesCount == maxSoftMatches))
                {
                    maxSoftMatches  = softMathcesCount;
                    properPackLimit = packLimit;
                }
            }

            // Choose number of cores for each node:

            var coresOnNode = new List <int>();
            int coresToDo   = properPackLimit.maxCores;
            int nodesToDo   = properPackLimit.maxNodes;

            foreach (var node in resource.Nodes)
            {
                if (coresToDo > 0 && nodesToDo > 0)
                {
                    int coresOnCurrentNode = Math.Min(node.CoresAvailable, coresToDo);

                    coresOnNode.Add(coresOnCurrentNode);
                    coresToDo -= coresOnCurrentNode;
                    nodesToDo -= (coresOnCurrentNode == 0) ? 0 : 1;
                }
                else
                {
                    coresOnNode.Add(0);
                }
            }

            int coresFound = coresOnNode.Sum();

            if (coresFound == 0)             // haven't found anything
            {
                return(null);
            }

            // Estimate (clusters with more nodes are preferable, so subtract it's nodes.Count from time estimation):

            TimeSpan   time       = new TimeSpan((long)((Math.Round(18000.0 / coresFound) - resource.Nodes.Count + 60) * SEC_IN_TICKS));
            Estimation estimation = new Estimation(task.TaskId, resource.ProviderName, resource.ResourceName, coresOnNode.ToArray())
            {
                ExecutionTime = time
            };

            return(estimation);
        }