Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Using Gentoo with ICC by default
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
ero
n00b
n00b


Joined: 22 Mar 2011
Posts: 5

PostPosted: Tue Mar 22, 2011 10:27 pm    Post subject: Using Gentoo with ICC by default Reply with quote

Hi all,

I just want to share my experience with icc (Intel Composer XE). Last week I compiled my system with icc as default compiler for Portage as instructed here:

http://www.gentoo-wiki.info/HOWTO_ICC_and_Portage

The only difference is in my /etc/portage/bashrc. I added:

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

at the top. Without this Portage was unable to find icc and perhaps a lot of other stuff from Composer XE. I am not sure if my system became more responsive than before but for sure it is not slower. The programs behave very well. Only compiz crashed 2-3 times for one week usage but it crashes sometimes anyway.

Here is the output from emerge -vpe world > world

http://chvor.net/world

Here are the packages compiled with gcc:

http://chvor.net/package.gcc

Here is my /etc/portage/bashrc:

http://chvor.net/bashrc

Here is my /etc/make.conf:

http://chvor.net/make.conf
Back to top
View user's profile Send private message
costel78
Guru
Guru


Joined: 20 Apr 2007
Posts: 402

PostPosted: Thu Mar 24, 2011 2:14 pm    Post subject: Reply with quote

Hi ero!

What ebuild do you used to install icc ?
Normally, path issues are solved in /etc/env.d/05icfc

Code:
PATH="/opt/intel/composerxe-2011.2.137/bin/intel64:/opt/intel/composerxe-2011.2.137/bin/ia32"
ROOTPATH="/opt/intel/composerxe-2011.2.137/bin/intel64:/opt/intel/composerxe-2011.2.137/bin/ia32"
LDPATH="/opt/intel/composerxe-2011.2.137/compiler/lib/intel64:/opt/intel/composerxe-2011.2.137/compiler/lib/ia32"
LIBRARY_PATH="/opt/intel/composerxe-2011.2.137/compiler/lib/intel64:/opt/intel/composerxe-2011.2.137/compiler/lib/ia32"
NLSPATH="/opt/intel/composerxe-2011.2.137/compiler/lib/intel64/locale/en_US/%N:/opt/intel/composerxe-2011.2.137/compiler/lib/ia32/locale/en_US/%N"
MANPATH="/opt/intel/composerxe-2011.2.137/man/en_US"

for example.

About compiz crashes, do you have 9.x version ? Because, for me, 0.8.6 is rock stable and I don't encounter any glitches (nvidia binary drivers).
You could also try to replace link-editor with Intel one (xild instead ld) via bashrc
Code:
export GCC=${OCC}
export GCXX=${OCXX}
export OCC="icc"
export OCXX="icpc"
export CFLAGS=${ICCCFLAGS}
export CXXFLAGS=${ICCCXXFLAGS}

# packaged compiled with gcc
[ -r ${ROOT}/etc/portage/package.gcc ] || return 0
while read -a target; do
  if [ "${target}" = "${CATEGORY}/${PN}" ]; then
    export OCC=${GCC}
    export OCXX=${GCXX}
    export CFLAGS="$flags"
    export CXXFLAGS="$CFLAGS"
    break
  fi
done < ${ROOT}/etc/portage/package.gcc

# All packaged compiled with icc are linked with xild, except the ones from package.icc-plain
if [ "${GCC}" = "icc" ]; then
  found="no"
  while read -a target; do
    if [ "${target}" = "${CATEGORY}/${PN}" ]; then
      found="yes"
      break;
    fi
  done < ${ROOT}/etc/portage/package.icc-plain
  if [ "${found}" = "no" ]; then
    export AR=xiar
    export LD=xild
    export LDFLAGS=" -Wl,-O,--sort-common,--warn-once,--hash-style=gnu,--as-needed"
  fi
  while read -a target; do
    if [ "${target}" = "${CATEGORY}/${PN}" ]; then
      export CFLAGS="${CFLAGS/-ipo}"
      export CFLAGS="${CFLAGS/-ipo-jobs4}"
      export CXXFLAGS="${CFLAGS}"
      break;
    fi
  done < ${ROOT}/etc/portage/package.ipo
