0

I am using graphicsmagics to scale image,and I found openMP not improve the processing performance. following is my test result:

C:\Users\L.J.W>set OMP_NUM_THREADS=1

C:\Users\L.J.W>gm benchmark -stepthreads 1 -duration 10 convert d:/opt/1.jpg  -s
cale 300x300 -gravity center -quality 90 -strip d:/opt/2.jpg
Results: 1 threads 212 iter 9.70s user 10.02s total 21.151 iter/s 21.848 iter/cp
u 1.00 speedup 1.000 karp-flatt

C:\Users\L.J.W>set OMP_NUM_THREADS=4

C:\Users\L.J.W>gm benchmark -stepthreads 1 -duration 10 convert d:/opt/1.jpg  -s
cale 300x300 -gravity center -quality 90 -strip d:/opt/2.jpg
Results: 1 threads 212 iter 9.58s user 10.02s total 21.153 iter/s 22.133 iter/cp
u 1.00 speedup 1.000 karp-flatt
Results: 2 threads 212 iter 9.89s user 10.00s total 21.194 iter/s 21.435 iter/cp
u 1.00 speedup 0.996 karp-flatt
Results: 3 threads 213 iter 9.52s user 10.04s total 21.209 iter/s 22.383 iter/cp
u 1.00 speedup 0.996 karp-flatt
Results: 4 threads 212 iter 9.73s user 10.03s total 21.143 iter/s 21.778 iter/cp
u 1.00 speedup 1.001 karp-flatt

also found there are no difference in 8core server and 2core notbook.

something wrong?

L.J.W
  • 1,575
  • 5
  • 18
  • 24
  • http://www.graphicsmagick.org/benchmark.html in this webpage there is an example run and it shows some speedups. Are you sure about the OpenMP is used correctly. Did the library built with OpenMP support etc.? It seems that only one thread is active. You may write an easy OpenMP application which prints the number of threads and number of cores that is usable by OpenMP to be use that the environment variables are set correctly..?? – phoad Sep 30 '13 at 03:21
  • thanks for reply,but when I do the test,all cpu core are busy.and environment variables OMP_NUM_THREADS has set correctly.and graphicsmagics is build with ./configure --enable-shared --enable-openmp.any other need config? – L.J.W Sep 30 '13 at 09:03

1 Answers1

1

The scale algorithm is one of the few which is not multi-threaded. Luckily it is already pretty fast. Try -resize rather than -scale in order to see an improvement as threads are added. The actual performance with -resize might still be less than -scale (depending on your system).

Bob Friesenhahn
  • 306
  • 1
  • 5