% LaTeX document
\documentclass[a4paper,12pt]{article}
\usepackage[koi8-r]{inputenc}
\usepackage[russian]{babel}
\begin{document}
\begin{titlepage}
\begin{center}

\Huge{\textbf{
����������� ������������ \\
���������� ���������������� �������� \\
INM~ParLib (������ 1.0)}}

\vspace{0.1\textheight}
\Large{������~�.~�.} \\

\vspace{0.2\textheight}
\Large{�������� �������������� ����������~��� \\
������, \today}

\end{center}
\end{titlepage}

\section{��������}
������ ����������� �������� � ���� �������� ���������� ���������������� �������� INM ParLib, ���������������� � ���������� ����� �� ����������������� ������� ������~\cite{T126} � �������~\cite{AGCM} �� ����������������� �������������� �������� � �������������� �������.

��������� ���������������� �������� � ��������� ���������� ���� ����������� ������������ �� ������������� � ��������� �����������, � �������� ������� ����� ��������� ������ �������������� ������, �������� �������� � ������������� �������� �� ���������� ������, ������� ������� ������������ �������������� �������� �� ����� ��� ���������� ����������� ����������.

� ���������� ����������� �������� ���������������� ������ ���������� ���������� � �������� ����������������. 
������ ����������� � ������ ��������� ������������ ���������� � ��������� ����� ����� �� ������ � �������� ������.
����������� �������� ����� ����������� �������� ���������� ����������� ������� �������� ���������.

���������������� ����������� �����, ����� ���������� ����������� �� ���� ����� �� ����� �� �������������� ������������ � �� �����, ��� ���������� �� ������ �� �������������� ����������� ����������.
� ���� ������ ����� ���������������� ������ ����� �������, ��� ������ ����������� ����� ����������� ������� � �����������, � ������ ������ ��������������.
����� ���������� ���������� ����� ��������� � ��������� �������������, ������ �������� ���������������� ������.
� ��������� �������~\cite{Ilghiz}, \cite{Swarztrauber} ���� �������� ������������� ������ ������� ��� ���������� �������� �������������� �����, � ����� ����������� ��� ���������� ��� ���������� �������������� ��������~\cite{Barros}.

���������������� ������������, ��� ������ ��������� � ������ ����������� � ������, ����� ��� ��� ������ ���������� ���������� ���������� ����������� ������ �� ������ ���������� �������� (� ������ ������ ���������� ������ ������������� ������ ���������� ��������� ��������� �����������, ������������� �����������).

\section{������������� ����������}
������������ ��������� �������� �� ��������, ���������� ��� �� ��, ��� � �� ��������.

\subsection{���������� � �������� ��������}
��������� ������������ ��������� ���������� � �������� MPI ��������� ������ ��������������� � ����������� ����� ����� ��� � ����� ������ ���������, ������������ ���������� MPI.
����� ����, ��� ���������� ���������� ������� ����� {\tt -I{\it ����\_�\_�����\-���\-��}/include}, ��� ��������~-- {\tt -L{\it ����\_�\_����������}/lib -lparlib}, a ��� �������� ��������  �� �������� ��� � ����� {\tt -lparlibf}.

\subsection{����� ������������ ��������}
����� ������������ �������� ������������� ���������� ��������� 
\begin{verbatim}
      INCLUDE 'parlibf.h'
\end{verbatim}
� ��������, ���� ���������� 
\begin{verbatim}
#include 'parlib.h'
\end{verbatim}
� ��.

\subsubsection{����� ���������� ����������}

����� ������ $\cal A$ ����������� ����� ������������ �� ����� ��� ���������� ������������.
����� ������ ��������� ����� ��������� ��������� ��������� ����� ����� ������� (����������).
�����������, ��� ���������� �� ������������ ����� �����.
����� ������ ����� ���� ������� � �������� ���
\begin{verbatim}
      DIMENSION A(STRIDE(1), ..., STRIDE(NDIMS))
\end{verbatim}
��� {\tt NDIMS}~-- ���������� ������������ �������, {\tt STRIDE}~-- ���� �����������.
����������� �����, ��� {\tt BDIM}~-- ���� �� ������������, �� ������� ������ $\cal A$ ����������� � ���������� ����� ��� ������������ ����� ���������� ����������, ��� ��� � ����� ������ �� ��� ����� �������, � ���� ��� ��������� ��� �����.

����� ����� ����� ���� ����������� ����� ������ ��������� \\{\tt P\_BExchange} ���������� ����:
\begin{verbatim}
      CALL  P_BEXCAHNGE (ARR, NDIMS, STRIDE, BLKLEN, BDIM, 
     1 OVERLAP, DATATYPE, COMM, PERIOD, IERROR)
