CPU usage abnormal

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
li375268037
Posts: 4
Joined: 2012-02-22T00:04:06-07:00
Authentication code: 8675308

CPU usage abnormal

Post by li375268037 »

Hi, all
Environment: centos6.0, 16 cores, 8G mem
My lab want to use magick++ to sample local images(the number of images is about 70,000). i write an auto-processing program using c to sample the images. when run it by single thread, type top in command line, found that CPU usage is about 1400-1500%. when run it by multi-thread, CPU usage is however about 150-300%. After reading some articales on the forum, i re-install from the source configured with --disable-openmp, under single thread, CPU usage is about 90-200%, multi-thread is about 200-300%. Obviously time cost increase 3 times.
The work is done, but i want to know why. Or i can control it's CPU usage. Or i can use the IM effectively. it's just personal interests.
thanks all.
Last edited by li375268037 on 2012-02-23T19:02:11-07:00, edited 1 time in total.
li375268037
Posts: 4
Joined: 2012-02-22T00:04:06-07:00
Authentication code: 8675308

Re: CPU usage abnormal

Post by li375268037 »

mem usage is normal about 0.8%
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: CPU usage abnormal

Post by magick »

See MAGICK_THROTTLE @ http://www.imagemagick.org/script/resou ... nvironment. It periodically yields the CPU for at least the time specified in milliseconds. You can also set this value in the policy.xml configuration file.
li375268037
Posts: 4
Joined: 2012-02-22T00:04:06-07:00
Authentication code: 8675308

Re: CPU usage abnormal

Post by li375268037 »

i modify the policy.xml in install dir,<policy domain="resource" name="throttle" value="10"/>
CPU usage is normal. But it's not the result i want. If there is a compatible way that cut down the
CPU usage and do not slow the process,cost more time
i just want to find out a acceptable way to use the IM. Forgive me that i only deep into IM only several weeks,
IM needs more detail knowlege to understand for me.
thank u, magick.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: CPU usage abnormal

Post by magick »

Try setting the threads policy. The default is to use all the cores. You could set it to 1, to only use one core.
li375268037
Posts: 4
Joined: 2012-02-22T00:04:06-07:00
Authentication code: 8675308

Re: CPU usage abnormal

Post by li375268037 »

magick wrote:Try setting the threads policy. The default is to use all the cores. You could set it to 1, to only use one core.
i just tried, it doesn't work.<policy domain="resource" name="thread" value="1"/>. the experiment result indicates just CPU usage abnormal(1300-1500%).
If i configure IM with --disable-openmp, the CPU usage is about 100%. Parhaps it's the solution?
Post Reply