Thinking Parallel

A Blog on Parallel Programming and Concurrency by Michael Suess

Installing the Intel Compiler on Ubuntu Linux

IntelMost of my regular readers probably know by now that I am developing OpenMP-codes for work. I am also using Linux, more precisely Ubuntu Linux (even more precisely: Kubuntu Linux 6.10). When it comes to compilers for this platform, the Intel Compiler is one of the few affordable choices available – at least if you need OpenMP-support. Affordable in this case used to mean free for private use, cheap for academia and very reasonably priced for everyone else. I am being told by my students that Intel has changed that and the compiler is no longer free for private use, only an evaluation license valid for 30 days is available. I find this decision unfortunate, but of course I don’t know the logic behind it.

Competition is on the horizon, as the Sun compiler for x86/Linux is already in beta (will be free as far as I know). GCC will also include support for OpenMP in its next version 4.2, to be released some time next year – and this one is even free as in speech. The Portland Compiler is also available (although not free).

But this is not the topic of this article, instead I would like to tell you about how to install the Intel Compiler on a Debian-based system. Installation of this compiler used to be a real pain. There is an installation-guide still available online. It’s for Fortran, but used to work for C/C++ as well. It involves converting the rpm-packages with alien and for AMD64-based systems even messing around with these packages. Not too much fun, especially since it took a long time to do and was the primary reason I used to not update our compiler too often.

With the newest packages, the situation has changed. Although Ubuntu or Debian are still not officially supported, it is now possible to install the compiler using these steps:

  1. download the package (it’s a tar.gz-file)
  2. unpack it (tar -xvzf filename.tar.gz)
  3. sudo ./install.sh
  4. now simply find your way through the installer (should not be too hard) and it will happily install the compiler into a subdirectory of /opt (/opt/intel/cc/9.1.044/ in my case, but if you have a different version the directory will also be slightly different, so be sure to adapt the additional instructions below if needed)
  5. Party!

If all goes well, you should have an icc-binary in /opt/intel/cc/9.1.044/, which you can test by calling

  1. $ /opt/intel/cc/9.1.044/bin/icc -V

This should spit out some version information. What you cannot do (yet) is call the compiler from every directory since it is not yet in your path. Also, compiled programs need to be able to find the libguide.so-runtime library. There are multiple ways to solve these issues, probably the easiest one is to add the following to your ~/.bashrc (and ~/.profile if you want to make sure it is called in any case):

  1. export PATH=$PATH:/opt/intel/cc/9.1.044/bin/icc
  2. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel/cc/9.1.044

After that, the compiler should work correctly from any location in your directory tree.

Troubleshooting

This section lists some of the things that can go wrong and what can be done about them.

Library Issues

First of all, sometimes the compiler complains about missing g++ library versions (or something like that). With the current version of the compiler (9.1.044), this does not happen here anymore, but if it happens to you, try adding a LC_ALL=C in front of your compiler-command, e.g. to compile a simple hello-world program, do this:

  1. LC_ALL=C icpc hello_world.cpp -o hello_world

If the compiler suddenly starts to work then, you may consider placing this simple wrapper script in e.g. /usr/local/bin:

  1. !/bin/bash
  2. # this is a wrapper around icc, required to correctly compile any program with it
  3. # export GXX_INCLUDE=/usr/include/c++/3.4
  4. LC_ALL=C /opt/intel/cc/9.1.044/bin/icpc $*

Call the script icpc and make sure it is executable. A similar script may be needed for icc (although to be honest, I have never noticed any difference in between the two – it is recommended that you use icc to compile C-programs and icpc to compile C++-code, but it works the other way around just as well for me).

Note also the commented line where GXX_INCLUDE is set. Try uncommenting it if LC_ALL=C does not help (of course, make sure to set it to a path that actually exists).

Alien or RPM

If you happen to have the alien-package installed (or RPM for that matter), you need to do a couple additional steps after step 2 of my original installation instructions (found in the ever helpful ubuntu-forums):

  • change into the resulting directory/data (for the C/C++ compiler: cd l_cc_c_9.x.abc/data )
  • edit install_cc.sh and search for the first occurence of RPM_NOT_FOUND=$?
  • change it to RPM_NOT_FOUND=1 – this makes sure the installer does not ask the RPM-database to verify your glibc-version, which will break if you have the alien-package installed (because in this case, you will have an RPM-database, created by alien, that is empty)
  • cd ..
  • proceed with step 3 of my original instructions

Shell-Problems

If you look inside /opt/intel/cc/9.1.044/bin/icpc you will notice, that it is merely a shell-script that calls the actual binary. It wants to be executed using /bin/sh (as can be seen on the first line).

