How do I run polaris (as a command-line tool)?

The command line interface is explained in detail in the polaris man page (read by typing: ``man polaris'').

In this section I will give a step by step tutorial on how to generate a parallel program using polaris. First, enter the sample program shown below into a file named example.f. If you're not familiar with Fortran 77, you need to know that spaces are important!!. Executable statements can only use the first 6 columns as stamement labels or to signify that the line continues. Therefore all of the lines in the figure start with at least 6 spaces.

      PROGRAM EXAMPLE
      REAL A(100),B(100)
      INTEGER I
      DO I = 1,100
       A(I) = I
       B(I) = 100 - I
      ENDDO
      DO I = 2,100
       A(I) = A(I-1)
      ENDDO
      DO I = 1,100
       WRITE(6,*) A(I), B(I)
      ENDDO
      END

Figure: Example Program

You can run polaris on example.f by simply typing:

>> polaris -version new example.f

The polaris command found in /home/peak/a/paramnt/tools/bin is actually a script that allows you to select from several versions of polaris.  The -version flag controls which version is used, and using "new" will cause the newest version to be called.  Typing the command as given above should generate many lines of output, including the resulting program shown in the figure below (the code may differ slightly depending on what the current default setup of polaris is).

      PROGRAM example
      INTEGER*4 i, numthreads, omp_get_max_threads
      REAL*4 a, b
      DIMENSION a(100), b(100)
      COMMON /polaris/ numthreads
      numthreads = omp_get_max_threads()
!$OMP PARALLEL
!$OMP+DEFAULT(SHARED)
!$OMP+PRIVATE(I)
!$OMP DO
CSRD$ LOOPLABEL 'EXAMPLE_do#1'
      DO i = 1, 100, 1
        a(i) = i
        b(i) = 100+(-i)
      ENDDO
!$OMP END DO NOWAIT
!$OMP END PARALLEL
CSRD$ LOOPLABEL 'EXAMPLE_do#2'
      DO i = 2, 100, 1
        a(i) = a((-1)+i)
      ENDDO
CSRD$ LOOPLABEL 'EXAMPLE_do#3'
      DO i = 1, 100, 1
       WRITE (6, *) a(i), b(i)
      ENDDO
      STOP
      END

Figure: Example Output
You can see in the example that Polaris finds the first loop, EXAMPLE_do#1 to be parallel, while finds that the remaining two loops are serial. The code part of the output is also stored into a file called example_P.f.