Wednesday, October 24, 2012

Installing OMPP-0.7.1 OpenMP Profiler on Ubuntu 12.04

OMPP is a profiler for OpenMP. Installing and running it on Ubuntu is pretty straight forward, and is discussed below, assuming you already have gcc and g++ installed on your system, with OpenMP support.

Download OMPP and extract.

Set the below parameters in Makefile.defs in the ompp-0.7.1 directory.
# Set the Installation Directory (different from the extracted directory).

# root directory for the installation
# e.g., INSTDIR=$(HOME)/ompp or INSTDIR=/usr
INSTDIR=/home/pradeeban/programs/ompp-0.7.1/ompp

# Set OpenMP C/C++ compiler
# e.g., OMPCC=icc, OMPCC=pathcc, etc.
OMPCC=gcc


# Set OpenMP C/C++ compiler flag,
# e.g., OMPFLAG=-openmp, OMPFLAG=-mp
OMPFLAG=-fopenmp


# Optionally, you may also set an output directory.
OMPP_OUTDIR=$(INSTDIR)/output
Now you may 'make'.
make
make install


Set ompp to your path variable in your ~/.bashrc.
export OMPPDIR_HOME=/home/pradeeban/programs/ompp-0.7.1/ompp
export PATH=$PATH:$OMPPDIR_HOME/bin

Optionally you may also set the output format of the report into formats such as CSV.
export OMPP_OUTFORMAT=CSV

Now you should be able to compile and run your C/OpenMP application with ompp as below.
kinst-ompp gcc -fopenmp mult-good.c -o mult-good
./mult-good
 
Upon running the application, an output file with the results will be created.
mult-good.2-0.ompp.txt

Note:
You may encounter the below error when 'make install'
`lib/libompp.a' and `/home/pradeeban/programs/ompp-0.7.1/lib/libompp.a' are the same file

This is because of setting the installation as same as the extracted directory of ompp, in Makefile.defs. Installation Directory should be different from the directory that you extracted, to avoid conflicting with the lib files. I have created a directory "ompp" inside the extraction directory for this.
# root directory for the installation
# e.g., INSTDIR=$(HOME)/ompp or INSTDIR=/usr
INSTDIR=/home/pradeeban/programs/ompp-0.7.1/ompp



When compiling with kinst-ompp  in Ubuntu you may encounter the below error.
ERROR: unbalanced pragma/directive nesting 
Make sure to have the line endings of the source files to have Linux/Unix, as the above error was found when the source file contains the "Windows" line endings.

No comments:

Post a Comment

You are welcome to provide your opinions in the comments. Spam comments and comments with random links will be deleted.