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

TBB example compiled with gcc run faster than icc

An_Yang
Beginner
406 Views

Hi all,

I'm learning TBB, according to TBB's getting started guide, I compile the TBB example in /opt/intel/tbb/examples/GettingStarted/sub_string_finder

compile with icc -O2 -DNDEBUG  -o sub_string_finder_extended sub_string_finder_extended.cpp -ltbb -lrt:

./sub_string_finder_extended

 Done building string.

 Done with serial version.

 Done with parallel version.

 Done validating results.

Serial version ran in 4.51256 seconds

Parallel version ran in 1.27341 seconds

Resulting in a speedup of 3.54367

and compile with gcc -O2 -DNDEBUG  -o sub_string_finder_extended.gcc sub_string_finder_extended.cpp -ltbb -lrt :

./sub_string_finder_extended.gcc

 Done building string.

 Done with serial version.

 Done with parallel version.

 Done validating results.

Serial version ran in 3.84717 seconds

Parallel version ran in 0.954878 seconds

Resulting in a speedup of 4.02896

My hardware platform is Intel(R) Core(TM) i7-2670QM CPU @ 2.20GHz+8GB RAM,CentOS 6.5 64bits,icc composer_xe_2013_sp1.2.144,gcc 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC).

$ ldd sub_string_finder_extended

    linux-vdso.so.1 =>  (0x00007fff93bc9000)

    libtbb.so.2 => /opt/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4/libtbb.so.2 (0x00007fbd4e968000)

    librt.so.1 => /lib64/librt.so.1 (0x000000333de00000)

    libm.so.6 => /lib64/libm.so.6 (0x000000333d200000)

    libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x0000003348600000)

    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003343a00000)

    libc.so.6 => /lib64/libc.so.6 (0x000000333ca00000)

    libdl.so.2 => /lib64/libdl.so.2 (0x000000333d600000)

    libpthread.so.0 => /lib64/libpthread.so.0 (0x000000333ce00000)

    /lib64/ld-linux-x86-64.so.2 (0x000000333c600000)

$ ldd sub_string_finder_extended.gcc

    linux-vdso.so.1 =>  (0x00007fff2fd16000)

    libtbb.so.2 => /opt/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4/libtbb.so.2 (0x00007f4795bd5000)

    librt.so.1 => /lib64/librt.so.1 (0x000000333de00000)

    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003343a00000)

    libc.so.6 => /lib64/libc.so.6 (0x000000333ca00000)

    libpthread.so.0 => /lib64/libpthread.so.0 (0x000000333ce00000)

    libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x0000003348600000)

    libdl.so.2 => /lib64/libdl.so.2 (0x000000333d600000)

    libm.so.6 => /lib64/libm.so.6 (0x000000333d200000)

    /lib64/ld-linux-x86-64.so.2 (0x000000333c600000)


Could you give me some explaination please?

0 Kudos
2 Replies
Vladimir_P_1234567890
406 Views

Hello,

did you try to run the example several times? or in _different_ order (gcc first then icc)?

otherwords, powersaving technologies may affect run-to-run results. in addition to above questions/suggestions to compare results you can try to re-run the example with disabled in bios speed-step and turbo-boost technologies.

--Vladimir

0 Kudos
Shenghong_G_Intel
406 Views

Hello, An Yang,

I can reproduce the issue, and it is not related to TBB. :( The ICC's serial version will always be about 1 seconds slower than GCC's.

It may be a performance issue of ICC optimization, I will submit the test case to developer to investigate and maybe a fix is needed. I will update you if I get any feedback.

Thanks,

Shenghong

Testing results on SNB machine:

[sgeng2@snb04 temp]$ icc -O2 -o sub_string_finder_extended.icc sub_string_finder_extended.cpp

[sgeng2@snb04 temp]$ time ./sub_string_finder_extended.icc
 Done building string.
 Done with serial version.

real    0m5.076s
user    0m5.071s
sys     0m0.001s
[sgeng2@snb04 temp]$ g++ -O2 -o sub_string_finder_extended.gcc sub_string_finder_extended.cpp
[sgeng2@snb04 temp]$ time ./sub_string_finder_extended.gcc
 Done building string.
 Done with serial version.

real    0m4.125s
user    0m4.090s
sys     0m0.031s
[sgeng2@snb04 temp]$

0 Kudos
Reply