High Performance Computing
High End Visualization
About CCR Contact Us Events Facilities Faculty Project Highlights History Job Opportunities News Partners Staff
Bioinformatics Consulting Services Grid Computing Visualization
Accounts Application Software Consulting Getting Started Hardware Resources Frequently Asked Questions Machine Status MyStats Overview Request Help Storage Resources Training/Courses Web Portals
Access Grid Training Outreach
Events Logos Media News Photo Album Videos
Contact Information Directions
  Dashboard > CCR Web > Getting Started > Basic Compilation
Log In   View a printable version of the current page.
Basic Compilation

This guide is an introduction to compiling C and Fortran programs. The samples are compiled with the GNU compilers. The Intel and PGI compilers are available.

Using the GNU Compilers

The GNU compilers are in the default path.

GNU C Compiler

  • Code: Hello World
    [bono:~]$ cat hello.c
     #include <stdio.h>
     main()
     {
            printf("Hello World!\n");
     }
    [bono:~]$
  • Compilation:
    [bono:~]$ gcc -o hello-gnu-c hello.c
  • Running the code:
    [bono:~]$ ./hello-gnu-c
     Hello World!
    [bono:~]$

GNU Fortran Compiler

  • Code: Hello World
    [bono:~]$ cat hello.f
     C     Hello World (Fortran 77)
           PROGRAM HELLO
           PRINT*, 'Hello World!'
            END
    [bono:~]$
  • Compilation:
    [bono:~]$ g77 -o hello-gnu-f hello.f
  • Running the code:
    [bono:~]$ ./hello-gnu-f
      Hello World!
    [bono:~]$

    Using MPI with GNU Compilers

Center for Computational Research - University at Buffalo - State University of New York