Skip to content

Instantly share code, notes, and snippets.

@jimklimov
Last active October 4, 2021 10:01
Show Gist options
  • Select an option

  • Save jimklimov/98c303ce5be23405a19a9905de8577cf to your computer and use it in GitHub Desktop.

Select an option

Save jimklimov/98c303ce5be23405a19a9905de8577cf to your computer and use it in GitHub Desktop.
Intel CC on Linux
Earlier "icc" emulated "gcc"; nowadays it is a "clang"
* wget from intel site https://software.intel.com/content/www/us/en/develop/tools/oneapi/base-toolkit/download.html?operatingsystem=linux
* run the shell installer (may need to `export TERM=vt100` in console mode)
* use wrapper script below as /usr/bin/icc (symlinks as i++ and icc-cpp, maybe suffixed with version from path component e.g. icc-2021.3.0)
----
# copy-paste the file as /usr/bin/icc
chmod +x /usr/bin/icc
( cd /usr/bin && for I in i++ icc-cpp icc-cpp-2021.3.0 icc-2021.3.0 i++-2021.3.0 ; do ln -s icc $I ; done )
----
* if you build with suffixes of well-known compilers, this may do better:
----
( cd /usr/bin && for I in clang-cpp-icc-2021.3.0 clang++-icc-2021.3.0 clang-icc-2021.3.0 ; do ln -s icc $I ; done )
----
* optionally symlink the names into /usr/lib/ccache (as links to ../../bin/ccache):
````
( cd /usr/lib/ccache && for I in icc i++ icc-cpp icc-cpp-2021.3.0 icc-2021.3.0 i++-2021.3.0 ; do ln -s ../../bin/ccache $I ; done)
````
#!/bin/sh
ICCVER=latest
ICCTOOL="clang"
case "$0" in
*icc-[0,1,2,3,4,5,6,7,8,9]*|*i++-[0,1,2,3,4,5,6,7,8,9]*|*cpp-[0,1,2,3,4,5,6,7,8,9]*)
ICCVER="`echo "$0" | sed 's,^.*\(icc\|i\+\+\|cpp\)-,,'`"
;;
esac
case "$0" in
*cpp*) ICCTOOL="clang -E" ;;
*clang++*|*i++*) ICCTOOL="clang++" ;;
*clang*|*icc*) ICCTOOL="clang" ;;
esac
source_vars() {
# Avoid eating away script args
. /opt/intel/oneapi/compiler/"$ICCVER"/env/vars.sh || exit
}
source_vars
exec /opt/intel/oneapi/compiler/"$ICCVER"/linux/bin/$ICCTOOL "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment