Search A-Z index Help
University of Cambridge Home Chemistry Dept Home CUC3 home
University of Cambridge > Department of Chemistry > Theoretical Chemistry > Computer Support

Portland Compiler Suite

Description

The Portland Compiler Suite contains Fortran 95, Fortran 90, Fortran 77, C, C++ and HPF compilers for Linux PCs.

Source

The compiler is downloadable from Portland's web site. We use the PGI Server package, with both 32 and 64-bit compilers.

Availability

All workstations and servers

Licence details

This is commercial licence-managed software. We have a two-user network licence. This allows anyone on the access list to use the compiler provided the licence server is available and has a free licence. You do not need the licence in order to run the binaries that the compiler produces, only to compile. You may redistribute the binaries produced. Portland provide a freely downloadable portability package containing some of the required libraries to allow binaries to run on machines where the compiler isn't installed. However this only works for some versions, and you should consult the FAQ for full details.

For the 6.X and up version of the compiler, the portability libraries are packaged conveniently in a separate directory REDIST within the installed tree. The contents of this directory may be distributed with your binaries.

Instructions for users

If you are using the modules environment then you just need to load the appropriate module. It will probably be loaded for you already. The name of the of the module is pgi (pgi64 for 64-bit compilers where available). The compilers are pgf95 (PGI 6.X and up release only), pgf90, pgf77, pgcc, pgCC, and pghpf.

There are usually multiple versions of the compiler installed on any given machine, as new versions tend not to compile some older codes. If you are on a machine with modules (most of them) you can easily switch between different versions (see the modules documentation) and can stop reading here.

If not, then you need to set things up by hand as follows:

With most versions of Portland you need to do three things: set PGI to be the location of the installation directory, and set PATH and MANPATH to contain the appropriate directory.

The install directory will be in the usual place: under /usr/local/. There are two possibilities for the naming scheme for the PGI directory itself. PGI used to have to be installed into a different directory tree for each version if you wanted to have multiple versions on a system. With version 5.0 the install tree structure changed so that multiple versions from 5.0 up could go into a common directory. On servers which have versions lower than 5.0 installed there are therefore separate pgi (ie version 4), pgi5 (containing 5.0, 5.1, and 5.2) and pgi6 directories. On servers without version 4 all versions are just installed into the pgi directory.

Set PGI to the appropriate directory identified above (this variable is not needed for version 5.2, but seems to do no harm). Now, for versions 5.0 and above, look in $PGI/linux86 (or $PGI/linux86-64 if using 64-bit compilers). There will be a directory in there for each version of the compiler that is installed. Set PATH to contain the bin subdirectory of the directory for the version you want to use, and MANPATH to contain the man subdirectory.

You should never need to fiddle with the licence settings, because the compiler looks in $PGI/license.dat to find its licence server and that should be set up correctly. However recent versions of the compiler use the LM_LICENSE_FILE variable which is also used by the Intel compiler. For Portland, this should point to the filename not the licence server.

Documentation

The compiler comes with manpages. You may need to load the module to make the manpage available. However most of the documentation is in HTML and PDF form in the doc subdirectory of the compiler's install directory. You will have to use a web browser or PDF reader to view it. A good place to start is the file index.htm. Portland also provide an excellent FAQ on the web. There are paper copies of the documentation for certain older versions of the compiler in room 3.73 that can be borrowed.

Admin notes

Installing

Portland comes with an installer script which is usually well-behaved. Run it, point it at the location you want the compiler to be installed at (on workstations /usr/local/shared/image/{i386,x86_64}/pgi) and tell it to install the ACML and MPI too if it asks. I don't usually agree to the option to make the files readonly as in the past this has had the surprising effect of making them world-writable.

It installs each version in a separate numbered subdirectory under the install root linux86{,-64} directory. Recent versions have developed the slightly annoying habit of putting some things in a directory named after the major version, so for 7.1-3 you'd get most of the install in 7.1-3 but the MPI library goes into a directory called 7.1, along with a huge pile of symlinks to 7.1-3, so presumably when you want to install 7.1-4 you'll get an error message about pre-existing files. The moral is test it first and see if it's going to trash the existing install. I normally find the installer does the right thing and does not overwrite stuff; also installing multiple versions into one location tends to work OK despite the error messages.

You must do separate installs for 32 and 64-bit Linux distros even if the base distro is the same. On servers the location is usually /usr/local/pgi but look around for previous installs.

Don't forget to make a module for it and install the local siterc (below).

Licence

The license.dat file on the client should contain:

SERVER por.ch.cam.ac.uk 000102aa6790 28519
USE_SERVER
and the installer doesn't overwrite it, so in fact you rarely need to know this information.

Unfortunately the Portland vendor daemon will not play nicely with the NAg and Intel vendor daemons, so the licence server has to be on a different port to the one for the Intel and NAg compilers. See the licence server documentation for details.

It's usually necessary to keep renewing the Portland licence to keep up with new versions.

Cross platform installs

Portland's installer customises the install based on the version of glibc on the machine where you install it. This is a minor nuisance as you cannot use the same NFS server install of it for, say, both suSE 9.2 and 9.3 clients. The NFS server software and module directory is common between those two versions of the image so I ended up setting the pgi module to do different things depending on which OS it was called on.

With Portland 7.0 this problem was supposed to be solved and it should be possible to run clients on multiple OSes from one NFS install. Unfortunately the Portland guys have done this in a way that doesn't help our particular case. The installer now offers you both 'network' and 'single-machine' install. The 'network' install prompts you for a main location and one for the per-OS obejcts. Unfortunately the per-OS directory is then found for each client by creating a file localrc.hostname in the main binary directory. This is not sustainable for an installation like ours. It was not worth providing a generic localrc file which was a symlink to something on each machine's local hard drive because that would be a pain to keep up to date. In the end I did a separate single-machine install for each OS I wanted to use 7.0 on; disk is cheap. I had already separated out module trees to be per-OS to some extent so each machine only sees the appropriate Portland module.

Another little gotcha that I only discovered with Portland 7 (although with 20/20 hindsight it makes perfect sense) is that you cannot install the 32-bit compilers on 32-bit SuSE XXX and then run them on 64-bit SuSE XXX. You therefore need to do two separate single-machine installs, one on a 32-bit client and one on a 64-bit client, and provide separate modules for each.

Libraries

To make the PGI compilers work properly with new style modules for libraries I have to add a siterc file in the bin directories:

# get the value of the environment variable LIBRARY_PATH
variable LIBRARY_PATH is environment(LIBRARY_PATH);
variable inc_path is environment(CPATH);

# split this value at colons, separate by -L, prepend 1st one by -L
variable library_path is
default($if($LIBRARY_PATH,-L$replace($LIBRARY_PATH,":", -L)));
# hack up an rpath
variable my_rpath is
default($if($LIBRARY_PATH,-rpath $LIBRARY_PATH));

# add the -L arguments to the link line
append LDLIBARGS=$library_path;
append LDLIBARGS=$my_rpath;
append SITEINC=$inc_path;
Only the module files on 10.x workstations currently use the new-style library handling which sets LIBRARY_PATH and CPATH.

/usr/local/shared/sbin/testcompilers.sh is a script that checks the compiler's working and correctly configured. Running this is less tedious than testing it by hand.

MPI-CH

Portland 7.1 comes with MPI-CH. If you install it, it goes into an unexpected place (see above). We ought to install it, because it has an MPI debugger. I leave it in its installed location and make a module for it there.