Questions tagged [parallel-for]

Parallel.For executes a for loop in which iterations may run in parallel to each other.

Parallel.For executes a for loop in which iterations may run in parallel to each other.

References

98 questions
16
votes
8 answers

Parallelizing a for loop gives no performance gain

I have an algorithm which converts a bayer image channel to RGB. In my implementation I have a single nested for loop which iterates over the bayer channel, calculates the rgb index from the bayer index and then sets that pixel's value from the…
eladidan
  • 2,564
  • 2
  • 22
  • 37
11
votes
1 answer

What is the meaning of AStride in TParallel.For?

TParallel.For() has an argument called AStride. In my case AStride is 2: TParallel.&For(2, 1, 10, procedure(index: Integer) begin TThread.Queue(nil, procedure begin memo1.Lines.Add(index.ToString()); …
iPath ツ
  • 2,358
  • 16
  • 30
11
votes
3 answers

Task.Factory.StartNew or Parallel.ForEach for many long-running tasks?

Possible Duplicate: Parallel.ForEach vs Task.Factory.StartNew I need to run about 1,000 tasks in a ThreadPool on a nightly basis (the number may grow in the future). Each task is performing a long running operation (reading data from a web…
Zaid Masud
  • 12,359
  • 8
  • 62
  • 84
10
votes
3 answers

What's the best way of achieving a parallel infinite Loop?

I've gotten used to using Parallel.For() in .Net's parallel extensions as it's a simple way of parallelizing code without having to manually start and maintain threads (which can be fiddly). I'm now looking at an infinite loop (do something until I…
redcalx
  • 7,398
  • 3
  • 45
  • 95
9
votes
3 answers

Does Thread.Sleep hinder other threads?

Here is a console program want 10 threads start in batch, wait 5 seconds, and stop in batch. static void Main(string[] args) { System.Threading.Tasks.Parallel.For(0, 10, (index) => { Action act = (i) => { …
demaxSH
  • 1,573
  • 2
  • 17
  • 26
6
votes
3 answers

How to use Parallel.For?

I want to use Parallel Programming in my project (WPF) . here is my for loop code. for (int i = 0; i < results.Count; i++) { product p = new product(); Common.SelectedOldColor = p.Background; p.VideoInfo = results[i]; …
unbalanced
  • 1,202
  • 5
  • 17
  • 40
5
votes
2 answers

OMP For parallel thread ID hello world

I'm trying to get started with using basic OpenMP functionality in C. My basic understanding of 'omp parallel for' leads me to believe the following should distribute the following iterations of the loop between threads and should execute…
Oliver
  • 611
  • 2
  • 9
  • 16
4
votes
5 answers

Is it possible to define the execution order in Parallel.For?

// parameters.Count == 10 // actualFreeLicenses == 2 Parallel.For(0, parameters.Count, new ParallelOptions() { MaxDegreeOfParallelism = actualFreeLicenses }, i => …
Saint
  • 5,127
  • 22
  • 57
  • 99
4
votes
3 answers

Visual C++ parallel_for + vectors access violation

I am trying to convert a process that loops through a ~12,000x12,000 cell matrix (around 125 times) to use parallel processing (via parallel_for). The code I am using is below. You can see where the for loop is commented out. When I run this code…
Andrew Rohne
  • 141
  • 3
  • 10
4
votes
3 answers

c# Parallel loop error

Anyone can help? When i write this code and run. The program show me error stated "There is already an open DataReader associated with this Command which must be closed first". This is my code. Parallel.For(0, MthRange, i => { …
Jane
  • 51
  • 2
4
votes
5 answers

Parallel.Foreach maintain collection order?

Is there a way to guarantee order when using Parallel.ForEach()? The collection I am looping over needs to maintain it's order but I was looking for some performance improvement.
3
votes
3 answers

When using Parallel BeginInvoke is working while Invoke is not - c# 4.0

When i use invoke inside AddListBoxItem function as seen below software become unreponsive and frozen but if i use BeginInvoke it works. Why is that happening ? visual studio 2010 , C# 4.0 private void button2_Click(object sender, EventArgs e) { …
MonsterMMORPG
  • 20,310
  • 69
  • 183
  • 306
3
votes
2 answers

Does powershell's parallel foreach use at most 5 thread?

The throttlelimit parameter of foreach -parallel can control how many processes are used when executing the script. But I can't have more than 5 processes even if I set throttlelimit greater than 5. The script is executed in multiple powershell…
Haoshu
  • 428
  • 2
  • 15
3
votes
3 answers

Do the parallel-for in .net 4.0 takes privilege of GPU computing automatically?

Do the parallel-for in .net 4.0 takes privilege of GPU computing automatically? Or I have to configure with some drivers so that it uses GPU.
Gulshan
  • 2,973
  • 5
  • 31
  • 44
3
votes
1 answer

c++ error when use parallel_for

I'm trying to use parallel_for, but I get an error, the code is: #include "stdafx.h" #include #include #include using namespace std; using namespace concurrency; int _tmain(int argc, _TCHAR* argv[]) { …
user2299317
  • 53
  • 2
  • 5
1
2 3 4 5 6 7