Community
cancel
Showing results for 
Search instead for 
Did you mean: 
stoodsmj
Beginner
53 Views

ASSERT in simple Parallel_for

Hi,

I am starting out with TBB, and whist having success in some areas, and seeing dramatic performance improvements, I have come a across an issue, I am struggling to understand.

I have an unordered map:-

[cpp]

typedef tbb::concurrent_unordered_map<CString, CGeoStation *, UTCHashCompareNoCase> CGeoStationConcurrentUnorderedMap;[/cpp]

and my variable based on this is

[cpp]

CGeoStationConcurrentUnorderedMap * m_pStations;

[/cpp]

I have an issue when running the parallel_for. 

Note that the work done is commented out, in essence it is an empty loop.


[cpp] tbb::parallel_for(m_pStations->range(), [&] (CGeoStationConcurrentUnorderedMap::const_range_type & range)
{
for(auto it = range.begin(); it != range.end(); it++)
{
//if(WildCmpNoCase((LPTSTR)(LPCTSTR) strSearch, (LPTSTR)(LPCTSTR) it->second->GetLabel()))
//{
// m_theMatch.push_back(it->second);
//}
}
});[/cpp]

I get the assert 'my_begin_node is after my_midpoint_node' at line 822 in _concurrent_unordered_impl.h

[cpp]

#if TBB_USE_ASSERT

else {
sokey_t mid_key = solist_t::get_safe_order_key(my_midpoint_node);
__TBB_ASSERT( begin_key < mid_key, "my_begin_node is after my_midpoint_node" );
__TBB_ASSERT( mid_key <= end_key, "my_midpoint_node is after my_end_node" );
}
#endif // TBB_USE_ASSERT

[/cpp]

I am not sure what the assert means, or what could be causing it, or what I need to do to fix my code.

Thanks,

Mike

0 Kudos
5 Replies
Anton_M_Intel
Employee
53 Views

Thanks for your report! Can you isolate the problem into a simple reproducer test? Is this loop executed concurrently to other operations over this map? Which OS/compilers of what version do you use?
stoodsmj
Beginner
53 Views

Hi Anton, Its probably a bit difficult to isolate. It works well when I have 3K item in the map, but when I run a larger dataset with 20K items, it has the problem. I use Windows 7, MSVS 2012, but using the VS2010 libraries. I am not aware of any other looping with the map, BUT, as this map also feeds a GIS style map view as well, it is possible that a background paint utilising the map might be occurring, but I will disable that, and test. Mike
stoodsmj
Beginner
53 Views

Hi Anton, I have disabled the GIS map drawing code, so I am pretty sure that there is no other looping of the map of stations, and I am still getting the assert. Mike
stoodsmj
Beginner
53 Views

I have built a simple MFC app. It seems to be OK in 32 bit, but I get asserts in 64 bit. I have attached the file. I am probably at this stage looking as to what may cause the assert.
stoodsmj
Beginner
53 Views

I have solved the problem by moving to concurrenthashmap Mike
Reply