[Qt-interest] Using QThreads for parallel diffusion

quasilister quasilister at gmail.com
Thu Oct 22 20:42:14 CEST 2009


Dear QtUsers,

I am trying use QThreads for a numerical calculations in addition to 
normal threading of an application.  Specifically, I am using QThreads 
for a parallel implementation of solving a basic diffusion equation.  Do 
QThreads take a particularly long time to spawn?  I know that hardware 
will play a big importance on timing, but has anyone ever made such a 
measurement?  I may be doing something terribly wrong but when I 
compared serial to threaded code the times to completion were nearly 
identical for a lattice size of 1024x1024.  This remained true for 2,4 
and 8 threads.  (I am running on a mac pro with dual quad core 
processors 6GB RAM).  I was expecting a 40%-50% improvement on time.  
After increasing the size to 2048x2048 I finally saw the improvement I 
was expecting.  To me, this seems like QThreads take quite a bit of time 
to spawn. 


I should note that I am restarting threads in the following manner:
    for(int i = 0; i < num_threads; i++) {
            Thread_Array[i].start();
        }
        for(int i = 0; i < num_threads; i++) {
            Thread_Array[i].wait();
        }


And looping over both those loops.

Any help would be greatly appreciate!



More information about the Qt-interest-old mailing list