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.

142 questions
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
  • 49,529
  • 25
  • 126
  • 221
3
votes
1 answer

Compilation error with C++ Metro App Tutorial - task continuation

I am working through the "Tutorial: Create your first Metro style app using C++" on msdn (link). And shortly into "part 2" of it, I am running into an error. I'm running this on a Windows 8 VM Release Preview (May 31st) with the Visual Studio 2012…
Kevin Anderson
  • 6,850
  • 4
  • 32
  • 54
2
votes
1 answer

Safety of concurrent_vector

it is known that operator [] is not concurrently safe for writing: concurrent_vector::operator[] Operator But what if I guarantee that different threads will write to different vector positions. Like this (very much simplified…
IgorStack
  • 799
  • 2
  • 6
  • 22
2
votes
2 answers

Limit number of threads used in Concurrency::parallel_for

How to limit number of threads used in Concurrency::parallel_for(0, 100, 1, [&](int k) I saw the scheduler/task idea, I fail to use it cause inside the parallel for there is a lot of logic and I need to pass arguments, all the examples for…
InUser
  • 1,138
  • 15
  • 22
2
votes
0 answers

concurrency::parallel_for seem to skip some of parallel loop iterations

Here is the test code: #include #include #include using namespace std; int main() { const size_t n = 1000000; vector processed(n, false); concurrency::parallel_for(0, processed.size(), [&](size_t i)…
Alex
  • 21
  • 1
2
votes
1 answer

What are the benefits of returning a task from a function?

I've seen create_task used in a couple ways: void Bob() { create_task() { /* do stuff */ }.then([](){ /* do more stuff */ }); } and task Bob() { return create_task() { /* do stuff */ }.then([](){ /* do more stuff */ }); } Why bother…
Craig
  • 1,890
  • 1
  • 26
  • 44
2
votes
2 answers

How to find integer points (coordinates) inside a polytope/polyhedra?

I am using Python but I wouldn't mind changing language. All I have gotten from my research are tools to count the number of (lattice) points inside a region given the equations for the planes that enclose it. Other tools are made to optimize a…
Vinícius Godim
  • 217
  • 1
  • 8
2
votes
1 answer

Multithreading alternative to mutex in parallel_for

I'm fairly new to C++, therefore please pardon if this is a stupid question, but I didn't find good example of what I'm looking for on the internet. Basically I'm using a parallel_for cycle to find a maximum inside a 2D array (and a bunch of other…
Noldor130884
  • 974
  • 2
  • 16
  • 40
2
votes
1 answer

PPL - How to configure the number of native threads?

I am trying to manage the count of native threads in PPL by using its Scheduler class, here is my code: for (int i = 0; i < 2000; i ++) { // configure concurrency count 16 to 32. concurrency::SchedulerPolicy policy =…
Hao Xi
  • 351
  • 4
  • 12
2
votes
0 answers

What's the best way to return values from parallel_for

I have simple parallel_for loop and results of every iteration I am inserting to concurrent_unordered_map. I see that inserting makes my code much slower. So what is the best way to return pairs from parallel_for to unordered_map? I was trying with…
Queen
  • 173
  • 1
  • 11
2
votes
2 answers

Left Recursion and Right recursion produce same parse tree or not?

This is Right Recursion Grammar: -> = -> A | B | C -> + | -> * | -> ( ) | This is Left Recursion Grammar: -> = -> A |…
kp2349
  • 107
  • 1
  • 14
2
votes
1 answer

break sub task of parallel_for_each

I have a big vector of items that are sorted based on one of their fields, e.g. a cost attribute, and I want to do a bit of processing on each of these items to find the maximum value of a different attribute... The constraint here is that we cannot…
user8709
  • 1,342
  • 13
  • 31
2
votes
0 answers

Fire-and-forget with PPL?

I'm looking to start using PPL in my application. (I'm currently using std::async) I however have two (ugly) cases where I have to call long running functions that don't return any results. (Storing to database, and a network call). I don't wait…
petke
  • 1,345
  • 10
  • 25
2
votes
1 answer

Does PPL take the load of the system into account when creating threads or not?

I am starting to use PPL to create tasks and dispatch them [possibly] to other threads, like this: Concurrency::task_group tasks; auto simpleTask = Concurrency::make_task(&simpleFunction); tasks.run(simpleTask); I experimented with a small…
Patrick
  • 23,217
  • 12
  • 67
  • 130
2
votes
0 answers

Parallel Aggregration of a collection using PPL or TBB

I've decided to write an algorithm to utilize parallel aggregation. Here is the single threaded code that I want to transform. vector> sum; for (const auto* fold : _obj.GetFolds()) …
GreekFire
  • 359
  • 4
  • 15
1 2
3
9 10