Changeset 9323
- Timestamp:
- 03/20/13 16:51:58 (12 years ago)
- Location:
- trunk/sources
- Files:
-
- 9 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab 3.3.sln
r9179 r9323 28 28 {B7FA451C-26BF-4EE5-8E0E-BECAADA5B8E9} = {B7FA451C-26BF-4EE5-8E0E-BECAADA5B8E9} 29 29 {E226881D-315F-423D-B419-A766FE0D8685} = {E226881D-315F-423D-B419-A766FE0D8685} 30 {D34A7620-3E23-40D9-8647-637BE901F271} = {D34A7620-3E23-40D9-8647-637BE901F271} 30 31 {F62BCD22-FB83-4444-9401-8031C2487A86} = {F62BCD22-FB83-4444-9401-8031C2487A86} 31 32 {E0B45023-CB84-48A1-A1B7-8295B64B7BAD} = {E0B45023-CB84-48A1-A1B7-8295B64B7BAD} … … 376 377 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.Instances.Scheduling-3.3", "HeuristicLab.Problems.Instances.Scheduling\3.3\HeuristicLab.Problems.Instances.Scheduling-3.3.csproj", "{9D792B6D-836B-46DC-9D69-50B4B1E7B87F}" 377 378 EndProject 379 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.ParallelEngine.Views", "HeuristicLab.ParallelEngine.Views\3.3\HeuristicLab.ParallelEngine.Views.csproj", "{D34A7620-3E23-40D9-8647-637BE901F271}" 380 EndProject 378 381 Global 379 382 GlobalSection(SolutionConfigurationPlatforms) = preSolution … … 386 389 EndGlobalSection 387 390 GlobalSection(ProjectConfigurationPlatforms) = postSolution 391 {B1DCDECA-B56E-41D5-9850-EF0D3A77DEAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 392 {B1DCDECA-B56E-41D5-9850-EF0D3A77DEAF}.Debug|Any CPU.Build.0 = Debug|Any CPU 393 {B1DCDECA-B56E-41D5-9850-EF0D3A77DEAF}.Debug|x64.ActiveCfg = Debug|x64 394 {B1DCDECA-B56E-41D5-9850-EF0D3A77DEAF}.Debug|x64.Build.0 = Debug|x64 395 {B1DCDECA-B56E-41D5-9850-EF0D3A77DEAF}.Debug|x86.ActiveCfg = Debug|x86 396 {B1DCDECA-B56E-41D5-9850-EF0D3A77DEAF}.Debug|x86.Build.0 = Debug|x86 397 {B1DCDECA-B56E-41D5-9850-EF0D3A77DEAF}.Release|Any CPU.ActiveCfg = Release|Any CPU 398 {B1DCDECA-B56E-41D5-9850-EF0D3A77DEAF}.Release|Any CPU.Build.0 = Release|Any CPU 399 {B1DCDECA-B56E-41D5-9850-EF0D3A77DEAF}.Release|x64.ActiveCfg = Release|x64 400 {B1DCDECA-B56E-41D5-9850-EF0D3A77DEAF}.Release|x64.Build.0 = Release|x64 401 {B1DCDECA-B56E-41D5-9850-EF0D3A77DEAF}.Release|x86.ActiveCfg = Release|x86 402 {B1DCDECA-B56E-41D5-9850-EF0D3A77DEAF}.Release|x86.Build.0 = Release|x86 388 403 {94186A6A-5176-4402-AE83-886557B53CCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 389 404 {94186A6A-5176-4402-AE83-886557B53CCA}.Debug|Any CPU.Build.0 = Debug|Any CPU … … 506 521 {6A5F8C2D-B0C3-4B36-BC20-9B1A91EE6DB6}.Release|x86.ActiveCfg = Release|x86 507 522 {6A5F8C2D-B0C3-4B36-BC20-9B1A91EE6DB6}.Release|x86.Build.0 = Release|x86 508 {B1DCDECA-B56E-41D5-9850-EF0D3A77DEAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU509 {B1DCDECA-B56E-41D5-9850-EF0D3A77DEAF}.Debug|Any CPU.Build.0 = Debug|Any CPU510 {B1DCDECA-B56E-41D5-9850-EF0D3A77DEAF}.Debug|x64.ActiveCfg = Debug|x64511 {B1DCDECA-B56E-41D5-9850-EF0D3A77DEAF}.Debug|x64.Build.0 = Debug|x64512 {B1DCDECA-B56E-41D5-9850-EF0D3A77DEAF}.Debug|x86.ActiveCfg = Debug|x86513 {B1DCDECA-B56E-41D5-9850-EF0D3A77DEAF}.Debug|x86.Build.0 = Debug|x86514 {B1DCDECA-B56E-41D5-9850-EF0D3A77DEAF}.Release|Any CPU.ActiveCfg = Release|Any CPU515 {B1DCDECA-B56E-41D5-9850-EF0D3A77DEAF}.Release|Any CPU.Build.0 = Release|Any CPU516 {B1DCDECA-B56E-41D5-9850-EF0D3A77DEAF}.Release|x64.ActiveCfg = Release|x64517 {B1DCDECA-B56E-41D5-9850-EF0D3A77DEAF}.Release|x64.Build.0 = Release|x64518 {B1DCDECA-B56E-41D5-9850-EF0D3A77DEAF}.Release|x86.ActiveCfg = Release|x86519 {B1DCDECA-B56E-41D5-9850-EF0D3A77DEAF}.Release|x86.Build.0 = Release|x86520 523 {EE2034D9-6E27-48A1-B855-42D45F69A4FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 521 524 {EE2034D9-6E27-48A1-B855-42D45F69A4FC}.Debug|Any CPU.Build.0 = Debug|Any CPU … … 1826 1829 {9D792B6D-836B-46DC-9D69-50B4B1E7B87F}.Release|x86.ActiveCfg = Release|x86 1827 1830 {9D792B6D-836B-46DC-9D69-50B4B1E7B87F}.Release|x86.Build.0 = Release|x86 1831 {D34A7620-3E23-40D9-8647-637BE901F271}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 1832 {D34A7620-3E23-40D9-8647-637BE901F271}.Debug|Any CPU.Build.0 = Debug|Any CPU 1833 {D34A7620-3E23-40D9-8647-637BE901F271}.Debug|x64.ActiveCfg = Debug|x64 1834 {D34A7620-3E23-40D9-8647-637BE901F271}.Debug|x64.Build.0 = Debug|x64 1835 {D34A7620-3E23-40D9-8647-637BE901F271}.Debug|x86.ActiveCfg = Debug|x86 1836 {D34A7620-3E23-40D9-8647-637BE901F271}.Debug|x86.Build.0 = Debug|x86 1837 {D34A7620-3E23-40D9-8647-637BE901F271}.Release|Any CPU.ActiveCfg = Release|Any CPU 1838 {D34A7620-3E23-40D9-8647-637BE901F271}.Release|Any CPU.Build.0 = Release|Any CPU 1839 {D34A7620-3E23-40D9-8647-637BE901F271}.Release|x64.ActiveCfg = Release|x64 1840 {D34A7620-3E23-40D9-8647-637BE901F271}.Release|x64.Build.0 = Release|x64 1841 {D34A7620-3E23-40D9-8647-637BE901F271}.Release|x86.ActiveCfg = Release|x86 1842 {D34A7620-3E23-40D9-8647-637BE901F271}.Release|x86.Build.0 = Release|x86 1828 1843 EndGlobalSection 1829 1844 GlobalSection(SolutionProperties) = preSolution -
trunk/sources/HeuristicLab.ParallelEngine/3.3/ParallelEngine.cs
r7259 r9323 37 37 public class ParallelEngine : Engine { 38 38 private CancellationToken cancellationToken; 39 private ParallelOptions parallelOptions; 40 41 [Storable(DefaultValue = -1)] 42 private int degreeOfParallelism; 43 public int DegreeOfParallelism { 44 get { return degreeOfParallelism; } 45 set { 46 if (degreeOfParallelism != value) { 47 degreeOfParallelism = value; 48 OnDegreeOfParallelismChanged(); 49 } 50 } 51 } 39 52 40 53 [StorableConstructor] 41 54 protected ParallelEngine(bool deserializing) : base(deserializing) { } 42 protected ParallelEngine(ParallelEngine original, Cloner cloner) : base(original, cloner) { } 55 protected ParallelEngine(ParallelEngine original, Cloner cloner) 56 : base(original, cloner) { 57 this.DegreeOfParallelism = original.DegreeOfParallelism; 58 } 43 59 public ParallelEngine() : base() { } 44 60 … … 47 63 } 48 64 65 public event EventHandler DegreeOfParallelismChanged; 66 protected void OnDegreeOfParallelismChanged() { 67 var handler = DegreeOfParallelismChanged; 68 if (handler != null) handler(this, EventArgs.Empty); 69 } 70 71 49 72 protected override void Run(CancellationToken cancellationToken) { 50 73 this.cancellationToken = cancellationToken; 74 parallelOptions = new ParallelOptions(); 75 parallelOptions.MaxDegreeOfParallelism = DegreeOfParallelism; 51 76 Run(ExecutionStack); 52 77 } … … 65 90 coll = (OperationCollection)next; 66 91 if (coll.Parallel) { 67 Task[] tasks = new Task[coll.Count];68 92 Stack<IOperation>[] stacks = new Stack<IOperation>[coll.Count]; 69 93 for (int i = 0; i < coll.Count; i++) { 70 94 stacks[i] = new Stack<IOperation>(); 71 95 stacks[i].Push(coll[i]); 72 tasks[i] = Task.Factory.StartNew(Run, stacks[i], cancellationToken);73 96 } 74 97 try { 75 Task.WaitAll(tasks);98 Parallel.ForEach(stacks, parallelOptions, Run); 76 99 } 77 100 catch (AggregateException ex) {
Note: See TracChangeset
for help on using the changeset viewer.