\comment{
\begin{figure}
\begin{center}
\begin{lstlisting}[xleftmargin=0.35cm, xrightmargin=0.25cm]
/* Origianal Array Declaration */
int[] A = new int[(N+1)*(N+1)];
/* Declare ArrayView over Array A*/
int[.] Av = new arrayView(A,0,[0:N,0:N]);
...
/* Computation Body */
forall (point [i,j]:[0:N,0:N]) {
   Av[i,j] = ...; 
}
\end{lstlisting}
\end{center}
\caption{The example of array-views for handling multi-dimensional array in GPU}
\label{fig:arrayview}
\end{figure}
} % End of comment.

In Java,
a multi-dimensional array is represented as an array of arrays. This permits
irregularly shaped arrays where elements at the same dimension have different lengths.
This implies that, given an array {\tt int[10][10] A = new int[10][10]}, it would be necessary to 
perform 10 calls to OpenCL's transfer functions, \textit{clEnqueueWriteBuffer} and \textit{clEnqueueReadBuffer},
for transferring {\tt A} to and from an OpenCL device.
This leads to the high communication overheads between host and device.

As discussed in Section~\ref{sec:hj-multi}, we instead use HJ array-views\cite{Joyner:2011:SAB:1987237.1987256}
to provide multi-dimensional syntax backed by a single-dimensional array.
In Figure~\ref{fig:hjopencl-example}, line 3 shows the declaration of a one-dimensional array.
Line 6 in Figure~\ref{fig:hjopencl-example} shows the declaration of an array-view {\tt arraysView} which maps
a two-dimensional region of size [0:N-1,0:M-1] to the one-dimensional array{\tt arrays}.
The array-view {\tt arraysView} is referenced with multi-dimensional syntax in the body of \textit{forall} as shown in line 12. 
The HJ compiler internally transforms {\tt arraysView[i, j]} into {\tt arrays[i*M + j]}. APARAPI is then able to translate this 
statement to an OpenCL kernel. APARAPI does not support multi-dimensional arrays.
