PDA

View Full Version : Progress Bar set value inside OpenMP parallel for



lixo1
18th February 2010, 00:15
Dear All,

I would like to know if someone can help me in this situation:
I have a openmp parallel for and I would like to put progress bar increment inside like:


#pragma omp parallel for
for(int n..){
for(int i...){
for(int j...){
//my stuff
}
}
emit progressbar(n); //it doesn't work correctly and also increment calculation time.
}


But obviously it doesn't work, is there any way to perform this kind of idea?
Thank you very much for any kind of help.

franz
18th February 2010, 08:08
Since you are parallelizing the process, you actually don't know how far in the process you are -- you cannot trust n to be the actual progress. If you use the QtConcurrent system, you can get progress tracking using QFuture. You might have some overhead then, though. You could also increase a counter at the end of a cycle and emit the counter's value at given intervals (or every cycle). Make sure it's thread-safe though. OpenMP has a lock for such things as well I think.

lixo1
18th February 2010, 20:51
Thank you very much for your answer.