Installing The Intel Compiler

Why would I write about installing the Intel compiler you ask? If you have ever had to install multiple versions of this compiler, you would know. It will make you swear. A lot. So I am writing all the issues I know about in the hopes of saving someone hours of frustration.

Issue #1

Typically in HPC, when installing software, you install to a directory structure like: /software/intel/version. However, the Intel compiler installer saves where you installed the first version and will try to save subsequent versions in the same folder. WHY?!?

In a standard install on Linux, Intel uses rpm packages and in subsequent installs will look to see if any such rpm packages exist. Why? To make all sys admins angry? To add cursing to the world? Nobody knows. So how do you get around this? You can find all the rpms via rpm -qa | grep '^intel' and then erase the rpms from the database via rpm -e --justdb. This is super painful to have to do for every install and difficult to script correctly.

But, there is another way. You can do a silent install: ./install --silent silent.cfg. There is an example configuration file in the base directory after untarring the install tarball. The trick at this point is to add a "secret-ish" command to not use rpms (used for installing on Debian/Ubuntu). The line to add is INSTALL_MODE=NONRPM. You can now install another version of the Intel compiler in any directory you wish.

But... Just to make everyone angrier, this still installs information about the packages Intel has installed. This does not affect different versions of installations (at least between major versions 17 and 19), but it does affect removal and reinstallation. If you simply remove the install directory, the information Intel saved is still around, and it will not let you install the same version again without removal of the extra stuff it hid on your file system. So you will also have to remove the following files if they exist: /opt/intel/intel_sdp_products.db, /opt/intel/.pset, /opt/intel/.intel-*, and ~/intel.

You can also run the uninstall.sh script in the install directory. This also seems to work for getting rid of the extra files Intel installs on your file system. Of course, uninstall script is found in different places depending on the major version of the Intel compiler you install. Find it with find . | grep uninstall.sh.

And voila! Now you can install into /software/intel/version for each version of the Intel compiler you want.

Issue #2

Yet another layer of hell is creating a module file for the Intel compiler. If you aren't familiar with modules but you use multiple versions of software, I suggest you look it up. It's amazing. You type module load intel/17.8 and BAM! When you type icc, the 17.8 version of the Intel C compiler is used.

With GCC, all the module file has to do is add a directory to the following environment variables: PATH, LD_LIBRARY_PATH, and MANPATH. Intel, in their infinite wisdom, decided on needing to create a script that needs to be sourced and adds 100 environment variables. Intel's solution to creating a module file is not to supply one, but to have the sysadmin use a perl script called env2 to change the bash script into a module file!

First, kuddos to the people who made env2. It works amazingly well. Second, bad Intel! If I had a newspaper to roll up and you had a nose, I would hit your nose with the newspaper.

Issue #3

At this point, I thought I was done. I had solved all my problems installing the Intel compiler. But the people at Intel were still smarter than me. I created a script called install, to install the Intel compiler. This gave me the following error.

Another instance of the installation program has been detected. Please quit the other instance and try again.

WTF?!?!? I finally realized the Intel installer probably does a fancier version of ps | grep install to see if it is already running. But it checks only against the name install? As though I, as a Linux user, couldn't have another process separate from Intel called install? ARRRGGGGHHHHHH!!!!!! I renamed the script to install-intel and it worked!

The End

So, that's my story. I hope it is useful to someone else in the future. To conclude, here is an abbreviated version of the script that took me soooo long to make.

   $!/bin/bash

   # Install compiler
   tar xvf $SRC_FULLPATH
   cd parallel*
   ./install.sh --silent ../silent.cfg

   # Install module file
   cd ..
   echo "#%Module 1.0" > 19.5
   echo "conflict intel gcc" >> 19.5
   echo " " >> 19.5
   echo "### Stuff made by env2 script ###" >> 19.5
   perl env2 -from bash -to modulecmd \
      "/software/intel/19.5/bin/compilervars.sh intel64" >> 19.5
   cp 19.5 /modules/intel
   
Don't forget to add INSTALL_MODE=NONRPM to the configuration file.