Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
2401 Discussions

Thread Checker detecting errors in nothing code

BRIAN_R_Intel
Employee
78 Views

Hi,


The TBB Thread Checker was flagging all kinds of write/read errors in my application. So I paired it down to the following...which still produces errors in thread checker. The following is the simple source code and results of the checker. Is there something wrong with how I am using parallel_for or perhaps the checker? Any help would be greatly appreciated.

Thanks, Brian

#include "tbb/task_scheduler_init.h"
#include "tbb/parallel_for.h"
#include "tbb/blocked_range.h"
#include

using namespace tbb;

class p_do {
public:
void p_do::operator() (const blocked_range &r) const {
for (size_t i = r.begin() ; i != r.end() ; ++i ) {
// do nothing
}
}
p_do::p_do () { }
};

int main(int argc,char* argv[]) {

int threads = atoi(argv[1]);
cout << "Threads= " << threads << endl;
task_scheduler_init init(threads);
int maxi = 5;
tbb::parallel_for (blocked_range (0,maxi,1) , p_do ());
cout << "Done" << endl;
}

Checker output>


Application finished

_______________________________________________________________________________
|ID|Short De|Sev|C|Context|Description |1st Acc|2nd Acc|
| |scriptio|eri|o|[Best] | |ess[Bes|ess[Bes|
| |n |tyN|u| | |t] |t] |
| | |ame|n| | | | |
| | | |t| | | | |
_______________________________________________________________________________
|1 |Write ->|Err|4|"tbb_ma|Memory write at "tbb_machine.h":111|"tbb_ma|"tbb_ma|
| |Write da|or | |chine.h|conflicts with a prior memory write|chine.h|chine.h|
| |ta-race | | |":107 |at "tbb_machine.h":111 (output |":111 |":111 |
| | | | |&nb sp; |dependence) | | |
_______________________________________________________________________________
|2 |Write ->|Err|1|"LifoQu|Memory read at "LifoQueue.h":82 |"LifoQu|"LifoQu|
| |Read dat|or | |eue.h":|conflicts with a prior memory write|eue.h":|eue.h":|
| |a-race | | |78 |at "LifoQueue.h":74 (flow |74 |82 |
| | | | | |dependence) | | |
_______________________________________________________________________________
|3 |Write ->|Err|1|"LifoQu|Memory read at "LifoQueue.h":83 |"LifoQu|"LifoQu|
| |Read dat|or | |eue.h":|conflicts with a prior memory write|eue.h":|eue.h":|
| |a-race | | |78 |at "LifoQueue.h":74 (flow |74 |83 |
| | | | | |dependence) | | |
_______________________________________________________________________________

0 Kudos
1 Reply
Alexandr_K_Intel1
78 Views

Brian,

I unable to reproduce problem you reported with exactly your sources, but see something similar if set maxi to, say, 500. False positivies you reported is most likely result of relatively old Intel Thread Checker that know nothing about version 2 of TBB library.This can be resolved on the configuration file level, i.e. for Linux/Intel64 in /tcheck/bin/32e/tcheck10.ini section UserMode should contains all 4 TBB 2 libraries:

[UserModule]

libtbb.so.2=as_api

libtbb_debug.so.2=as_api

libtbbmalloc.so.2=as_api

libtbbmalloc_debug.so.2=as_api

ForIA-32 version/tcheck/bin/32/tcheck10.ini should be corrected same way.

To check the changes are correct, you can look at the tcheck_cl output. It should contains something like

Building project

Instrumenting

10% for-checker ( All Functions ):..

30% libc-2.5.so ( Minimal ):....

40% libdl-2.5.so ( Minimal ):..

50% libgcc_s-4.1.2-20070626.so.1 ( Minimal ):..

60% libm-2.5.so ( Minimal ):..

70% libpthread-2.5.so ( Minimal ):..

80% librt-2.5.so ( API Imports ):..

90% libstdc++.so.6.0.8 ( Minimal ):..

100% libtbb.so.2 ( API Imports ):..

Threads= 2

Verifying new module: libittnotify.so

9% libittnotify.so ( Minimal ):..

Verifying new module: libtbbmalloc.so.2

8% libtbbmalloc.so.2 ( API Imports ):..

I.e., both tbb and tbbmalloc (or tbb_debug and tbb malloc_debug) should be instrumented as API Imports.

Sorry for inconvenience. Please reports if this doesnt help.

Reply