Performance Tools for Software Developers - Building PGPLOT* with the Intel® compilers


This guide is intended to help Intel® C++ Compiler and Intel® Fortran Compiler customers build the PGPLOT* graphics library. PGPLOT is a library for creating two-dimensional plots and graphs.

Version information

This guide applies to version 5.2.2 of PGPLOT and version 10.0 of the Intel® C++ and Fortran compilers for Linux*.

Application notes

PGPLOT can create many different kinds of graphs, including line plots, scatter plots, histograms, contour maps, and function graphs, as well as basic shapes and other images. PGPLOT has both C and Fortran interfaces. It can output graphs to many different devices (e.g printers and X windows) and file formats (e.g. PNG and PostScript).

More information about PGPLOT can be found at:

Obtaining the source code

Please read the licensing agreement for PGPLOT before proceeding.

The source code can be found at:

After you download the source code, use the following commands to extract the archive:

$ tar zxvf pgplot5.2.tar.gz

Please read and follow the latest licensing information (if any) for your use of this code.

Obtaining the latest version of the Intel® compilers

Licensed users of the Intel compilers may download the most recent versions of the compilers from the Intel® Download Center which is accessed by logging into your account at the Intel® Registration Center.

Evaluation versions of the Intel compilers may be found at the Intel® Evaluation Software Center.


Hardware: This note has been tested on Intel® Pentium® 4 and Pentium® D processors.

Software: C and Fortran compilers are both required to build PGPLOT. This note applies to version 10.0 of the Intel C++ and Fortran compilers for Linux*. The xorg-x11-devel package is required. For outputting in plots in PNG format, the libpng-devel package is also required.

Configuration and set-up information

In order to use this guide, you will need to have the Intel C++ and Fortran compilers installed. After installing the compilers, you will need to execute one of the following command sequences, depending on your architecture, to set the environment variables.

$ source /opt/intel/cc/10.0. xxx/bin/
$ source /opt/intel/fc/10.0. xxx/bin/
Intel® 64:
$ source /opt/intel/cce/10.0. xxx/bin/
$ source /opt/intel/fce/10.0. xxx/bin/

You will need to replace “ xxx” in the above commands with the three digit build number of your compiler.

Source code changes

No source code changes are required to build PGPLOT with the Intel compilers.

Building PGPLOT

The first step in building PGPLOT is setting up the right directories. There should be one directory containing the source code and another empty directory where PGPLOT will be built.

$ mv pgplot pgplotsrc

$ mkdir pgplot

You will need to make some changes to the script that generates the makefiles. Comment out the pndriv.o rule on line 1028 of pgplotsrc/makemake by adding a “#” at the beginning of the line. Also, add a –nofor_main switch to line 1055 of the same file, on the second command under the cpgdemo rule. The file is shown as it should look below:


# Miscellaneous include files required by drivers

griv00.o : $(DRVDIR)/gadef.h $(DRVDIR)/gmdef.h $(DRVDIR)/gphdef.h
grivas.o : $(DRVDIR)/gadef.h
grtv00.o : $(DRVDIR)/imdef.h
pgxwin.o : $(DRVDIR)/pgxwin.h
#pndriv.o : ./png.h ./pngconf.h ./zlib.h ./zconf.h

x2driv.o figdisp_comm.o: $(DRVDIR)/commands.h

cpgdemo: cpgplot.h $(SRC)/cpg/cpgdemo.c libcpgplot.a
$(CCOMPL) $(CFLAGD) -c -I. $(SRC)/cpg/cpgdemo.c
$(FCOMPL) –nofor_main -o cpgdemo cpgdemo.o
rm -f cpgdemo.o

Copy the drivers.list file into the pgplot directory:

$ cd pgplot
$ cp ../pgplotsrc/drivers.list.

