Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7944 Discussions

How to set the compiler permanently?

Zoltán_C_
Beginner
1,556 Views

As a student, I successfully installed the Intel Parallel Studio XE 2016 Update 1 on the latest Ubuntu Mate in Virtualbox (I know, that the virtualization makes some features not work, but for me basically the compiler is needed at this time). It works well, but I would like to be able to use it just by typing icc in the terminal. I followed the steps of https://www.cms.hu-berlin.de/de/dl/systemservice/computeservice/docs/start_c.pdf, i.e.

source <install-dir>/bin/iccvars.sh <arg>

Since the program was installed to /opt/intel, I typed the command

source /opt/intel/bin/iccvars.sh intel64

After it, I can reach the commands icc and icpc, whichever directory I am. However, if I open a new terminal, I have to walk through this process again, meaning that I have to do that after a reboot. How can I achieve so that I don't have to repeat these steps, but Linux remembers it?

By the way, which architecture do you recommend: ia32, ia64 or intel64 (I have a 64 bit Linux and an Intel Core i7-4710MQ CPU)?

Thank you,

Zoltán

0 Kudos
1 Solution
TimP
Honored Contributor III
1,556 Views

As mentioned in the html page which the compiler install tries to display at the end, each linux shell has a file such as .profile in each user's home directory, where you could add the source compilervars step so that it happens automatically for each new shell. By the way, iccvars, ifortvars, and compilervars appear to have been identical for several years; any of them will set up both Fortran and C and C++ if both have been installed.

ia64 will not work unless you have an Itanium machine and install icc 11.1.

ia32 would most likely be wanted for the case where you have some customers running 32-bit linux (why would they?).  On a 64-bit linux host system, it requires that you have installed the full g++ in both 32- and 64-bit versions, which may be difficult to accomplish on many distros.  There are still a few cases which can be shown to run faster in 32-bit mode than in the normal 64-bit mode of 64-bit linux, but you have no mc_model options nor ability to allocate beyond the single memory subspace of less than 4GB.  As well as both g++ installations, you need the full ia32 Intel tools installation.

intel64 seems most likely to be what you want.  For that, you can deselect ia32 support in all the Intel tools installers, and avoid the search for non-default linux libraries etc.   If you are able to use on-line installer, this could save install time.

View solution in original post

0 Kudos
5 Replies
TimP
Honored Contributor III
1,557 Views

As mentioned in the html page which the compiler install tries to display at the end, each linux shell has a file such as .profile in each user's home directory, where you could add the source compilervars step so that it happens automatically for each new shell. By the way, iccvars, ifortvars, and compilervars appear to have been identical for several years; any of them will set up both Fortran and C and C++ if both have been installed.

ia64 will not work unless you have an Itanium machine and install icc 11.1.

ia32 would most likely be wanted for the case where you have some customers running 32-bit linux (why would they?).  On a 64-bit linux host system, it requires that you have installed the full g++ in both 32- and 64-bit versions, which may be difficult to accomplish on many distros.  There are still a few cases which can be shown to run faster in 32-bit mode than in the normal 64-bit mode of 64-bit linux, but you have no mc_model options nor ability to allocate beyond the single memory subspace of less than 4GB.  As well as both g++ installations, you need the full ia32 Intel tools installation.

intel64 seems most likely to be what you want.  For that, you can deselect ia32 support in all the Intel tools installers, and avoid the search for non-default linux libraries etc.   If you are able to use on-line installer, this could save install time.

0 Kudos
Zoltán_C_
Beginner
1,556 Views

My .profile file contains this

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

Where should I put the source /opt/intel/bin/compilervars.sh intel64 line? Just at the end of the file? Perhaps it is written in the html file you mentioned, but for me, it did not pop up. Could you link it?

0 Kudos
TimP
Honored Contributor III
1,556 Views

Appending the source command in .profile will have the same effect as typing it in yourself first thing after opening a bash shell. 

I don't know whether the html page we are discussing is posted on line.

0 Kudos
Kittur_G_Intel
Employee
1,556 Views

Hi @Zoltan:  Tim has responded very nicely on what you should do to set up the .profile so that the compiler environment is automatically sourced every time you bring up a terminal. Any unix/bash manual should let you know more details on creating your own .profile file. That said, as an aside, in case you are also interested in automating the command line options you use in your compilation you can also use the "configuration files". You can find more details on it in the documentation at: https://software.intel.com/en-us/intel-software-technical-documentation. Likewise, you can also use response files to add options which are placed at the point where the response file is invoked on the command line as well.

_Kittur

0 Kudos
Zoltán_C_
Beginner
1,556 Views

Thanks both of you.

0 Kudos
Reply