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.
This guide applies to version 5.2.2 of PGPLOT and version 10.0 of the Intel® C++ and Fortran compilers for Linux*.
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: http://www.astro.caltech.edu/~tjp/pgplot/†
Please read the licensing agreement for PGPLOT before proceeding.
The source code can be found at: http://www.astro.caltech.edu/~tjp/pgplot/†
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.
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.
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.
You will need to replace “ xxx” in the above commands with the three digit build number of your compiler.
No source code changes are required to build PGPLOT with the Intel compilers.
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:
griv00.o : $(DRVDIR)/gadef.h $(DRVDIR)/gmdef.h $(DRVDIR)/gphdef.h
x2driv.o figdisp_comm.o: $(DRVDIR)/commands.h
Copy the drivers.list file into the pgplot directory:
$ cd pgplot
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:
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`
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`
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, libpgplot.so, and libcpgplot.a should now exist in the pgplot directory.
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:
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.
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.
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.
For more complete information about compiler optimizations, see our Optimization Notice.