Questions tagged [ppl]

The Parallel Patterns Library (PPL) is a C++ library included with Microsoft Visual C++ 2010+ that provides an imperative programming model that promotes scalability and ease-of-use for developing concurrent applications.

The Parallel Patterns Library (PPL) is a C++ library included with Microsoft Visual C++ 2010+ that provides an imperative programming model that promotes scalability and ease-of-use for developing concurrent applications.

135 questions
4
votes
2 answers

Converting concurrent_vector to std::vector

I'm looking for the recommended way to convert a concurrent_vector from the PPL library to a normal std::vector. I have a function which returns its results in a std::vector but may or may not use parallel algorithms internally. Currently I'm using…
MikeMB
  • 17,569
  • 7
  • 51
  • 93
4
votes
0 answers

WinRT WRL WinRtClassicComMix and IAsyncOperation fails

I have a C++ WinRT component which is a WinRtClassicComMix. I want to define a method which returns a custom class through an IAsyncOperation to the calling C# or WinJS code. All is working fine when an IAsyncAction is used with no return value,…
Rene Schulte
  • 2,942
  • 1
  • 17
  • 25
3
votes
1 answer

Converting a task to task

Is there a way to simplify the following code to avoid the .then call that "converts" my task to task? I can't change the function signature of MyClass::MyFunction1 because it's a part of a public API. task MyClass::MyFunction1() { …
K Mehta
  • 9,689
  • 4
  • 41
  • 69
3
votes
2 answers

Is there a awaitable queue in c++?

I use concurrency::task from ppltasks.h heavily in my codebase. I would like to find a awaitable queue, where I can do "co_await my_queue.pop()". Has anyone implemented one? Details: I have one producer thread that pushes elements to a queue, and…
petke
  • 1,027
  • 7
  • 20
3
votes
1 answer

How to catch exceptions from multiple tasks in Casablanca

I'm trying to join two pplx tasks using the && operator of task, where both sub tasks can throw exceptions. I understand from the ppl documentation that I can catch an exception in a final, task-based continuation. This works in Casablanca as…
hrantzsch
  • 193
  • 1
  • 6
3
votes
0 answers

Define the number of cores in concurrency::parallel_for

I am using concurrency::parallel_for from ppl.h (Windows). Can I specify the number of cores that the must be used? or at least the max number of cores?
Humam Helfawi
  • 17,706
  • 12
  • 64
  • 134
3
votes
3 answers

Task execution properties in ppl

Does newly created task from C++ ppl library executes automatically or is there any mechanism needed in order to initiate the execution of aforementioned task?
Artur
  • 181
  • 1
  • 9
3
votes
1 answer

PPL when_all with tasks of different types?

I'd like to use PPL "when_all" on tasks with different types. And add a "then" call to that task. But when_all returns task that takes a vector, so all elements have to be the same type. So how do I do this? This is what I have come up with but it…
petke
  • 1,027
  • 7
  • 20
3
votes
1 answer

How do I create concurrency::task from result?

I want to create a new task that is already completed from the given result. My current workaround is: return concurrency::task([]{return result;}); Is there anything better? The problem is with the following code: concurrency::task
Toni Petrina
  • 6,728
  • 1
  • 23
  • 33
3
votes
1 answer

Why is PPL significantly slower than sequential loop and OpenMP in this case

Further to my question on CodeReview, I am wondering why the PPL implementation of a simple transform of two vectors using std::plus was so much slower than the sequential std::transform and using a for loop with OpenMP (sequential (with…
Thomas Russell
  • 5,480
  • 3
  • 28
  • 61
3
votes
2 answers

Task continuations in Intel TBB

Is there anything similar to PPL's task continuations in TBB? I am aware of the low level TBB method of manuall allocating tbb::tasks and manually allocating continuation tasks too and managing ref counts manually for them: struct FibContinuation:…
Ed Rowlett-Barbu
  • 1,489
  • 9
  • 24
3
votes
3 answers

Microsoft VC++ PPL and sleeping

Following program runs differently depending on the sleep mechanism used. #include #include #include #include #include #include using namespace std; #define MODERN_MAN int main() { …
NoSenseEtAl
  • 23,776
  • 22
  • 102
  • 222
3
votes
2 answers

In VC++ PPL, how do I create a task-returning method that returns synchronously?

Consider the following C# code: async Task DoSomethingAsync() { if (m_f) return; await DoSomethingInternalAsync(); } What the compiler turns this into is a task returning call where if m_f is true, the task completes immediately and if not, it…
Shahar Prish
  • 4,692
  • 3
  • 24
  • 44
3
votes
2 answers

execute .then without delay

Since C++11 doesn't have a future.then I've started using concurrency::task from the Microsoft PPL library. It works great most of the time. However, right now I'm in a situation where I'm doing GPGPU, so having .then continuations scheduled in the…
ronag
  • 43,567
  • 23
  • 113
  • 204
3
votes
1 answer

Concurrent Processing From File

Consider the following code: std::vector indices = /* Non overlapping ranges. */; std::istream& in = /*...*/; for(std::size_t i= 0; i< indices.size()-1; ++i) { in.seekg(indices[i]); std::vector data(indices[i+1] - indices[i]); …
ronag
  • 43,567
  • 23
  • 113
  • 204
1
2
3
8 9