fi

# Per package cflags (both gcc and icc)
if [ -r ${ROOT}/etc/portage/package.cflags ]; then
  while read target flags; do
    if [ "${target}" = "${CATEGORY}/${PN}" ]; then
      export CFLAGS="$flags"
      export CXXFLAGS="$CFLAGS"
      break
    fi
  done < ${ROOT}/etc/portage/package.cflags
fi

if [ "${OCC}" != "" ]; then
  export CC_FOR_BUILD="${OCC}" #workaround gcc detection function in toolchain-funcs.eclass
fi

unset GCC
unset GCXX


You maybe also want to exclude -gcc from your icc flags. It seem (linuxdna.com) that it cause more trouble than it solve and it's no longer required.
Here are my ICC flags:
Code:
-O2 -xHost -no-prec-div -unroll-aggressive -vec-guard-write -fp-math -ip -fno-builtin -w -malign-double -diag-disable warn -diag-disable caution -diag-disable remark

_________________
Sorry for my English. I'm still learning this language.
Back to top
View user's profile Send private message
dirkfanick
Apprentice
Apprentice


Joined: 12 Jan 2011
Posts: 201
Location: germany - hamburg

PostPosted: Thu Mar 24, 2011 3:00 pm    Post subject: Reply with quote

Quote:
I am not sure if my system became more responsive...


You could try benchmarktools.
Back to top
View user's profile Send private message
ero
n00b
n00b


Joined: 22 Mar 2011
Posts: 5

PostPosted: Fri Mar 25, 2011 1:41 pm    Post subject: Reply with quote

Hi all,

@costel78

Thanks for the advices. It's my bad, I forgot to mention that I downloaded Composer XE 2011.2.137 from Intel's website and I installed it manually. Btw is it available in Portage? Also, I would like to ask you, do you think it's worth it to recompile world with your icc flags?

Regarding compiz-fusion, I'm with 0.8.6 and it crashed twice while I was watching video on full screen with VLC and I pressed Alt+TAB. However, now it is working even with video on full screen I don't know what caused those 2 crashes.

@dirkfanick

Where can I find benchmarktools is it http://lbs.sourceforge.net/ and is it available in Portage?
Back to top
View user's profile Send private message
costel78
Guru
Guru


Joined: 20 Apr 2007
Posts: 402

PostPosted: Fri Mar 25, 2011 5:05 pm    Post subject: Reply with quote

No, it's not available from portage. I made my own ebuild from old-one from portage and bicatali overlay.
Here is it:
Code:
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-lang/icc/icc-11.1.072-r1.ebuild,v 1.1 2010/11/26 13:20:12 jlec Exp $

EAPI="3"

inherit rpm versionator check-reqs

PB=cproc
PACKAGEID="l_ccompxe_${PV}"
PACKAGEID=${PACKAGEID/_12/_2011}
RELEASE="$(get_version_component_range 1-2)"
BUILD="$(get_version_component_range 3)"
PID=2054

DESCRIPTION="Intel compiler suite for Linux"
HOMEPAGE="http://www.intel.com/software/products/compilers/clin/"
SRC_COM="http://registrationcenter-download.intel.com/irc_nas/${PID}/${PACKAGEID}"
IUSE="both eclipse idb ipp mkl"
#SRC_URI="amd64? ( ${SRC_COM/_2011/_intel64_2011}.tgz )
SRC_URI="amd64? ( SRC_URI="${SRC_COM}.tgz" )
   x86?  ( ${SRC_COM/_2011/_ia32_2011}.tgz )"

LICENSE="Intel-SDP"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"

RESTRICT="mirror"

DEPEND=""
RDEPEND="eclipse? ( >=dev-util/eclipse-sdk-3.4 )"

DESTINATION="opt/intel/composerxe-${PV/12./2011.}"
EDESTINATION="${EROOT#/}${DESTINATION}"