\end{verbatim}
��� {\tt ARR}~-- ������ ������� ��������� ����� ������� {\tt A}; ��������� {\tt BLKLEN}~-- ���������� ������� ��� ����� ������� {\tt A}, ������� ��������� � ������������, � ������, � ������������ ����� ��������� ��������� ��� ����� {\tt ARR(1:BLKLEN(1), ..., 1:BLKLEN(NDIMS))}.
������ ������������� ������ ������������ ����������� {\tt OVERLAP}, ��� ��� ����������� � ������ ���������� ���������� ���� ������ {\tt OVERLAP(1)} �� ����������� {\tt BDIM}, � �� ����� ��� ����������~-- ���� ������ {\tt OVERLAP(2)}. 
���������� ���������� {\tt PERIOD} ���������� �������� �� ����� ������������� ��� ���. 
���� ����� �������������, �� ������ � ��������� ���������� � ������ ��� �� ������������ ����� ����� ���������� ����������.
������ ��������� ���������������� ��������������� MPI {\tt COMM}, � ��� ��������� ������� {\tt A} ������������ ��������������� MPI {\tt DATATYPE}.
������, ��������� ����� �������� {\tt MPI\_REAL} ��� {\tt MPI\_DOUBLE\_PRECISION}.
% ����� ���� ��������, ��� ��� �������� ��������� �������� ����������� ������ ���� ������������� ������������ ������

���������� ��� �� ����������� ������� ���������� �������� ������ ���������� ����������. 
�� ���������� � ���������� � ���� ������� ��������:
\begin{verbatim}
      CALL P_BEXCAHNGE_INIT (NDIMS, STRIDE, BLKLEN, BDIM, 
     1 OVERLAP, DATATYPE, COMM, PERIO, BEXCHANGE, IERROR)
      CALL P_BEXCAHNGE_START (ARR, BEXCHANGE, IERROR)
      CALL P_BEXCAHNGE_END (BEXCHANGE, IERROR)
      CALL P_BEXCAHNGE_FREE (BEXCHANGE, IERROR)
\end{verbatim}
������ ��������� ������� � �������������� ��������� ���������, ���������� � ���� ��� ����������, ����������� ��� ������ ������, � ���������� ���������� {\tt BEXCHANGE}, ���������������� ��� ���������, ������ �������� �����, ������ ������� ��������� ������, �, �������, ��������� ������� ��������� ��������� �� ������. 
����� �������, ����� ����������� {\tt P\_BExcahnge\_start} � {\tt P\_BExchange\_end} ����� ������������� �������� ���������� � ������� ������, ������������ � ���������� ������.

\subsubsection{����������������}
��������, ������ $\cal A$ ����������� ����� ������������ ��������� ������ ����� ����������� {\tt DIM\_SOURCE} ������� ������ {\tt LBLKS\_SOURCE(IPROC)}, ��� {\tt IPROC}~-- ����� ����������, � ����������� {\tt DIM\_DEST} ���������� � ����������� �������.
����� �������� ����������������� ������� $\cal A$ ����� ��� ����������������, � ���������� �������� ������ ��������� ����� �������� ������ ������ {\tt LBLKS\_DEST(IPROC)} ����� ����������� {\tt DIM\_DEST} � ����� �������� ����� ����������� {\tt DIM\_SOURCE}.
���� {\tt ARR\_SOURCE}~-- ������ ������� ��������� ���������� ������� $\cal A$ �� ����������������, � {\tt ARR\_DEST}~-- ����� ����������������, ����� ��������������� ������������ ��������� ����� ����� ��������� ���:
\begin{verbatim}
      CALL P_TRANSPOSE (NDIMS, ARR_SOURCE, DIM_SOURCE, 
     1 LBLKS_SOURCE, ARR_DEST, DIM_DEST, LBLKS_DEST, 
     2 STRIDE, BLKLEN, OVERLAP, DATATYPE, COMM, PERIOD, 
     3 DIAG, IERROR)
\end{verbatim}
��� {\tt NDIMS}~-- ���������� ������������ ������� $\cal A$, {\tt DATATYPE}~-- ���������� MPI, ��������������� ���� ��������� �������, {\tt COMM}~-- ������������ MPI, ������������ ������ ����������.
�������, ��� ���� ������ $\cal A$ �������� � ������ ������� ���������� �������, ��� ������������� ����������� ���������� ��� ������������ ���� ����� ����. 
��� ����, ����� ��������� ������������� ����� �� �����������, ���������� {\tt DIAG} ������ ����� �������� {\tt .FALSE.} �� ����� ���������.

����� ��������� ���������� ������� $\cal A$ ����������� �� ����� ��������� �������� {\tt A\_SOURCE}, � �� ������~-- �������� {\tt A\_DEST}.
��� ����� ���� ������� � ��������� ���
\begin{verbatim}
      DIMENSION A_SOURCE(DIM_SOURCE(1), ..., DIM_SOURCE(NDIMS))
      DIMENSION A_DEST(DIM_DEST(1), ..., DIM_DEST(NDIMS))
