next up previous contents index
Next: Issues in the Language Up: The HPspmd Model and Previous: Java Packages for HPspmd   Contents   Index


Programming Examples

Figure 1.6: Choleski decomposition.
\begin{figure}\begin{center}
\begin{small}
\begin{verbatim}Procs1 p = new Pro...
...,l] = Math.sqrt(a[N-1,l]) ;
}\end{verbatim}\end{small} \end{center}\end{figure}

In this section we give two example programs to show the new language features. The first example is the Choleski decomposition, seen in Figure 1.6. Here, remap is used to broadcast one updated column to each process. The function idx gets the global index of location m relative to the parent range x. The second example is the Jacobi iteration, seen in Figure 1.7. In the displayed code there is only one iteration, but it demonstrates how to define range references with ghost areas, how to use the writeHalo function, and how to use shifted locations as subscripts.

Figure 1.7: Jacobi relaxation.
\begin{figure}\begin{center}
\begin{small}
\begin{verbatim}Procs2 p = new Pro...
...\vert : )
a[i,j] = b[i,j];
}\end{verbatim}\end{small} \end{center}\end{figure}



Bryan Carpenter 2002-07-11