QA_TEXTRELS="${EDESTINATION}/*"
QA_EXECSTACK="${EDESTINATION}/*"
QA_PRESTRIPPED="${EDESTINATION}/compiler/lib/*/.*libFNP.so ${EDESTINATION}/bin/*/.* ${EDESTINATION}/debugger/*/*/.*"
QA_DT_HASH="
   ${EDESTINATION}/bin/*/.*
   ${EDESTINATION}/compiler/lib/*/.*
   ${EDESTINATION}/mkl/lib/*/.*
   ${EDESTINATION}/mkl/benchmarks/mp_linpack/bin_intel/*/.*
   ${EDESTINATION}/ipp/lib/*/.*
   ${EDESTINATION}/debugger/*/*/.*"

pkg_setup() {
   use x86 && use both && die "You cannot use amd64 libraries pulled by \"both\" flag on your architecture. Please remove \"both\" from your use flags."
   CHECKREQS_MEMORY=1024
   CHECKREQS_DISK_BUILD=3072
   use idb && use ipp && use mkl && CHECKREQS_DISK_BUILD=4096
   check_reqs
   IARCH=ia32
   use amd64 && IARCH=intel64
   use ia64 && IARCH=ia64
}

src_unpack() {
   unpack ${A}
   mv "${WORKDIR}"/l_* "${S}"
   cd "${S}"
   # tbb is open source, thus built from sources in dev-cpp/tbb
   rm -f rpms/*tbb*.rpm
   use idb || rm -f rpms/*idb*.rpm
   use ipp || rm -f rpms/*ipp*.rpm
   use mkl || rm -f rpms/*mkl*.rpm
   use eclipse || rm -f rpms/*cdt*.rpm
   if has_version "~dev-lang/ifc-${PV}"; then
      rm -f rpms/*cprolib*.rpm
      use idb && built_with_use dev-lang/ifc idb && rm -f rpms/*idb*.rpm
      use mkl && built_with_use dev-lang/ifc mkl && rm -f rpms/*mkl*.rpm
   fi
   for x in rpms/intel*.rpm; do
      einfo "Extracting $(basename ${x})..."
      rpm_unpack ./${x} || die "rpm_unpack ${x} failed"
   done
}

link_eclipse_plugins() {
   ECLIPSE_V="$1"
   CDT_V="$2"
   einfo "Linking eclipse (v${ECLIPSE_V}) plugin cdt (v${CDT_V})"
   dodir /usr/$(get_libdir)/eclipse-${ECLIPSE_V}/plugins
   dodir /usr/$(get_libdir)/eclipse-${ECLIPSE_V}/features

   for f in "${DESTINATION}/eclipse_support/cdt${CDT_V}/eclipse/plugins"/*; do
      dosym "${EROOT}${f}" /usr/$(get_libdir)/eclipse-${ECLIPSE_V}/plugins
   done

   for f in "${DESTINATION}/eclipse_support/cdt${CDT_V}/eclipse/features"/*; do
      dosym "${EROOT}${f}" /usr/$(get_libdir)/eclipse-${ECLIPSE_V}/features
   done
   eend $?
}

#src_prepare() {
   #sed -n -e "s|\${SHARED_LOCATION}|${DESTINATION}|g" pset/install.shs || die
   # fix world writeable files
   #[[ -d ${DESTINATION}/mkl ]] && chmod 644 \
   #   ${DESTINATION}/mkl/tools/{environment,builder}/* \
   #   ${DESTINATION}/mkl/tools/plugins/*/*
   # remove for collision (bug #288038)
   #has_version "~dev-lang/ifc-${PV}" && \
   #   rm -f ${DESTINATION}/lib/*/locale/*/flexnet.cat
#}

src_install() {

   keepdir /opt/intel/licenses
   einfo "Copying files"
   dodir "/${DESTINATION}"
   #cp -pPR ${DESTINATION}/* "${ED}"/${DESTINATION}/ || die "Copying ${PN} failed"
   mv ${DESTINATION}/* "${ED}"/${DESTINATION}/ || die "Copying ${PN} failed"
   #mv "${ED}"/${DESTINATION}/compiler/* "${ED}"/${DESTINATION}/ || die "Copying ${PN} failed"
   #rmdir "${ED}"/${DESTINATION}/compiler
   
   local envf=05icfc

   if use both; then
      LD=${EROOT}${DESTINATION}/compiler/lib/${IARCH}:${EROOT}${DESTINATION}/compiler/lib/ia32
      use idb && LS=${LD}:${EROOT}${DESTINATION}/debugger/lib/${IARCH}:${EROOT}${DESTINATION}/debugger/lib/ia32
      use ipp && LD=${LD}:${EROOT}${DESTINATION}/ipp/lib/${IARCH}:${EROOT}${DESTINATION}/ipp/lib/ia32
      use mkl && LD=${LD}:${EROOT}${DESTINATION}/mkl/lib/${IARCH}:${EROOT}${DESTINATION}/mkl/lib/ia32
      cat > ${envf} <<-EOF
         PATH="${EROOT}${DESTINATION}/bin/${IARCH}:${EROOT}${DESTINATION}/bin/ia32"
         ROOTPATH="${EROOT}${DESTINATION}/bin/${IARCH}:${EROOT}${DESTINATION}/bin/ia32"
         LDPATH="${LD}"
         LIBRARY_PATH="${LD}"
         NLSPATH="${EROOT}${DESTINATION}/compiler/lib/${IARCH}/locale/en_US/%N:${EROOT}${DESTINATION}/compiler/lib/ia32/locale/en_US/%N"
         MANPATH="${EROOT}${DESTINATION}/man/en_US"
      EOF
   else
      LD=${EROOT}${DESTINATION}/compiler/lib/${IARCH}:${EROOT}${DESTINATION}/debugger/lib/${IARCH}
      use ipp && LD=${LD}:${EROOT}${DESTINATION}/ipp/lib/${IARCH}
      use mkl && LD=${LD}:${EROOT}${DESTINATION}/mkl/lib/${IARCH}
      cat > ${envf} <<-EOF
         PATH="${EROOT}${DESTINATION}/bin/${IARCH}"
         ROOTPATH="${EROOT}${DESTINATION}/bin/${IARCH}"
         LDPATH="${LD}"
         LIBRARY_PATH="${LD}"
         NLSPATH="${EROOT}${DESTINATION}/compiler/lib/${IARCH}/locale/en_US/%N"
         MANPATH="${EROOT}${DESTINATION}/man/en_US"
      EOF
   fi

   doenvd ${envf} || die "doenv ${envf} failed"

   #[[ -d ${DESTINATION}/debugger ]] && \
   #   dosym ../../common/com.intel.debugger.help_1.0.0 \
   #   ${DESTINATION}/debugger/gui/${IARCH}/plugins

   if use eclipse; then
      if has_version 'dev-util/eclipse-sdk:3.4'; then
         link_eclipse_plugins "3.4" "5.0" || die
      fi
      if has_version 'dev-util/eclipse-sdk:3.5'; then
         link_eclipse_plugins "3.5" "6.0" || die
      fi
   fi
}

pkg_postinst() {
   elog "Make sure you have recieved the an Intel license."
   elog "To receive a non-commercial license, you need to register at:"
   elog "http://software.intel.com/en-us/articles/non-commercial-software-development/"
   elog "Install the license file into ${EROOT}opt/intel/licenses."
}


If it worth or not to recompile all world set it's up to you. For me, the answer was yes.
The speed-up can be observed (definitely without any benchmarking tools) during audio-video transcoding, databases, archives programs like 7zip, bzip2 etc and apache.
For what are you using Gentoo ? Long story short - test your main apps, compare the numbers (icc/icpc vs gcc/gcc++) and make your decision.
My flags has have proven to be stable. No segmentation fault. I have only few packages compiled with ipo. Use ipo flag very carefully :)
_________________
Sorry for my English. I'm still learning this language.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum