\batchmode

\documentstyle[psfig]{llncs}
\makeatletter


\makeatother
\newenvironment{tex2html_wrap}{}{}
\newwrite\lthtmlwrite
\def\lthtmltypeout#1{{\let\protect\string\immediate\write\lthtmlwrite{#1}}}%
\newbox\sizebox
\begin{document}
\pagestyle{empty}
\stepcounter{section}
\stepcounter{section}
{\newpage
\clearpage
\samepage \setbox\sizebox=\hbox{$\times$}\lthtmltypeout{latex2htmlSize :tex2html_wrap_inline508: \the\ht\sizebox::\the\dp\sizebox.}\box\sizebox
}

\stepcounter{section}
\stepcounter{subsection}
{\newpage
\clearpage
\samepage \begin{figure}[htb]
  \begin{center}
    \leavevmode
    \psfig{figure=procs.eps,width=2.2in} 
    
    \label{fig:procs}
  \end{center}
\end{figure}
}

{\newpage
\clearpage
\samepage \setbox\sizebox=\hbox{$0,\ldots,n-1$}\lthtmltypeout{latex2htmlSize :tex2html_wrap_inline512: \the\ht\sizebox::\the\dp\sizebox.}\box\sizebox
}

{\newpage
\clearpage
\samepage \begin{figure}[htb]
  \begin{center}
    \leavevmode
    \psfig{figure=ranges.eps,height=1.9in} 
    
    \label{fig:ranges}
  \end{center}
\end{figure}
}

{\newpage
\clearpage
\samepage \begin{figure}[htb]
  \begin{center}
    \leavevmode
    \psfig{figure=arrays.eps,height=2.8in} 
    
    \label{fig:arrays}
  \end{center}
\end{figure}
}

\stepcounter{subsection}
{\newpage
\clearpage
\samepage \begin{figure}[ht]
\center{
\footnotesize
\begin{verbatim}  Procs2 p = new Procs2(P,P);
  Range x = p.dim(0), y = p.dim(1);
  on(p) {
    float [[,,*,*]] a = new float [[x,y,B,B]]; 
    float [[,,*,*]] b = new float [[x,y,B,B]]; 

    ... initialize a, b elements ...

    float [[,,*,*]] c = new float [[x,y,B,B]]; 
    float [[,,*,*]] tmp = new float [[x,y,B,B]]; 
                  
    for (int k = 0; k<P; k++) {
      overall(i = x) {
        float [[*,*]] sub = new float [[B,B]];    
        Adlib.remap(sub, a[[i, (x.idx(i) + k) % P, :, :]]);
                          // Broadcast sub-matrix of 'a'
        overall(j = y)
          matmul(c[[i, j, :, :]], sub, b[[i, j, :, :]]);
                          // Local matrix multiplication
      }
      Adlib.shift(tmp, b, 1, 0, CYCLIC); 
                          // Cyclic shift 'b' in first dim, amount 1
      Adlib.copy(b, tmp);
    }
  }\end{verbatim}
}

\label{fig:HPfox}
\end{figure}
}

{\newpage
\clearpage
\samepage \setbox\sizebox=\hbox{$P^2$}\lthtmltypeout{latex2htmlSize :tex2html_wrap_inline558: \the\ht\sizebox::\the\dp\sizebox.}\box\sizebox
}

{\newpage
\clearpage
\samepage \begin{figure}[htbp]
\center{
\scriptsize
\begin{verbatim}class Fox {
  final static int P=2;
  final static int B=4;

  public static void matmul(Array2Float c,Array2Float a,Array2Float b) {
    ... implemented in next section ...
  };

  public static void main(String argv[]) {
    SpmdEnv spmd = new SpmdEnv(argv);
    Procs2 p=new Procs2(P,P);
    Range x=p.dim(0); Range y=p.dim(1); 
    if(p.on()) {
      Section4ddccF a = new Array4ddccF(spmd.apg,x,y,B,B);
      Section4ddccF b = new Array4ddccF(spmd.apg,x,y,B,B);

      ... initialize a, b elements ...

      Section4ddccF c = new Array4ddccF(spmd.apg,x,y,B,B);
      Section4ddccF tmp = new Array4ddccF(spmd.apg,x,y,B,B);

      for (int k=0; k<P; k++) {
        for (int i=0; i<P; i++) {
          Location ii = x.location(i);
          if (ii.at()) {
            Section2ccF sub = new Array2ccF(spmd.apg,B,B);
            Location kk = a.rng(1).location((i + k) % P) ;
            Adlib.remap(sub,
                new Array2ccF(a.grp().restrict(ii).restrict(kk),
                              a.map(2), a.map(3), a.dat(),
                              a.map(0).offset(ii) + a.map(1).offset(kk)) ;
                                  // Broadcast sub-matrix of 'a'
            for (int j=0; j<P; j++) {
              Location jj = y.location(j);
              if (jj.at()) {
                matmul(new Array2ccF(c.grp().restrict(ii).restrict(jj),
                                     c.map(2), c.map(3), c.dat(),
                                     c.map(0).offset(ii) + c.map(1).offset(jj)),
                       new Array2ccF(b.grp().restrict(ii).restrict(jj),
                                     b.map(2), b.map(3), b.dat(),
                                     b.map(0).offset(ii) + b.map(1).offset(jj))) ;
                          // Local matrix multiplication
              } jj.ta();
            }
          } ii.ta();
        }
        Adlib.shift(tmp, b, 1, 0, 0); 
                          // Cyclic shift 'b' in first dim, amount 1
        Adlib.copy(b, tmp);
      }
    }
  }
}\end{verbatim}
}

\label{fig:adfox}
\end{figure}
}

\stepcounter{subsection}
{\newpage
\clearpage
\samepage \begin{figure}[htb]
\center{
\footnotesize
\begin{verbatim}  public static void matmul(Section2ccF c, Section2ccF a, Section2ccF b) {

    Map c_u0=c.map(0);
    Map c_u1=c.map(1);

    final int i_c_bas=c_u0.disp();
    final int i_c_stp=c_u0.step();
    final int j_c_bas=c_u1.disp();
    final int j_c_stp=c_u1.step();

    ... similar inquiries for a and b ...

    for (int i=0; i<B; i++) {
      for (int j=0; j<B; j++) {
        for (int k=0; k<B; k++) {
          c.data[i_c_bas + i_c_stp * i + j_c_bas + j_c_stp * j] +=
            a.data[i_a_bas + i_a_stp * i + k_a_bas + k_a_stp * k] *
            b.data[k_b_bas + k_b_stp * k + j_b_bas + j_b_stp * j];
        }
      }
    }
  }\end{verbatim}
}

\end{figure}
}

\stepcounter{section}
\stepcounter{subsection}
\stepcounter{subsection}
\stepcounter{subsection}
\stepcounter{subsection}
\stepcounter{section}
\stepcounter{section}

\end{document}
