) begin |
(2) Data: (the set of tasks); |
(3) (communication graph); |
(4) (the set of processors); |
(5) (the background load of processors); |
(6) Result: M: ; // A task mapping |
(7) nObjs NumObjs; // number of migratable objects |
(8) ObjectHeap objHeap(nObjs + 1); // declare a object heap objHeap |
(9) maxhAllObjs; // max for all migratable objects |
(10) ProcessorHeap lightProcessors(P); // declare a processor heap lightProcessors |
(11) lightProcessors; |
(12) for 1 to nObjs do |
(13) minLoad MAX_DOUBLE; // Initially the minimum load minLoad are set to MAX_DOUBLE |
(14) o objHeap.deleteMax(); // Find the object o with high loads |
(15) cpuDonor lightProcessors->deleteMin(); // Find the migratable target (processor) with light loads |
(16) ; // comm_cost represents communication cost |
(17) newLoad cpuDonor.load + comm_cost; // Recalculate new load considering communication cost |
(18) if newload < minLoad then |
(19) minLoad newLoad; |
(20) newDonor cpuDonor; // Find new migratable processor |
(21) end if |
(22) for cpuDonor _comm do |
(23) ; |
(24) newLoad cpuDonor.load + comm_cost; |
(25) if newLoad < minLoad then |
(26) minLoad newLoad; |
(27) newDonor cpuDonor; // newDonor: new migratable processor |
(28) end if |
(29) end for |
(30) o newDonor; // Allocating task o to processor newDonor |
(31) Update(objHeap); |
(32) Update(lightProcessors); |
(33) end for |
(34) if objHeap.deleteMax() > sit_max then // sit_max: threshold |
(35) // failed |
(36) LB_TopManager(); // initiate load balancing on top level |
(37) else |
(38) // succeed; |
(39) end if |
(40) end |