On Big Red at IU, how do I compile my C, Fortran, or Java programs?
You can compile programs written in C, Fortran, or Java on Big Red at Indiana University, as shown below. See the Big Red home page for more information about available compilers, libraries, and other tools.
Fortran 77 programs
The most basic compile of a Fortran 77 program
simple.f is:
This compile will give a faithful line-by-line compilation, and assumes no threads. To allow the compiler to use modern constructs and optimizations, a fixed form of Fortran 90 is also available. A nearly equivalent compile line would be:
xlf90 -qfixed -o simple simple.fTo add optimization, add the -Ox flag, where
x is a number 1 through 5 (a higher number indicates
higher optimization, but introduces more potential to alter the
semantics of a program):
To add threading, append _r to the command:
C programs
The C compiler follows the same basic format as the Fortran
compiler. The most basic compile of the C program
simple.c is:
To add threading and optimizations, the command would be:
xlc_r -O3 -o simple simple.cJava programs
The Java compiler does not follow the pattern of the Fortran and C
compilers. There are no optimizations or threads. To compile the Java
program simple.java, use the following command:
After you compile your program, you could use
serialjob to run it as follows:
Alternatively, you could use a LoadLeveler script to submit batch jobs. See Batch jobs on Big Red.
This document was developed with support from the National Science Foundation (NSF) under Grant No. 0503697 to the University of Chicago and subcontracted to Indiana University. Additional support was provided by IU through its participation in the TeraGrid, which is supported by the NSF under Grants No. 0833618, SCI451237, SCI535258, and SCI504075. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the NSF.
Last modified on July 28, 2011.







