Results 1 to 3 of 3

Thread: Progress Bar set value inside OpenMP parallel for

  1. #1
    Join Date
    Sep 2008
    Posts
    60
    Thanks
    20
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Progress Bar set value inside OpenMP parallel for

    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:

    Qt Code:
    1. #pragma omp parallel for
    2. for(int n..){
    3. for(int i...){
    4. for(int j...){
    5. //my stuff
    6. }
    7. }
    8. emit progressbar(n); //it doesn't work correctly and also increment calculation time.
    9. }
    To copy to clipboard, switch view to plain text mode 

    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.

  2. #2
    Join Date
    Jul 2009
    Location
    Enschede, Netherlands
    Posts
    462
    Thanked 69 Times in 67 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Progress Bar set value inside OpenMP parallel for

    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.
    Horse sense is the thing that keeps horses from betting on people. --W.C. Fields

    Ask Smart Questions

  3. #3
    Join Date
    Sep 2008
    Posts
    60
    Thanks
    20
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Progress Bar set value inside OpenMP parallel for

    Thank you very much for your answer.

Similar Threads

  1. Qt + OpenMP missing pthreadGC2.dll
    By Sanuden in forum Installation and Deployment
    Replies: 1
    Last Post: 30th March 2010, 14:13
  2. QThread and OpenMP on Mac problem
    By Debilski in forum Qt Programming
    Replies: 0
    Last Post: 7th April 2009, 17:41
  3. Replies: 4
    Last Post: 11th March 2008, 11:44
  4. Parallel Interface
    By r00tz in forum Qt Programming
    Replies: 31
    Last Post: 19th November 2007, 12:50
  5. Parallel and serial I/O
    By Roberto in forum Qt Programming
    Replies: 3
    Last Post: 10th October 2007, 11:53

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.