| Home | My Accounts | Newsletter | News Flash | Contact Us | Search |
|
  |
by Frank Mathew
Some compiling and debugging tips for C++/Fortran programming, specific to the Linux platform and Itanium 2 Processor (Redwood) Assumptions: 1) Although Redwood has multiple compilers, the compilers being used are version 8.0.0* 2) The C++/FORTRAN compilers and other pertinent files are installed under: /opt/cmplrs/8.0.0*/ For example on Redwood: The C++ compiler icc is under: /opt/cmplrs/8.0.066/bin The FORTRAN compiler ifort is under: /opt/cmplrs/8.0.046/bin 3) The Intel debugger being used idb is under: /opt/intel_idb_73/bin Initialization: Before we use the compiler or debugger, some relevant environment variables need to be set to specify the location of the different components. Scripts have been provided that do what is required. We can either execute the script son the command prompt as shown below or put it in the start up script of the shell. See the MCSR Webpage on loading Intel compiler modules. Compilers: Here are some features and benefits of the Intel 8.* compiler: 1.
The Intel compiler is binary level and source level
compatible with the GNU compiler. So this means that we can use libraries that
were built using the GNU compiler in a program that is to be built by Intel by
specifying the 2.
A significant performance gain can be gained by
using optimizations. These optimizations can be made specific to the
application being developed. There are quite a few optimization options that
can be specified to the compiler. See the article on optimization tips in this issue.
3. It supports shared memory parallel programming and larger application modules. Debugger: Besides the default DBX mode, the Intel debugger also supports the GNU debugger. So when the -gdb option is specified it is in the GDB mode and behaves like the GNU debugger. When a bug is found in the program it is recommended that we make a reproducer of the bug which is simple so that the bug can be zeroed in on more easily. Once the bug reproducer is ready here are the steps to follow to find the bug:
$
stty rows 25; setenv LINES 25 $
stty cols 80; setenv COLS 80
i. Using the shell command line: $ idb
test.out ii. Using the debugger commands $ idb (idb)
load teat.out
i. Using shell command line $
idb test.out
pid process_id_test.out ii. Using debugger commands $idb (idb) attach process_id_test.out
test.out
Here is a list of different ways by which to step through the code of the bug reproducer test.out and set break points: Setting break points:
$idb test.out (idb) stop in main (idb) run
$idb test.out (idb) stop at 64 (run)
$idb file test2.c (idb) stop at 64
|
