Sun Performance WorkShop Fortran Overview

Chapter 2 Building and Compiling

With Sun Performance WorkShop Fortran, you can build and compile efficient programs, starting with the use of a single graphical interface as a control panel.

Program in an Integrated Environment

With Sun Performance WorkShop Fortran, you can manage and execute a complete suite of development tools through a single graphical user interface (GUI).

Since developers tend to have their favorite editors, Sun WorkShop offers three of the most popular: vi, Emacs, and XEmacs. When using Sun WorkShop, you can choose your editor from the Text Editor Options dialog box.

Simplify Building With the Sun WorkShop Building Window

Your makefile describes explicitly how to build each module of your program as well as the final executable. Sun WorkShop Building is a graphical interface to the UNIX make utility, the utility that oversees program compilation and ensures that your programs are compiled from the newest sources. After you initiate a program build in the Building window, the build process reads the makefile for the program and executes the commands it finds there.

The Building tool marks the evolution of the make command into a powerful and flexible tool that permits you to use the processing power of today's workstations more efficiently. With the Building tool, you can distribute the building of large programs over a number of processes and, in the case of multiprocessor systems, over multiple CPUs.

Use the Building tool to:

The Sun WorkShop Building tool gives you the following advantages over issuing make commands from the command line:

Automatically Parallelize Applications

Performing multiple tasks in parallel speeds program execution and improves performance. Iterative loops tend to dominate application runtime and are the natural focus of automatic parallelization. Use parallelization to distribute the computational work of a loop over several processors without having to modify your source program.

By parallelizing (or multithreading) your application, you can recast the compiled program to take full advantage of a multiprocessor system. Parallelization enables single tasks, such as loops, to run over multiple processors with a significant increase in execution speed.

Analyze your source code with the FORTRAN 77, Fortran 90, and C compilers to determine which loops have iterations that are independent of one another, and therefore safe to parallelize.

Automatically Restructure Code

The FORTRAN 77, Fortran 90, and C compilers perform extensive automatic restructuring of source code, exposing higher degrees of loop-level parallelization. Some of the techniques the compilers use for this transformation are:

Put Pragma Support to Work

Frequently, the compiler has insufficient information to decide whether parallelization is advantageous. In such cases, you can use parallelization directives, or pragmas--comment lines that tell the compiler whether to parallelize the loop that follows the directive.

Enhance Performance With the Fortran Compilers

Take advantage of the Fortran 90 and FORTRAN 77 compilers, designed to ensure the highest levels of accuracy and performance. Some of the features that contribute to compiler performance are:

Test Changes Faster

Once a debugging session is completed, you can rebuild your application using the incremental link editor (ild). (In the Sun Performance WorkShop Fortran, the incremental link editor (ild) replaces the link editor (ld)). You can test the changes to your application more quickly because the incremental link editor reduces the time necessary to relink an application. Only the changed .o files are linked into the previous executable to create a new executable file. Using the incremental link editor, the time it takes to rebuild an application after a change is proportional to the magnitude of the change rather than to the total size of the application.

Improve Performance With Libraries

Sun Performance WorkShop Fortran provides two important library collections to increase application performance: the Sun Performance Library and the Sun Math Library.

Sun Performance Library

If you develop computationally intensive applications, such as those performing computational linear algebra and Fourier transforms, try the Sun Performance Library. You can use this library on single- or multi-processor systems, and call it from all Sun WorkShop compiler language systems.

Some of the most widely used libraries are the mathematical collections known as BLAS, LINPACK, LAPACK, FFTPACK, and VFFTPACK. While these libraries provide a multitude of functions, typically, they are not highly optimized or parallelized. The Sun Performance Library contains highly optimized versions of these libraries. With native interfaces to FORTRAN 77 and accessibility from Fortran 90, the Sun Performance Library can boost your application speed by a factor of four or more.

Sun Math Library

If you focus on compute-intensive application, you can increase performance by using the optimized math libraries provided with Sun Performance WorkShop Fortran. The libm math library bundled with the Solaris operating environment contains the functions required by the various standards to which the Solaris software conforms. Some features of the math library are:

Enhance Performance With the C Compiler

The C compilation system offers a compiler, assembler, and link editor. Enhance the performance of your C programs with the following C compiler features: