Changeset 6394 for branches/MPI/HeuristicLab.MPIEngine
- Timestamp:
- 06/08/11 14:26:36 (13 years ago)
- Location:
- branches/MPI/HeuristicLab.MPIEngine/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/MPI/HeuristicLab.MPIEngine/3.3/HeuristicLab.MPIEngine-3.3.csproj
r6393 r6394 128 128 <HintPath>..\..\HeuristicLab.ExtLibs\HeuristicLab.MPInet\MPIAlgorithmRunner\3.3\Microsoft.Hpc.Scheduler.dll</HintPath> 129 129 </Reference> 130 <Reference Include="Microsoft.Hpc.Scheduler.Properties, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> 131 <HintPath>..\..\Microsoft.Hpc.Scheduler.Properties.dll</HintPath> 132 </Reference> 130 133 <Reference Include="System" /> 131 134 <Reference Include="System.Core" /> 135 <Reference Include="System.Runtime.Serialization" /> 132 136 <Reference Include="System.ServiceModel" /> 133 137 <Reference Include="System.Xml.Linq" /> -
branches/MPI/HeuristicLab.MPIEngine/3.3/MPIEngine.cs
r6388 r6394 35 35 using HeuristicLab.MPIAlgorithmRunner; 36 36 using HeuristicLab.Operators.MPISupport; 37 using Microsoft.Hpc.Scheduler.Properties; 38 using System.Xml; 37 39 38 40 namespace HeuristicLab.MPIEngine { … … 74 76 } 75 77 78 protected override void OnPaused() { 79 base.OnPaused(); 80 81 Stop(); 82 } 83 76 84 protected override void Run(System.Threading.CancellationToken cancellationToken) { 85 string username = @"user"; 86 string password = @"password"; 87 string headNode = "blade00.hpc.fh-hagenberg.at"; 88 List<string> requestedNodes = new List<string>(); 89 requestedNodes.Add("BLADE00"); 90 string path = @"C:\public\MPISupport"; 91 int cpuPerNode = 8; 92 77 93 if (ExecutionStack.Count == 1) { 78 94 ExecutionContext context = ExecutionStack.Pop() as ExecutionContext; … … 81 97 82 98 string exec = @"mpiexec"; 83 string args = @"-c 3 C:\public\MPISupport\HeuristicLab.MPIAlgorithmRunner-3.3.exe";99 string args = @"-c " + cpuPerNode + " /genvlist CCP_JOBID " + path + @"\HeuristicLab.MPIAlgorithmRunner-3.3.exe"; 84 100 85 101 IScheduler scheduler = new Scheduler(); 86 scheduler.Connect( "blade00.hpc.fh-hagenberg.at");102 scheduler.Connect(headNode); 87 103 88 104 ISchedulerJob job = scheduler.CreateJob(); 89 105 job.Name = "HeuristicLab.MPIEngine"; 90 job.RequestedNodes.Add("BLADE03"); 106 foreach (string requestedNode in requestedNodes) 107 job.RequestedNodes.Add(requestedNode); 91 108 ISchedulerTask task = job.CreateTask(); 92 109 task.Name = "HeuristicLab.MPIAlgorithmRunner"; … … 94 111 task.StdOutFilePath = "stdout.txt"; 95 112 task.StdErrFilePath = "stderr.txt"; 113 task.WorkDirectory = path; 96 114 task.MinimumNumberOfCores = task.MaximumNumberOfCores = 3; 97 115 job.AddTask(task); 98 116 99 scheduler.SubmitJob(job, @"HPC\svonolfe", @"Vunkopf!3");117 scheduler.SubmitJob(job, username, ""); 100 118 101 119 try { … … 104 122 105 123 while (address == null && timeout > 0) { 124 cancellationToken.ThrowIfCancellationRequested(); 125 106 126 ISchedulerJob schedulerJob = scheduler.OpenJob(job.Id); 107 127 if (schedulerJob != null) { 108 INameValueCollection properties = schedulerJob.GetCustomProperties();109 NameValue item = properties.FirstOrDefault(i => i.Name == "address"); 110 if ( item!= null) {111 address = item.Value;128 NameValue property = schedulerJob.GetCustomProperties().FirstOrDefault(p => p.Name == "address"); 129 130 if (property != null) { 131 address = property.Value; 112 132 } else { 113 133 System.Threading.Thread.Sleep(1000); 114 134 timeout--; 115 135 } 116 } 136 } 117 137 } 118 138 … … 122 142 123 143 NetTcpBinding netTCPBinding = new NetTcpBinding(SecurityMode.None); 144 XmlDictionaryReaderQuotas quotas = new XmlDictionaryReaderQuotas(); 145 quotas.MaxArrayLength = int.MaxValue; 146 netTCPBinding.ReaderQuotas = quotas; 147 netTCPBinding.MaxReceivedMessageSize = int.MaxValue; 124 148 ChannelFactory<IAlgorithmBroker> factory = new ChannelFactory<IAlgorithmBroker>(netTCPBinding, address); 125 149 IAlgorithmBroker proxy = factory.CreateChannel(); … … 128 152 129 153 while (!proxy.IsAlgorithmTerminated()) { 154 cancellationToken.ThrowIfCancellationRequested(); 155 130 156 ItemList<ResultCollection> results = proxy.GetResults().InnerItem; 131 157 … … 143 169 } 144 170 catch (Exception e) { 145 scheduler.CancelJob(job.Id, "Exception: " + e. Message);171 scheduler.CancelJob(job.Id, "Exception: " + e.GetType()); 146 172 throw e; 173 } 174 finally { 175 /*ISchedulerJob schedulerJob = scheduler.OpenJob(job.Id); 176 if (schedulerJob != null && 177 (schedulerJob.State == JobState.Running || schedulerJob.State == JobState.Queued)) { 178 scheduler.CancelJob(job.Id, "Cancelled"); 179 } */ 147 180 } 148 181 }
Note: See TracChangeset
for help on using the changeset viewer.