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

Initialising the QCL to run on multiple nodes of the cluster

The parallel programming library used in this project, the Message Passing Interface, cannot be started and run from within another program. It must be started from the command-line, as it must be run with the mpirun command, which specifies the number of nodes the code should be run on. The initialisation program of the QCL, "qcl.cc", had to be altered to accommodate this. After compilation using the MPI C++ compiler; instead of running the qcl simply by entering ./qcl, it must be started like the following;


\begin{lstlisting}[frame=trbl]{}
mpirun -np <nodes> -machinefile <nodes file> ./qcl
\end{lstlisting}


Any MPI program must have certain code at the start, to initialise running the program over multiple nodes. This code gets the rank of each node, where zero is the rank of the root node, and the size of the process, ie how many nodes are running the program in total. This information is needed in the parallel routines themselves, so the rank and size are declared as global variables. The user only wants to type information into one node, and then parallelize the computation over multiple nodes. Therefore, after the rank is determined on each node, every rank except the zero rank, or root node, is shunted into a function where it remains inside a while(1) loop until it receives the command from the head node to exit the function.


\begin{lstlisting}[frame=trbl,caption=Extract from qcl.cc]{}
int rank = 0;
int s...
...ogram
if(rank != 0) {
recvMatrix();
return 0;
}
....
}
\par\end{lstlisting}



next up previous contents
Next: Initialising the parallelization from Up: Parallelizing the Quantum Computing Previous: Motivation   Contents
Colm O hEigeartaigh 2003-05-30