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
0
votes
1 answer

Passing reference as task data - same values when task is run

Today, I'm trying to make a task manager for a personnal project. I wrote the following method : template void ThreadManager::AddTaskToRun(Callback&& fun, Args&&... args) { task_handle> task =…
Etienne Baudoux
  • 171
  • 2
  • 13
0
votes
1 answer

Are results of concurrency::when_all's return vector FIFO?

Concurrency::when_all function returns a std::vector with the return values of all tasks it awaited. Are the values in the vector in any sort of order, or are they in the order in which the tasks completed?
David Božjak
  • 14,847
  • 15
  • 63
  • 97
0
votes
2 answers

C++ Function signature that returns a PPL task?

I am a total noob when it comes to using PPL tasks within the C++ environment, so I am having a hard time to figure out what would be the C++ syntax of the following C# code: private static async Task
Deathicon
  • 1,259
  • 1
  • 16
  • 31
0
votes
1 answer

Periodic task with ConcRT

I am writing a C++ application that, among other duties, periodically (once in hour) makes requests to server. This scheduled task can be interrupted and forced to execute earlier (when application receives new user data). I've decided to use…
Andrew S
  • 23
  • 5
0
votes
1 answer

Chain the completion of an async function to another

I am working on a Windows Store (C++) app. This is a method that reads from the database using the web service. task Ternet::GetFromDB(cancellation_token cancellationToken) { uriString = ref new…
Furqan Khan
  • 494
  • 4
  • 12
0
votes
2 answers

Unexpected output from parallel_invoke in C++

I have put 3 tasks in parallel: print min, max, and average of two numbers. The first task prints min value twice, and I expect it's output to be contiguous. int wmain() { __int64 elapsed; elapsed = time_call([&] { double a =…
0
votes
2 answers

concurrent_vector is not working inside parallel_for ( PPL )

there is a sample working code below ( parallel_for using Parallel Pattern Library ( ppl ) ). The main problem in here is sqr < concurrent_vector > stored values changing in every execution, but it should not be! I used < concurrent_vector > for…
user2055437
  • 57
  • 1
  • 12
0
votes
1 answer

C++ Parallel Loop without locking critical section using PPL

in the below code, there is parallel_for loop implemented with PPL. The main problem is here; abc vector values is not correct when i was commented cs.lock() and cs.unlock(). I am using concurrency_vector type for randomly access array values but…
user2055437
  • 57
  • 1
  • 12
0
votes
1 answer

WinRT C++/CX Tasks not compiling

I'm trying to use C++/CX to create a WinRT component. I have the following code and it doesn't compile. What is wrong with it? From what I understand PPL tasks should transparently be converted to IAsyncOperation if it's a task with a…
Jeremy Edwards
  • 14,108
  • 15
  • 71
  • 98
0
votes
1 answer

C++ PPL - initialize a combinable

Let's say that in enclosing scope, I have some variables that each thread in a parallel_for loop should access. I have an idea combinable would suits, making one copy of my variable in each thread. However, I don't understand how to initialize my…
kiriloff
  • 22,522
  • 32
  • 127
  • 207
0
votes
1 answer

C++ PPL - lambda expression and data sharing

my program with PPL crashes. I do suspect some mishandled share of variables. If my syntax for parallel_for construct is parallel_for(0,p,[&x1Pt,&x2Pt,&confciInput,&formula,¶m,&method,&lowOneParam,&highOneParam](int i) { //…
kiriloff
  • 22,522
  • 32
  • 127
  • 207
0
votes
3 answers

warning C4189 in concurrent_vector.h

I got following warning in my project (both Release and Debug mode): C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\concurrent_vector.h(1599): warning C4189: '_Array' : local variable is initialized but not referenced …
IgorStack
  • 656
  • 1
  • 6
  • 19
-1
votes
1 answer

How to refactor code that is using PPL heavily. C++

So I have function that looks like this task> task1 = create_task([this,token, stream] { // Here I have code that is working, but I would like to refactor it // maybe even make it go after or before this…
J. Doe
  • 23
  • 3
-1
votes
1 answer

How a progressbar should be correctly updated within a nested loop in C++?

I use MS Visual Studio 2010, C++,PPL library for parallel calculations and Qt library. Concurrency::parallel_for (size_t(0), m_Engines.size(), [&](size_t i) { for (size_t j = 1;j <= m_Iterations;j++) { Compute(i);//some time-cosuming…
ilya
  • 941
  • 10
  • 30
-2
votes
1 answer

Concurrently operating on each pair

I've got a number of objects. I need to deal with each pair concurrently (not every pair, arbitrary pairings), but each object should be only dealt with in serial. I'm struggling to describe an algorithm which can deal with this, preferably without…
Puppy
  • 138,897
  • 33
  • 232
  • 446
1 2 3
8
9