- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The samplesource code to represent a bug:
[cpp]typedef tbb::concurrent_unordered_map< DWORD, int > tbb_cum_type; tbb_cum_type tbb_cum; int _tmain(int argc, _TCHAR* argv[]) { for(int i=0; i<100000; ++i) { #pragma omp parallel num_threads(8) { int l = 0; for(int k=rand(); k>0; --k) { l += k; } DWORD dwThreadID = GetCurrentThreadId(); tbb_cum[ dwThreadID ] = l; } tbb_cum.clear(); } return 0; }[/cpp]It crashes both in release and debug builds. I'm using TBB 3.0 (tried different revisions), MSVS C++ compiler (2008 9.0.30729.1 SP).
Could you help me and find what is wrong?
Call stack is slightly different each time, but for example it is:
OpenMPtest2.exe!tbb::interface5::internal::flist_iterator<:INTERFACE5::INTERNAL::SPLIT_ORDERED_LIST><:PAIR>
OpenMPtest2.exe!tbb::interface5::internal::concurrent_unordered_base<:INTERFACE5::CONCURRENT_UNORDERED_MAP_TRAITS>
OpenMPtest2.exe!tbb::interface5::internal::concurrent_unordered_base<:INTERFACE5::CONCURRENT_UNORDERED_MAP_TRAITS>
OpenMPtest2.exe!tbb::interface5::internal::concurrent_unordered_base<:INTERFACE5::CONCURRENT_UNORDERED_MAP_TRAITS>
OpenMPtest2.exe!tbb::interface5::internal::concurrent_unordered_base<:INTERFACE5::CONCURRENT_UNORDERED_MAP_TRAITS>
OpenMPtest2.exe!tbb::interface5::concurrent_unordered_map
> OpenMPtest2.exe!wmain$omp$1() Line 74 + 0xe bytes C++
vcomp90.dll!_vcomp::ParallelRegion::HandlerThreadFunc(void * context=0x00403d80, unsigned long index=1) Line 293 + 0x3b bytes C++
vcomp90.dll!_vcomp::PersistentThreadFunc(void * pvContext=0x00000001) Line 215 C++
kernel32.dll!7d4dfe37()
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also if your goal is to have a container that keeps thread-specific data values (as the code suggests), let me recommend you to try tbb::enumerable_thread_specific or tbb::combinable classes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I need a storage to hold some thread specific data (I'm using caching, which should work both in TBB and OpenMP threads). I will look at tbb::enumerable_thread_specific and tbb::combinable, thank you once more.
Regarding TBB version. I failed to find the exact version number in our commercial installation (it is 3.0.x for sure). But I tried version 3.0.5 with the same result (it also craches).
Best regards,
Maxim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page