Copyright (C) 2000-2012 |
GNU Info (fftw.info)How Many Threads to Use?How Many Threads to Use? ------------------------ There is a fair amount of overhead involved in spawning and synchronizing threads, so the optimal number of threads to use depends upon the size of the transform as well as on the number of processors you have. As a general rule, you don't want to use more threads than you have processors. (Using more threads will work, but there will be extra overhead with no benefit.) In fact, if the problem size is too small, you may want to use fewer threads than you have processors. You will have to experiment with your system to see what level of parallelization is best for your problem size. Useful tools to help you do this are the test programs that are automatically compiled along with the threads libraries, `fftw_threads_test' and `rfftw_threads_test' (in the `threads' subdirectory). These take the same arguments as the other FFTW test programs (see `tests/README'), except that they also take the number of threads to use as a first argument, and report the parallel speedup in speed tests. For example, fftw_threads_test 2 -s 128x128 will benchmark complex 128x128 transforms using two threads and report the speedup relative to the uniprocessor transform. For instance, on a 4-processor 200MHz Pentium Pro system running Linux 2.2.0, we found that the "crossover" point at which 2 threads became beneficial for complex transforms was about 4k points, while 4 threads became beneficial at 8k points. automatically generated by info2www version 1.2.2.9 |