Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

Bug with scheduler with TBB 64bits ?

diedler_f_
Beginner
600 Views

Hello,

I recently installed TBB (last version 2017 Update 3) on Windows 64bits and try to test it with a small C++ program :

#include <iostream>
#include <tbb/tbb.h>

int main()
{
    std::cout << sizeof(int*) << std::endl;

    while (1)
    {
        std::cout << "begin\n";
        tbb::task_scheduler_init init(8);
        std::cout << init.is_active();
    }

    return 0;
}

The first line shows me that I use a 64bits compiler (MinGW-w64 on Windows) but my program crashes if I try to create more than one instance of task_scheduler_init ...

However, the same program compiled with a 32bits compiler (mingw32-gcc on Windows) works well !

What is the trouble ? The documentation of task_scheduler_init (https://software.intel.com/en-us/node/506296) provides an example highlighted the same problem...

PS : I compiled myself the TBB lib from raw sources :

C:\tbb2017_20161128oss>mingw32-make compiler=gcc info
OS: windows
arch=intel64
compiler=gcc
runtime=mingw6.2.0
tbb_build_prefix=windows_intel64_gcc_mingw6.2.0

Thanks

0 Kudos
6 Replies
Maksim_D_Intel
Employee
600 Views

Hello

This issue already discussed in https://software.intel.com/en-us/forums/intel-threading-building-blocks/topic/641654

You should rebuild TBB with CXXFLAGS="-flifetime-dse=1" to fix this issue.

0 Kudos
diedler_f_
Beginner
600 Views

Maksim D. (Intel) wrote:
You should rebuild TBB with CXXFLAGS="-flifetime-dse=1" to fix this issue.

Hello,

Where can I add this command ? Does I need to modify any Makefile (and which Makefile ?) ? (sorry I am a beginner in makefile...)

Another question: What is the purpose of tbbmalloc ? Does I really need it ?

Thanks for your reply

0 Kudos
Maksim_D_Intel
Employee
600 Views

Where can I add this command ? Does I need to modify any Makefile (and which Makefile ?) ? (sorry I am a beginner in makefile...)

mingw32-make compiler=gcc CXXFLAGS="-flifetime-dse=1"

Another question: What is the purpose of tbbmalloc ? Does I really need it ?

Basically a tbbmalloc is a memory allocator that can work much faster in concurrent environment than a standard allocator.

BTW you can get simple explanation about tbbmalloc and tbbmalloc_proxy from this video https://software.intel.com/videos/1-minute-intro-intel-tbb-malloc-proxy-library . 

0 Kudos
diedler_f_
Beginner
600 Views

It seems to compile well but I have some warnings at the end of the build :

task.o: duplicate section `.rdata$_ZTIN3tbb4taskE[_ZTIN3tbb4taskE]' has different size
arena.o: duplicate section `.rdata$_ZTIN3tbb4taskE[_ZTIN3tbb4taskE]' has different size
scheduler.o: duplicate section `.rdata$_ZTIN3tbb4taskE[_ZTIN3tbb4taskE]' has different size
mingw32-make[1]: Leaving directory 'C:/tbb2017_20161128oss/build/windows_intel64_gcc_mingw6.2.0_release'

What does it mean ?

Thanks for the explanation of tbbmalloc and the link.

0 Kudos
Maksim_D_Intel
Employee
600 Views

task.o: duplicate section `.rdata$_ZTIN3tbb4taskE[_ZTIN3tbb4taskE]' has different size
arena.o: duplicate section `.rdata$_ZTIN3tbb4taskE[_ZTIN3tbb4taskE]' has different size
scheduler.o: duplicate section `.rdata$_ZTIN3tbb4taskE[_ZTIN3tbb4taskE]' has different size

It's a known issue with MinGW; It shouldn't affect library files

0 Kudos
diedler_f_
Beginner
600 Views

Thanks a lot, it is now working !

Have a nice day :)

0 Kudos
Reply