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
1
vote
1 answer

Parallel-For loop giving different sum results than single for loop. What am I missing?

We have an obscure bug in one of our programs. I've narrowed at least part of it down to this parallel-for loop. i is an int[], for testing purposes, filled with ints 0 - 99999. runningTotal is a long. lockObject is a new Object(); The Parallel-For…
1
vote
0 answers

Optimizing a parallel_for implementation

I had some code which used Microsofts PPL to do parallel_for loops, and then I had to move that to Linux and Mac which made me make my own version. It does what is should and it does it with decent performance, but it is still some 20% slower than…
JoeTaicoon
  • 1,117
  • 8
  • 20
1
vote
1 answer

Why is Dictionary crashing when I am sure I am accessing different value references synchronously?

During adding key to dictionary, it is crashing if I don't lock on it and giving NullReferenceException which is reasonable Rarely sometimes it is also crashing when I am adding element to the Dictionary Value (list reference), which is weird... I…
mustafabar
  • 2,206
  • 6
  • 31
  • 47
1
vote
0 answers

C++ OpenMP parallel with a read-only reference variable

I'm trying to run code in parallel with the GCC 4.4.7 version. I used the OpenMP library. I have a read-only variable (pointer to a class) which is shared by all the threads. The code is compiled and executed without any errors, but I do not obtain…
Cecile
  • 83
  • 7
1
vote
1 answer

Openmp: Cannot calculate the status of job inside parallel for loop properly

I am trying to implement a task status reporting features inside parallel for loop. This parallelization of for loop is being performed using “OPENMP”. I want status reporting to be performed like this: Work done 70%; estimated time left 3:30:05…
Garima Singh
  • 1,102
  • 4
  • 15
  • 40
1
vote
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
  • 299
  • 3
  • 14
1
vote
0 answers

Performance downgraded when applying TBB parallel_for to 40-core workstation

I've implemented TBB parallel_for in this way on a 4-core(8 threads) laptop i7-3920XM. It tooks about 15s to complete the calculation, and cpu usage is about 70% for each core. If I initialize a fixed number of threads, like g_nthreads = 4, for the…
yfeng
  • 100
  • 6
1
vote
1 answer

tbb::parallel_for running out of memory on machine with 80 cores

I am trying to use tbb::parallel_for on a machine with 160 parallel threads (8 Intel E7-8870) and 0.5 TBytes of memory. It is a current Ubuntu system with kernel 3.2.0-35-generic #55-Ubuntu SMP. TBB is from the package libtbb2 Version…
1
vote
0 answers

Parallel.For with raster image processing

I want to speed my code up. I'd like that snippet to work faster. I tried to create my own Parallel.For implementation of the loop, but I failed. No errors, but tifDS seems to be empty:/ Could any1 help me? Thanks in advance! Original loops: for…
Nickon
  • 8,180
  • 10
  • 52
  • 105
1
vote
1 answer

C# Parallel.For

Is the anyway to increase the number of loops a Parallel.For will do once it has started? Example below: var start = 0; var end = 5; Parallel.For(start, end, i => { Console.WriteLine(i); end = 10; }); Thanks for any help. Jay
Jay Webster
  • 159
  • 1
  • 2
  • 11
1
vote
0 answers

Doubly nested parallel for loops and their span

I'm trying to wrap my head around the idea of how parallel-for-loops work, its all rather new to me, and had read this stackoverflow thread, found here span and parallel loop, and found the top answer there really helpful. What I'm wondering though…
Hrafn
  • 2,709
  • 3
  • 23
  • 34
1
vote
3 answers

Scope of variables defined inside parallel_for

To execute a loop in parallel I am using: int testValues[16]={5,2,2,10,4,4,2,100,5,2,4,3,29,4,1,52}; parallel_for (1, 100, 1, [&](int i){ int var1; for (var1=1; var1<=20000; var1++) { int var2, var3, var4; double u[45],pl; …
Flash
  • 13,804
  • 11
  • 65
  • 91
0
votes
1 answer

Is it possible to use parallel_for and concurrent_vector for organizing asynchronous island GA algorithm?

Assume that we have a canonical island genetic algorithm with the ring topology. I use C++,PPL and MS Visual Studio 2010. It is convenient to work with parallel_for from PPL library. What program primitives should I use if the island must get the…
ilya
  • 941
  • 10
  • 30
0
votes
1 answer

C++ intel TBB inner loop optimisation

I am trying to use Intel TBB to parallelise an inner loop (the 2nd of 3) however, i only get decent pay off when the inner 2 loops are significant in size. Is TBB spawning new threads for every iteration of the major loop? Is there anyway to reduce…
111111
  • 14,528
  • 6
  • 38
  • 58
0
votes
1 answer

Cannot get speed for simple OpenMP parallel for loop

This is my first try on OpenMP, but cannot get speedup on it. The machine is Linux amd_64. I coded the following code: printf ("nt = %d\n", nt); omp_set_num_threads(nt); int i, j, s; #pragma omp parallel for private(j,s) for (i=0; i<10000;…