- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am trying to use Intel Parallel Inspector for validating a concurrent program I wrote using VC++12 STL async which is implemented using PPL Thread Pool. On execution the Inspector doesn't complain of any problems in the application but identified data races in PPL's Work Stealing Queues. But with all reasoning I did I couldn't understand why Inspector is reporting a data race as well how can PPL thread pool contain a data race which I suppose is well tested. An example of a problem reported is the construction of the task created and the access of the task status happens concurrently and has a data race. Here is the example code I used for this. I am using Visual Studio compiler 2013. Any help with this is appreciated. Let me know if I am missing something in this.
#include "stdafx.h"
#include <future>
#include <iostream>
#include <vector>
#include <thread>
#include <chrono>
using namespace std;
int main() {
auto foo = []() {
int sum = 0;
for (int i = 0; i < 100; ++i)
sum += i;
return sum;
};
vector<future<int>> fs;
int r[2];
int i = 0;
for (int i = 0; i < 2; ++i) {
fs.push_back(async(foo));
}
for (auto& f : fs) {
r = f.get();
i++;
}
cout << r[0] << r[1] << endl;
fs.clear();
return 0;
}
- Tags:
- CC++
- Debugging
- Development Tools
- Fortran
- Intel® Inspector
- Optimization
- Parallel Computing
- Vectorization
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Microsoft PPL and C++ futures are not supported by IXE.
It is common to see data races in parallel frameworks that IXE does not support. One of the key properties of a parallel framework is to construct properly synchronized actions out of unsynchronized accesses. For example, consider a simple implementation of a spin lock - multiple threads will race to access a shared location, and the first one to access will obtain the lock. If IXE does not know this access is supposed to be a lock, then it will report a data race (there is an API to communicate this information to IXE, for users with their own locks).
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page