Adaptor library

Description of the Adaptor library.
This library is a modified version of the front-end of Adaptor that recognizes HPF 2.0. This allows Nestor to handle real codes, instead of only considering a subset of language or an ad-hoc language. Furthermore, this approach has the advantage of keeping the semantic of a high level language, instead of translating Fortran to low level C.

The front-end has been extended to handle new directives which allow the user to control the parallelization of its code. For instance, there is a new directive SINGLE that can be placed in front of a loop nest that signifies to Nestor that it must treat this loop nest. Other directives allow to define area of code that have to be analyzed. These directives drive the transformations that are done on a source code: completely or semi-automatically.

The parsing phase builds an abstract syntax tree in memory. The node library offers C functions (not documented here) to access and travel around the tree. These functions are used by the base library to build a hierarchical collection of C++ objects representing the source code. They are written in a way such that replacing the parser is an easy task and offer an easy interface for other languages.

For supporting semi-automatic parallelization, it is useful to define parts of code that have to be parallelized and others that are not to be taken into account. The base library offers a mechanism, by the use of new directives, that permits to ignore parts of code that are known to be sequential and to emphase parts that must be parallelized. These directives have the same structure than the HPF directives except that they begin with the keyword cNESTOR. Some functions of the base library are provided to use the marked statements (see Units).

The first directive (SINGLE) has to be placed in front of a DO or a FORALL statement:

cNESTOR$ SINGLE
    do i = 1,N
      a(i) = c(i-1) + b(i+1)
    enddo
This directive set the flag nestor_flag to 1 in the object
NstStatementDo or NstStatementForall during the parsing.

The second directive (BEGIN-END) defines a region used to enclose a part of code:

!NESTOR$ BEGIN
    if (a(1) .eq. 0) then
      do i = 1,N
        a(i) = c(i-1) + b(i+1)
      enddo
    endif
!NESTOR$ END
This creates a new object NstStatementNestor enclosing the statements inside.

The third directive (ALL) has to be placed in a subroutine, a function or a program between the declarations and the statements:

% cat exe.f
      PROGRAM tot
      integer NBLOCK, IBLOCK, ILOC
      integer  PPTR(1:100),IBLEN(1:100)
      real XPLUS(1:100), XDPLUS(1:100)
      real X(1:100), XD(1:100), XDD(1:100)
      real  DELTAT
!NESTOR$ ALL
      do IBLOCK = 1, NBLOCK 
         ILOC = PPTR(IBLOCK)
         do I = 1, IBLEN(IBLOCK)
            XDPLUS(ILOC+I-1) = XD(ILOC+I-1) + .1*DELTAT * XDD(ILOC+I-1)
            XPLUS(ILOC+I-1) = X(ILOC+I-1) + DELTAT * XDPLUS(ILOC+I-1)
         enddo
      enddo
      end
% nstprs exe.f
      program TOT
      integer*4 NBLOCK
      integer*4 IBLOCK
      integer*4 ILOC
      integer*4 PPTR (1:100)
      integer*4 IBLEN (1:100)
      real*4 XPLUS (1:100)
      real*4 XDPLUS (1:100)
      real*4 X (1:100)
      real*4 XD (1:100)
      real*4 XDD (1:100)
      real*4 DELTAT
!NESTOR$ BEGIN
      do IBLOCK = 1,NBLOCK
         ILOC = PPTR(IBLOCK)
         do I = 1,IBLEN(IBLOCK)
            XDPLUS(ILOC+I-1) = XD(ILOC+I-1)+.1*DELTAT*XDD(ILOC+I-1)
            XPLUS(ILOC+I-1) = X(ILOC+I-1)+DELTAT*XDPLUS(ILOC+I-1)
         end do
      end do
!NESTOR$ END
      end program TOT
The mask GlobalModeMask passed to the constructor of the class NstComputationUnit has the same effect.

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de