Hi,
I've run into strange performance issue that only reproduces on Linux (gcc 4.4) but is fine on Windows (VC8). I've got a case that seems to run fine if I do NOT explicitly create a task_scheduler_init object. As soon as I do that in my main(), using even just with default constructor arguments, my test cases slows down. Specifically, it slows down because it looks like there is some lock while running tbb::parallel_for() that prevents it from fully multithreading. On my i7 (4 cores hyperthreaded to 8), CPU usage is always roughly 12%. If I comment out the explicit task_scheduler_init construction, my test case is able to achieve around 50-60% CPU usage (the test case multithreads poorly).
The parallel_for() usage looks like this (where myThreadCount = 8):
static tbb::simple_partitioner part;
tbb::parallel_for(tbb::blocked_range(0,myThreadCount,1), apply, part);
The problem behaviour is same with the debug TBB library and as far as I can tell, also the same between TBB 2.2 or TBB 3.0. The full info below with TBB_VERSION=1 you'll note was taken against a debug tbb.
Any pointers?
Thanks,
-Edward
PS. In my other test cases, the behaviour does not occur, possibly due to less memory allocation?
TBB: VERSION 3.0
TBB: INTERFACE VERSION 5000
TBB: BUILD_DATE Mon May 17 15:47:20 UTC 2010
TBB: BUILD_HOST andorra (x86_64)
TBB: BUILD_OS Ubuntu 9.10
TBB: BUILD_KERNEL Linux 2.6.31-20-generic #58-Ubuntu SMP Fri Mar 12 04:38:19 UTC 2010
TBB: BUILD_GCC gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu9)
TBB: BUILD_GLIBC 2.10.1
TBB: BUILD_LD
TBB: BUILD_TARGET intel64 on cc4.4.1_libc2.10.1_kernel2.6.31
TBB: BUILD_COMMAND g++ -DTBB_USE_DEBUG -DDO_ITT_NOTIFY -g -O0 -DUSE_PTHREAD -m64 -fPIC -D__TBB_BUILD=1 -Wall -Wno-parentheses -Wno-non-virtual-dtor -I../../src -I../../src/rml/include -I../../include
TBB: TBB_USE_DEBUG 1
TBB: TBB_USE_ASSERT 1
TBB: DO_ITT_NOTIFY 1
TBB: ALLOCATOR scalable_malloc
TBB: RML private
TBB: SCHEDULER Intel
TBB: VERSION 3.0
TBB: INTERFACE VERSION 5000
TBB: BUILD_DATE Mon May 17 15:47:20 UTC 2010
TBB: BUILD_HOST andorra (x86_64)
TBB: BUILD_OS Ubuntu 9.10
TBB: BUILD_KERNEL Linux 2.6.31-20-generic #58-Ubuntu SMP Fri Mar 12 04:38:19 UTC 2010
TBB: BUILD_GCC gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu9)
TBB: BUILD_GLIBC 2.10.1
TBB: BUILD_LD
TBB: BUILD_TARGET intel64 on cc4.4.1_libc2.10.1_kernel2.6.31
TBB: BUILD_COMMAND g++ -DTBB_USE_DEBUG -DDO_ITT_NOTIFY -g -O0 -DUSE_PTHREAD -m64 -fPIC -D__TBB_BUILD=1 -Wall -Wno-parentheses -Wno-non-virtual-dtor -I../../src -I../../src/rml/include -I../../include
TBB: TBB_USE_DEBUG 1
TBB: TBB_USE_ASSERT 1
TBB: DO_ITT_NOTIFY 1
TBB: ALLOCATOR scalable_malloc
TBB: RML private
TBB: SCHEDULER Intel
Thanks,
-Edward