Indiana University
University Information Technology Services
  
What are archived documents?
Login>>
Login

Login is for authorized groups (e.g., UITS, OVPIT, and TCC) that need access to specialized Knowledge Base documents. Otherwise, simply use the Knowledge Base without logging in.

Close

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:

xlf -o simple simple.f

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.f

To 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):

xlf90 -qfixed -O3 -o simple simple.f

To add threading, append _r to the command:

xlf90_r -qfixed -O3 -o simple simple.f

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:

xlc -o simple simple.c

To add threading and optimizations, the command would be:

xlc_r -O3 -o simple simple.c

Java 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:

javac simple.java

After you compile your program, you could use serialjob to run it as follows:

serialjob ./simple serialjob java simple.class

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.

This is document arkg in domain all.
Last modified on July 28, 2011.

Comments/Questions/Corrections

Use this form to offer suggestions, corrections, and additions to the Knowledge Base. We welcome your input!

If you are affiliated with Indiana University and would like assistance with a specific computing problem, please use the Ask a Consultant form, or contact your campus Support Center.

Contact Information

Note: We will reply to your comment at this address. If your message concerns a problem receiving email, please enter an alternate email address.