FORTRAN Programming Chapter Overview ================ This chapter briefly describes the Fortran compiler options available on the C3880. Note that by default the compiler does not vectorize your code. Invoking the Fortran Compiler ============================= Use the fc command to invoke the Fortran compiler. The simplest way to use the compiler on your Fortran code myprog.f is: % fc myprog.f Using the compiler in this manner: * does not optimize or vectorize your code * sends error and warning messages to your terminal * provides no output listing file * produces an executable file called a.out if there are no errors In order to optimize, vectorize, or parallelize your code with the compiler, you must supply one of the -On options, where n represents 1, 2, or 3. You should compile your code without any optimization and test it with a small test case. If the answers are correct, apply options O1, O2, and O3. The O3 should be used only if you want to parallelize. Check your answers after each step. At a minimum, every code running on the CONVEX C3880 should be vectorized using -O2. % fc -O2 -LST -or all myprog.f > myprog.1 This vectorizes the code and produces an output listing named myprog.l and an executable file named a.out. The output listing includes an optimization report (-or). Following is a list of other commonly used command line options. Option Description -c makes compiler produce an object file (objectfilename.o) only -cxdb enables debug information to be generated for cxdb -l name searches specified library file when linking object -o name specifies alternate name of executable file rather than a.out -il allows subprogram inlining (debugging may be difficult with this option on) -re allows subprograms to be called recursively -LST lists source of the code -xr lists cross-reference of the code -ds allows dynamic selection of multiple loop copies -ur causes compiles to automatically select and unroll loops -pa instruments code for CONVEX performance analyzer (cxpa). Also -pab for block-level and -par for routine-level instrumenting -p instrument for prof analyzer -bp instrument for bprof analyzer -pg instrument for gprof analyzer After reaching optimization levels -O2 and -O3, you may want to incorporate some extra options on your compile command. Add the -ur option to automatically unroll loops the compiler chooses. Also try the -ds option to produce multiple copies of some loops that the CONVEX can choose between dynamically at run-time, depending on the loop ``trip count.'' CONVEX debugger CXdb and performance analyzer CXpa are available on out system and are documented by CONVEX. For more information on optimization, refer to the CONVEX manual CONVEX FORTRAN Optimization Guide. Other command line options are available for the fc compiler. A full listing can be viewed online by entering the command man fc. Software Information ==================== Information about recent releases is available in the /usr/doc directory in the following files: Fortranv8.0fc.relnotes Application Compilerv1.1apc.relnotes X-based debuggerv2.0cxdb.relnotes support librariesv2.0all.relnotes Fortran * CONVEX Fortran version 7.0 introduced Fortran 90 support. This support has been extended to include masked array assignments, using the WHERE statement and construct as well as two new array manipulation intrinsics (EOSHIFT and CSHIFT). * Version 8.0 of CONVEX Fortran supports two new compiler directives that allow you to increase optimization opportunities by declaring variables and arrays private to loops and tasks. The new compiler directives are C$DIR DO_PRIVATE and C$DIR TASK_PRIVATE. * The -cfcwpa option causes the compiler to compute word addresses when performing Cray pointer arithmetic on explicitly-declared Cray pointers. * The CONVEX Fortran cross-reference utility, fcxref, has been enhanced to generate module-interface reports. Application Compiler * An interactive browser for the program database named pdbview is included. This X-based tool allows you to filter error messages, construct call graphs, and examine the different analyses performed by the compiler. * Procedure inlining and cloning have been enhanced. * The Application Compiler can increase the effectiveness of its call frequency analysis by using profile information you supply. * To reduce bank conflicts in vector code, the compiler looks for multi-dimensional arrays whose dimensions can cause bank conflicts during vector loads and stores of the array. CXdb CXdb, an X-based debugger, includes a significant number of enhancements and bug fixes. Consult the /usr/doc/v2.0cxdb.relnotes file for more detailed information. .