next up previous contents
Next: Defining a group Up: Parallelizing the Quantum Computing Previous: Initialising the parallelization from   Contents

Initialising the parallelization from every other node

Every other node than the root node, is caught in a while(1) loop, in a function in the "receive.cc" class. When parallelization occurs, each node receives the dimension of the matrix. This also doubles as allowing the nodes to terminate gracefully when the program exits. In this case, the root node broadcasts a predefined exit matrix to the nodes, allowing them to exit gracefully. Each node then receives which algorithm to use, and calls the appropriate algorithm via a switch statement;
\begin{lstlisting}[frame=trbl,caption=Extract from receive.cc]{}
while(1) {
......
...recvMatrix4(dim); break;
case 5: recvMatrix5(dim); break;
}
}
\end{lstlisting}



Colm O hEigeartaigh 2003-05-30