\end{verbatim}
��� ����������� {\tt DIM\_SOURCE}  ����� ��������� ��������:
$$
   \texttt{DIM\_SOURSE(IDIM)}=\left\{
   \begin{array}{l}
      \texttt{BLKLEN(DIM\_SOURCE)} \textrm{, ���� } \texttt{IDIM=DIM\_SOURCE}\\
      \texttt{STRIDE(IDIM)} \textrm{, � ��������� ������}
   \end{array}\right.
$$
� ����������� {\tt DIM\_DEST}:
$$
   \texttt{DIM\_DEST(IDIM)}=\left\{
   \begin{array}{l}
      \texttt{BLKLEN(DIM\_DEST)} \textrm{, ���� } \texttt{IDIM=DIM\_DEST}\\
      \texttt{STRIDE(IDIM)} \textrm{, � ��������� ������}
   \end{array}\right.
$$

� ����� ������ ������� {\tt A\_SOURCE} � {\tt A\_DEST} ����� ���� ������������� � ���������������� �� �������, � ���� ��������:
\begin{verbatim}
      ARR_SOURCE(1:BLK_SOURCE(1), ..., 1:BLK_SOURCE(NDIMS)
      ARR_DEST(1:BLK_DEST(1), ..., 1:BLK_DEST(NDIMS)
\end{verbatim}
��� ����� ����� ��������� �������:
$$
   \texttt{BLK\_SOURCE(IDIM)}=\left\{
   \begin{array}{l}
      \texttt{LBLKS\_SOURCE(IPROC)} \textrm{, ���� } \texttt{IDIM=DIM\_SOURCE} \\
      \sum\texttt{LBLKS\_DEST} \textrm{, ���� } \texttt{IDIM=DIM\_DEST} \\
      \texttt{BLKLEN(IDIM)} \textrm{, � ��������� ������}
   \end{array}\right.
$$
$$
   \texttt{BLK\_DEST(IDIM)}=\left\{
   \begin{array}{l}
      \texttt{LBLKS\_DEST(IPROC)} \textrm{, ���� } \texttt{IDIM=DIM\_DEST} \\
      \sum\texttt{LBLKS\_SOURE} \textrm{, ���� } \texttt{IDIM=DIM\_SOURCE} \\
      \texttt{BLKLEN(IDIM)} \textrm{, � ��������� ������}
   \end{array}\right.
$$

����������� ������� ���������������� ���������� � ���� ������� ��������:
\begin{verbatim}
      CALL P_TRANSPOSE_INIT (NDIMS, DIM_SOURCE, LBLKS_SOURCE, 
     1 DIM_DEST, LBLKS_DEST, STRIDE, BLKLEN, OVERLAP, DATATYPE, 
     2 COMM, PERIOD, DIAG, TRANSP, IERROR)
      CALL P_TRANSPOSE_START (ARR_SOURCE, ARR_DEST, TRANSP, 
     1 IERROR)
      CALL P_TRANSPOSE_END (TRANSP, IERROR)
      CALL P_TRANSPOSE_FREE (TRANSP, IERROR)
\end{verbatim}
��� {\tt TRANSP}~-- ���������� ����������������.

\begin{thebibliography}{}
\bibitem{T126} ������~�.~�. ����������������� ���������� ������������ ������ �������������� �������� ������ T126 �� ����������������� �������������� ������� � �������������� �������. Optimization of Finite Element Approximations, Splines and Wavelets (OFEA'2001). Abstracts of International conference (June~25--29, 2001, St.-Petersburg, Russia), 2001, 184~p.

\bibitem{AGCM} �.~A.~Tolstykh, V.~N.~Gloukhov. Implementation of global atmospheric models on parallel computers. {\it �������������� ����������.} �������� �������������� ���������� ��~���, �����������.

\bibitem{Ilghiz} ���������~�.~�. ������������ ��������� ��� � ���������� ������������ ��������. ��������� ������ � ���������. ��� ���, ������, 1999.

\bibitem{Swarztrauber} P.~N.~Swarztrauber, S.~W.~Hammond. A comparison of optimal FFTs on torus and hypercube multicomputers. {\it Parallel computing},~27 (2001), pp.~847--859.

\bibitem{Barros} Barros,~S.~R.~M., Kauranne,~T. On the parallelization of global spectral weather models. {\it Parallel Computing},~20 (1994), pp.~1335--1356.

\bibitem{Rodriguez} B.~Rodriguez, L.~Hart, T.~Henderson. Performance and portability in parallel computing: a weather forecasr view. {\it High Performance Computing in the Geosciences}, 1995, Kluwer Academic Publishers, Netherlands, pp.~1--23.

\bibitem{Henderson} T.~Henderson, D.~Shaffer, M.~Govett, L.~Hart. SMS User's Guide. Advanced Computing Branch, Aviation Division, NOAA Forecast system laboratory, Boulder, 2001.

\end{thebibliography}

\end{document}