Compilers on 64-bit and 32-bit Research Computing Systems

Details

A 64-bit computer can handle more computations, memory, and I/O than a 32-bit computer. To take advantage of this additional power, software must be built with 64-bit compilers. The 64-bit computer can run 32-bit applications, but running them in 32-bit mode doesn't use all the expanded capabilities of the 64-bit computer. However, software built to use a 64-bit computer cannot run on a 32-bit computer.



All of the C/C++ and FORTRAN compilers on the public 64-bit Linux computers will build 64-bit applications by default when you run them on a 64-bit computer. You can specify options to these compilers to build a 32-bit executable instead of a 64-bit. The table below provides more information on these options for the installed compilers.

If you plan to build your application on both 32-bit and 64-bit Linux computers, and you want to use the same executable on both, compile the program for a 32-bit computer. If you plan to run only on a 64-bit computer, compile the program for 64-bit, as it will run more efficiently.



The file command tells you which kind of application your executable is. For example, the following information is about an executable called shapley.

file shapley

shapley: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV).


for GNU/Linux 2.4.0, dynamically linked (uses shared libs), not stripped


If you try to run a 64-bit executable on a 32-bit computer, you will get an error message that says, "Exec format error. Wrong Architecture."

Compiler Commands for Building 32-bit and 64-bit Applications on 64-bit Linux Computers

  Compiler    64-bit    32-bit  
  GNU C  gcc  gcc -m32  
  GNU C++    g++  g++ -m32
  Portland Group C    pgcc, pgf90    pgcc -tp px  
  Intel C/C++  icc  icc -m32