15.11.2013 Views

Esqueleto Algorítmico - ulpgc

Esqueleto Algorítmico - ulpgc

Esqueleto Algorítmico - ulpgc

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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 />

Código MPI Centralizado de MaLLBa:BnB: Maestro<br />

1 busy[0] = 1; for i = 1, nProcs { busy[i] = 0; }<br />

2 idle = nProcs - 1;<br />

3 auxbqueue; // queue of subproblems sent by the slave<br />

4 bqueue.insertAtBack(sp); // Insert the subproblem into the queue<br />

5 while ((!bqueue.empty()) || (idle < groupSize)) { // Stop condition<br />

6 while ((!bqueue.empty()) && (idle > 0)) {<br />

7 auxSp = bqueue.removeFromFront();<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 />

8 op.send(firstidle, auxSp, bestSol, sol);<br />

9 idle--;<br />

10 IDLE2WORKING(busy, lastIdle); mark slave as working<br />

11 }<br />

12 MLB_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, flag, status)<br />

13 while (flag) {<br />

14 if (MPI_SOLVE_TAG) {<br />

15 ip.recv(source, bestSol, sol);<br />

Mª Isabel Dorta González<br />

Marzo, 2007<br />

16 WORKING2IDLE(busy, source); // mark the slave as idle<br />

17 }

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!