Author Topic: Anyone using the Intel C Compiler?  (Read 4462 times)

0 Members and 1 Guest are viewing this topic.

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Anyone using the Intel C Compiler?
« on: July 23, 2011 »
I downloaded icc but it doesn't work with Visual Studio Express (only works with the non free versions?). I'm trying to get icc to compile from the commandline but it's not working out for me yet. Just wondering if anyone here has looked into it before I spend too much time trying to figure out the whole commandline interface.

From what I've read icc generates code that is much more optimized than anything else in the feild but only for intel compatible machines. Also I heard rumours that the intel libraries test if the machine is AMD and if so uses the slowest versions of each function.

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Anyone using the Intel C Compiler?
« Reply #1 on: July 24, 2011 »
I've used it a number of times over the years. It's very good.
What's not working?

Jim
Challenge Trophies Won:

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: Anyone using the Intel C Compiler?
« Reply #2 on: July 24, 2011 »
icc is a drop in replacement for cl.exe, you can build using icc from within Visual Studio but not with the Express Editions, which is what I have. So my only option is to build from the command line. Which is a process I'm unfamiliar with.

I've been following this walkthrough but am missing information about setting up the build environment. running vcvars32.bat should be all that's necessary to set up the environment (and it does work for cl.exe) but it doesn't work for icc. As soon as I include "windows.h" it fails.

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Anyone using the Intel C Compiler?
« Reply #3 on: July 25, 2011 »
What happens if you copy icc.exe into your build folder and rename it as cl.exe (you know, like you do with crinkler)?  You should be able to build from the gui then.

When you're building from the command line, you need to use the dos prompt that is given you by vcvars32.bat.  i.e. you can't just run that and build from any old command window.  Basically icc.exe can't find the include path to windows.h.  That's usually set in an environment variable called INCLUDE.  I think icc.exe is supposed to use all the same command line params as cl.exe.

Which package did you download from Intel?  Maybe I can give it a try for realz.

Jim
Challenge Trophies Won:

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: Anyone using the Intel C Compiler?
« Reply #4 on: July 25, 2011 »
Code: [Select]
Project : error PRJ0002 : Error result -1073741515 returned from
'C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\cl.exe'
That's the error I get when I rename icc to cl.exe and put it in the "...\VC\bin\" folder

I'm using the trial version of Intel C++ Composer XE 2011 for Windows

Challenge Trophies Won:

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: Anyone using the Intel C Compiler?
« Reply #5 on: August 15, 2011 »
I've cracked it. It still throws errors but at least it compiles. The bach file I made is compatible with icc version 11.1 [054] and it looks like this:

edit - tested icc out on my voxel engine using SSE3 (the limit supported by my CPU) and I'm happy to report that there is in fact an increase in performance compared to cl.exe, I'm getting about 5%-10% increase in framerate. (fps fluctuates but icc always stays slightly above cl)

Code: [Select]
set CURDIR=%CD%
set ICLVAR="C:\Program Files\Intel\Compiler\11.1\054\bin\ia32\iclvars_ia32.bat"
set TBBVAR="C:\Program Files\Intel\Compiler\11.1\054\tbb\ia32\vc9\bin\tbbvars.bat"
set MKLVAR="C:\Program Files\Intel\Compiler\11.1\054\mkl\tools\environment\mklvars32.bat"
set IPPENV="C:\Program Files\Intel\Compiler\11.1\054\ipp\ia32\tools\env\ippenv.bat"
if exist %ICLVAR% @call %ICLVAR%
if exist %TBBVAR% @call %TBBVAR%
if exist %MKLVAR% @call %MKLVAR%
if exist %IPPENV% @call %IPPENV%

SET ICPP_COMPILER11=C:\Program Files\Intel\Compiler\11.1\054
SET INTEL_LICENSE_FILE=C:\Program Files\Common Files\Intel\Licenses;%INTEL_LICENSE_FILE%
SET PATH=%ICPP_COMPILER11%\Bin\ia32;%PATH%
SET LIB=%ICPP_COMPILER11%\Lib\ia32;%LIB%
SET INCLUDE=%ICPP_COMPILER11%\Include;%INCLUDE%

icl  hello.cpp hello.obj
link hello.obj user32.lib
« Last Edit: August 16, 2011 by rain_storm »

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Anyone using the Intel C Compiler?
« Reply #6 on: August 16, 2011 »
Excellent news!  I have always found the Intel C compiler and VTune (or whatever it's called these days) to be very useful.  It's amazing to have tools that can show you where unexpected bottlenecks in your code can be found.

Jim
Challenge Trophies Won:

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: Anyone using the Intel C Compiler?
« Reply #7 on: August 16, 2011 »
hmm will have to look into this VTune, sounds interesting, the intel manual for using rdtsc to benchmark software is full of flaws, their method only works correctly if your software happens to be the only software running on the CPU, as in no operating system / no task switching.

One more thing I was amazed by is how little bloat icc produces compared to msvc the exact same source code compiles to 103KB using cl.exe but only 35.5KB using icl.exe thats a whole lotta dead code removal using icc's libraries, also you should still have access to icc's optimised math kernel even if you specify NODEFAULTLIB, though I haven't tested this yet.

Challenge Trophies Won:

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: Anyone using the Intel C Compiler?
« Reply #8 on: August 16, 2011 »
Quick test to see how icc compares to msvc using crinkling. Note that this is a minimalist example and should not reflect a production level demo. There is no telling which compiler would produce better compression without explicitly testing the specific demo on various compiler / compressor combinations.

This test is a simple "Hello World" MessageBox compiled with icc and msvc then linked using crinkler. As I am still trying to figure out all the commandline options I decided to run this test without any optimizations. Surprisingly msvc shaved off 3 bytes by turning off the optimize for size switch (/Os). Results for this test favour msvc with a 10 byte advantage over icc.

580 bytes : crinkler + icc
570 bytes : crinkler + msvc

Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1289
  • Karma: 466
    • View Profile
    • my stuff
Re: Anyone using the Intel C Compiler?
« Reply #9 on: August 19, 2011 »
When I once evaluated ICC for the company we ran into a few numerical obscurities where the compiler decided to optimize a bit too optimistically.
For the few percent of performance benefit it would have been too much work to inspect all critical code in detail.
This is probably not a problem for scene oriented one man projects, though.
Challenge Trophies Won:

Offline cybro

  • ZX 81
  • *
  • Posts: 3
  • Karma: 0
  • digikomm
    • View Profile
Re: Anyone using the Intel C Compiler?
« Reply #10 on: February 13, 2012 »
I used icc because when you go /Qstd=c99 you have designated initializer lists but in msvc you cant because it didnt have them. But I was using a warez icc just to try it out and I have since gotten rid of all of that stuff.

But here is a good link if you will use icc, it includes info to customise the runtime libs so that it doesnt penalise AMD cpu users. You just define a function so it uses yours and not the built in one which checks for geniune intel. Check it out: http://www.agner.org/optimize/
or
http://www.agner.org/optimize/blog/read.php?i=49
« Last Edit: February 13, 2012 by cybro »