Esqueleto Algorítmico - ulpgc
Esqueleto Algorítmico - ulpgc
Esqueleto Algorítmico - ulpgc
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Implementación Secuencial y Paralela de Técnicas Algorítmicas:<br />
Aplicación a Problemas de Optimización Combinatoria<br />
Seminario Invitado: Dpto Métodos Cuantitativos en Economía y Gestión<br />
Introducción<br />
Interfaz de Usuario<br />
Patrones<br />
Secuenciales<br />
Patrones<br />
Paralelos<br />
Experimentos<br />
Computacionales<br />
Conclusiones<br />
Patrón B&B Paralelo<br />
Centralizado<br />
Patrón B&B Paralelo<br />
Distribuido<br />
Patrón B&B Memoria<br />
Compartida<br />
Patrón D&C Paralelo<br />
Mª Isabel Dorta González<br />
Marzo, 2007<br />
Código MPI Distribuido de MaLLBa:BnB: Maestro<br />
1 busy[0] = 1; for i = 1, nProcs { busy[i] = 0;}<br />
2 idle = nProcs - 1;<br />
3 // Send initial subproblem to first idle slave<br />
4 auxSp = sp.initSubProblem();<br />
5 op.send(firstIdle, auxSp, bestSol, sol);<br />
6 idle--;<br />
7 IDLE2WORKING(busy,firstIdle); // mark this slave like working<br />
8 while (idle < (groupSize-1)) { // while there are working slaves<br />
9 recv(source, flag);<br />
10 while(flag) {<br />
11 if (SOLVE_TAG) { // receive the final solution<br />
12 ip.recv(source, bestSol, sol);<br />
13 }<br />
14 if (BnB_TAG) { // receive a slave request<br />
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .<br />
30 }<br />
31 if (IDLE_TAG) { // receive the signal of an idle slave<br />
32 ip.recv(source, IDLE);<br />
33 idle++;<br />
34 WORKING2IDLE(busy,source); // mark this slave like idle<br />
35 }<br />
36 recv(source, flag);<br />
37 } } // while (idle < (groupSize-1))<br />
38 // Send the ending message<br />
39 for i = 1, groupSize { op.send(i, END); }