VS11 Beta: mixing PPL and C++11 concurrency


  • Hi,

    Is it safe (from the C++ runtime point of view) to mix PPL and C++11 concurrency constructs ? for example:

    #include <vector>
    #include <future>
    #include <ppl.h>
    #include <amp_graphics.h> // for float_3
    using namespace concurrency;
    using namespace concurrency::graphics;
    // CODE.....
    std::vector<float_3> vInf(16777216);
    // omitted code for vInf initialization
    // Reduce asynchronously vInf
    std::future<float_3> min_future = std::async(std::launch::async, [&] // from C++11
    	return parallel_reduce(vInf.begin(), vInf.end(), float_3(FLT_MAX), [](const float_3& a, const float_3& b) // from PPL
    		return float_3(min(a.x, b.x), min(a.y, b.y), min(a.z, b.z));
    // CODE.....
    float_3 min_ = min_future.get();

    Does the runtime allocate common concurrency resources (threads, sync objects, etc.) for PPL and C++11 ? If not, how does arbitration occur ? What about debugging such code (parallel tasks window in VS) ?

    All the best, Arnaud.

    2012년 3월 3일 토요일 오후 10:17