If you are on Ubuntu 6.10, your /bin/sh-symlink most likely points to /bin/dash. The Ubuntu-developers hope to save some boot-time with this transition (it used to point to /bin/bash), unfortunately it breaks the icpc and icc-scripts, as well as the installer-scripts (data/install_cc.sh) of the Intel Compiler (because they use export -N, which is only supported on bash and not on POSIX sh) . I took the easy way out and changed the symlink back to /bin/bash for the time being, but of course you can also change #!/bin/sh in the Intel Compilers scripts to #!/bin/bash (I am not sure exactly in how many files you have to change this, there may be more than the two I have mentioned – as I said, I took the easy way out). This is a bug in the Intel Compiler and needs to be fixed, though and I will file it with their premium support shortly, along with the RPM_NOT_FOUND-fix described above.

Looking at all the steps involved, the installation is still not exactly what I would call easy. However, things are improving and I thought it was worth having this short guide in one place.

25 Responses to Installing the Intel Compiler on Ubuntu Linux »»


Comments

  1. PJ
    Comment by PJ | 2006/12/27 at 19:26:23

    Have you tried using checkinstall to make a package? I prefer to debianize stuff whenever possible, if only for easy removal later.

  2. Comment by Michael Suess | 2006/12/27 at 22:21:34

    No, not yet (although I also prefer this way of distribution). The main thing that keeps me from doing so is lack of time…

  3. Comment by Olivier | 2007/01/16 at 01:48:59

    It appears that the Intel compiler is still free for private use (however, Intel dugged the non-commercial download section deeper inside the website layout).

    here’s a direct link (working as of Jan. 16th 2007):

    http://www.intel.com/cd/software/products/asmo-na/eng/download/download/index.htm

    thanks for the great site, btw.

  4. mox
    Comment by mox | 2007/01/19 at 10:42:04

    thanks for this instruction on installing the compiler, but i get an error on my ubuntu edgy, when i launch install.sh:

    ERROR: Installation can not proceeed. Please fix your /etc/hosts file
    to contain:

    Where is the ip address of the host,
    is the FULLY QUALIFIED host name, and
    is the (optional) hostname-only portion

    i post my /etc/hosts:
    127.0.0.1 localhost
    127.0.1.1 ubuntu

    # The following lines are desirable for IPv6 capable hosts
    ::1 ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters
    ff02::3 ip6-allhosts

    what ip should i add? thanks

  5. Comment by Michael Suess | 2007/01/19 at 11:06:28

    You don’t have a fully qualified hostname in your localhost entry. Try changing the first line of your hostfile to this:
    127.0.0.1 localhost.localdomain localhost

  6. Comment by Alvarow | 2007/01/26 at 18:01:37

    Please, note that for the above to work, you must NOT have RPM installed, else steps 1-5 will NOT work.

  7. Comment by Michael Suess | 2007/01/26 at 21:34:11

    @Alvarow: I don’t think so. If you do the steps highlighted in the “Alien or RPM”-Section, it should work even with RPM installed.

  8. Comment by Nicolaus Andratschke | 2007/02/13 at 13:17:49

    Thanks for the nice tut, but I#m already stuck at the very first steps.
    I try to install Intel C++ NC 9.1 on Ubuntu 6.10 (build_essentials installed). After executing the install script I always get the error “Unvalid license file”, when I enter the path (/opt/intel/license/XXX.lic). When using the serial number approach, I’m told that my serial number was registered to another account. I downloaded already twice with my two different emails, always the same error. Has anybody any ideas what’s going wrong? I did not experience this Problem with a previous intel c++ version.

    Thanks NIC

  9. Comment by Michael Suess | 2007/02/13 at 23:07:12

    Nicolaus: I am afraid this is a question you have to ask to the Intel Premier Support or at their forums, I cannot help you with that…

  10. Comment by Pete | 2007/02/15 at 23:39:20

    Same problem as Nicolaus, only with Fortran. I filed an online question with Intel Support, hope they get back.

  11. Comment by just me | 2007/03/16 at 16:15:18

    ahh,
    i never bother with the install script.. simply rpm2targz intel-icc91…rpm to obtain intel-icc91*tar.gz. then unpack the tar.gz archive (which will create opt/intel… so the best is to unpack to /). and all you have to do is edit files in /opt/intel/cc/9.1.*/bin; so that you replace all with the real path /opt/intel/cc/9.1.*.
    and that’s it. no hidden operations, everything is completely transparent. ah yeah, the license file should be put into /opt/intel/licenses/ (or ~/.intel/licenses/)…

  12. Comment by just me | 2007/03/16 at 16:16:30

    … you replace all (sharp bracket)INSTALL_DIR(sharppracket) … with the real patj

  13. Comment by Eric | 2007/04/26 at 06:47:25

    The ubuntu license file problem seems to be cauased by the #!/bin/sh problem mentioned above. If you wish to use the install.sh without making furhter changes, you will need to unlink /bin/sh and link to bash instead (ln -s bash sh).

    Doing this solved the problem for me on a fresh Ubuntu 7.04 install.

    Eric

  14. Comment by Minori | 2007/05/07 at 05:40:12

    Dear all,

    I’m a begginer of LINUX.
    I also faced same license problems with ubuntu7.04 for both intel fortran and C complier. I’d like to ask Eric which version of intel compiler did you use when you got sucsessful results. I used 9.1_043 for fortran and 9.1.047 for C++. and in the install.sh files, #!/bin/bash is written on top already. Do I need to link as “l -s bash sh” in this case?
    (Anyway I could not make it…)
    Regards,

    Minori

  15. Comment by Greg | 2007/05/30 at 02:24:34

    Can’t get it to install using Ubuntu 7.04. Error:

    proceeding as a root user…
    /home/greg/Desktop/l_cc_c_9.1.049/install.sh: 295: pushd: not found
    /home/greg/Desktop/l_cc_c_9.1.049/install.sh: 306: ./secore: not found
    /home/greg/Desktop/l_cc_c_9.1.049/install.sh: 313: popd: not found

    I have no clue what this means.

  16. d.
    Comment by d. | 2007/06/20 at 17:00:56

    Hi all:
    I followed your very welcomed instructions for the installation of the compiler (fortran instead of c) and things seem to be working if I stay in the installation directory, but not elsewhere or by other users.
    Thanx again,

    d.

  17. Comment by Michael Suess | 2007/06/27 at 23:11:15

    d: you need to set the PATH environment variable, as explained in the text above…

  18. Comment by Rushikesh Matkar | 2008/02/13 at 07:26:46

    Thanks for the excellent tutorial…
    I would like to point out that the path statements should be amended in the ~/.bashrc or ~/.profile as follows

    PATH=$PATH:/opt/intel/cc/9.1.044/bin/
    export PATH

    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel/cc/9.1.044/lib
    export LD_LIBRARY_PATH

    I just downloaded 10.1.008 from intels website and everything works perfectly on ubuntu gutsy 7.10

    I have a pentium celeron 556 Mhz 384 mb ram computer with linux installed

    Thanks again for the excellent tutorial…

  19. Comment by Giuseppe | 2008/03/01 at 14:42:24

    You are _fully_ right,Rushikesh!
    The proper environment commands for Fortran Intel compilation from any location is yours, in 4 steps like below carried out directly from $ prompt:

    1) $PATH=$PATH:/opt/intel/cc/9.1.044/bin (enter)
    2) $export PATH (enter)
    3) $LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel/cc/9.1.044/lib (enter)
    4) $export LD_LIBRARY_PATH (enter)

    Thanks to all

  20. Comment by yash | 2008/11/25 at 13:02:58

    Hi, regarding the Alien or Rpm error, I performed the steps mentioned above. following are the errors that i got.

    There is one or more critical unresolved issue which prevents installation to continue. You can fix it without exiting from the installation and re-check. Or you can quit from the installation, fix it and run the installation again.
    ——————————————————————————–
    Missing critical pre-requisite
    — missing system commands
    ————————————————————
    1. Show the detailed info about issue(s) [default]
    2. Re-check the pre-requisites

    The following required for installation commands are missing:
    libstdc++.so.5 (library)
    ——————————————————————————–
    1. Finish with prerequisites and back to Critical Pre-requisites dialog
    [default]
    2. Back to Pre-requisite summary dialog

    h. Help
    b. Back to the previous menu
    q. Quit
    ——————————————————————————–

    h. Help
    b. Back to the previous menu
    q. Quit

    I also edited the install_cc.sh file as mentioned but still was not able to move beyond the 4th step.
    The version of ICC that I’m installing is 11.0.074 and the OS is 8.04 Ubuntu Hardy Heron.

    Kindly provide me with the necessary details on how to resolve this error.

    Yash

  21. Comment by dims | 2009/02/25 at 14:18:11
  22. Comment by Wendy Doerner | 2009/07/06 at 19:52:02

    You might find the following knowledge base article helpful when using the Intel(R) Compiler on Ubuntu:

    http://software.intel.com/en-us/articles/using-intel-compilers-for-linux-with-ubuntu/

    Wendy
    Intel Developer Support

    Tools Knowledge Base:
    http://software.intel.com/en-us/articles/tools
    User forums:
    http://software.intel.com/en-us/forums/
    Software Product support info: http://www.intel.com/software/support

  23. Comment by thouraya | 2010/02/14 at 19:30:23

    Hello,

    thank you for the article it helped me to install the compiler,

    in fact it is compiling but not the execution

    Here are the error message:

    error while loading shared libraries: libiomp5.so: can not open shared object file: No such file or directory

    Thank you

  24. Tom
    Comment by Tom | 2010/11/03 at 00:35:05

    Hello,

    How would I install the compiler as a module? Any help would be appreciated.

    Thank you

  25. Tom
    Comment by Tom | 2010/11/03 at 00:35:51

    Hello,

    How would I install the compiler as a module. Any help would be appreciated!

    Thank you


Leave a Reply

HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>