Edit drivers.list in the current ( pgplot) directory. Enable the PNG and PostScript drivers by deleting the exclamation points at the beginning of the following line numbers: 40 (PNG), 41 (TPNG), 44 (PS), 45 (VPS) 46 (CPS), 47 (VCPS). You may also enable any other drivers that you find useful. However, be aware that other drivers may cause additional issues not covered in this guide. The file is shown below as it should look:


! NEDRIV 0 /NEXT Computers running NeXTstep operat ing system
NUDRIV 0 /NULL Null device (no output) Std F77
! PGDRIV 0 /PGMF PGPLOT metafile (new format, experimental) Std F77
PNDRIV 1 /PNG Portable Network Graphics file C
PNDRIV 2 /TPNG Portable Network Graphics file - transparent background C
! PPDRIV 1 /PPM Portable Pixel Map file, landscape
! PPDRIV 2 /VPPM Portable PIxel Map file, portrait
PSDRIV 1 /PS PostScript printers, monochrome, landscape Std F77
PSDRIV 2 /VPS Postscript printers, monochrome, portrait Std F77
PSDRIV 3 /CPS PostScript printers, color, landscape Std F77
PSDRIV 4 /VCPS PostScript printers, color, portrait Std F77
! PXDRIV 0 /PRINTRONI Printronix P300 or P600 dot-matrix printer
! QMDRIV 1 /QMS QUIC devices (QMS and Talaris), landscape Std F77

Now run the makemake script to create the makefile:

$ ../pgplotsrc/makemake ../pgplotsrc linux g77_gcc

The commands to make PGPLOT are different for the 32-bit and 64-bit compilers. If you are using the 32-bit compilers, use the following command sequence to make PGPLOT:

$ make CCOMPL=icc FCOMPL=ifort LIBS="-L/usr/X11R6/lib -lX11 -lsvml" LD_RUN_PATH=`pwd`
$ make cpg CCOMPL=icc FCOMPL=ifort LIBS="-L/usr/X11R6/lib -lX11 -lsvml" LD_RUN_PATH=`pwd`

If you are using the 64-bit compilers, use the following commands instead:

$ make CCOMPL=icc FCOMPL=ifort LIBS="-L/usr/X11R6/lib64 -lX11 -lsvml" LD_RUN_PATH=`pwd`
$ make cpg CCOMPL=icc FCOMPL=ifort LIBS="-L/usr/X11R6/lib64 -lX11 -lsvml" LD_RUN_PATH=`pwd`

Note: In the commands above, the command pwd is surrounded by grave accent (backtick) characters, rather than single quotation marks. On a keyboard, the grave accent key is normally right above the tab key.

The files libpgplot.a,, and libcpgplot.a should now exist in the pgplot directory.

Running PGPLOT

Though PGPLOT is a library rather than a stand-alone executable, it comes with several demo programs that can be used for trying PGPLOT. To run the first demo, use the following command:

$ ./pgdemo1

You will be asked which device you would like to use to output the results. Type /PNG and the demo will produce 14 PNG files, each containing a different plot.

The demo above uses the Fortran interface to access PGPLOT. For a test of the C interface, use the cpgdemo program instead of pgdemo1.

Verifying correctness

PGPLOT has no built-in test for correctness, but you may verify that it is working correctly by running one of the demo programs described in the section above.


This note demonstrates the use of PGPLOT with the latest version 10.0 Intel C++ and Fortran compiler technology. Following this method will produce object files and libraries that are compatible with the latest Intel compilers.

Known issues and limitations

The make clean command does not remove all the files produced in the build process. This may cause problems if you need to rebuild PGPLOT for some reason. To work around this problem, you can use the following command in the pgplot directory in addition to make clean:

$ rm *.o lib* pgdemo* cpg demo

The GIF driver seems to work only with the 32-bit compiler. PGPLOT built successfully with the GIF driver using the 64-bit compiler, but crashed each time it was used with the GIF driver selected.

This link will take you off of the Intel Web site. Intel does not control the content of the destination Web Site.

Operating System: