View Full Version : Can't use both cores


Warwizard
2nd January 2007, 03:20
I can't get xvid (on VDubMod) to use the 2 cores while encoding
cpu is a Core Duo T2400 1.83ghz (laptop)

the 2nd core usage is always at 90-100%
the 1st core is always at 0-10%
overall cpu usage is 50-51%

why is the 1st core idle?

I have tried to increase the thread priority, and it didn't work at all

vdubmod's affinity is always set to both cores

Sharktooth
2nd January 2007, 03:40
are you using xvid 1.2?

Warwizard
2nd January 2007, 15:45
yes
1.2.-127 (Koepi's)

foxyshadis
2nd January 2007, 16:53
Look under "other options"->threads, it should be 2 or 0. Also, ensure the avisynth script isn't using up all the available cpu time, which is pretty hard to cause without special deinterlacers and denoisers. You can try encoding something that's been compressed to huffyuv to test that.

There's also been a lot of updates to xvid since koepi's last build: http://tirnanog.fate.jp/mirror/XviD/ (MTK just means it includes a mediatek profile)

Warwizard
2nd January 2007, 17:18
ok i set the threads to 2 (it was 0)
and cpu usage jumped to 62-66%
(it was 50-51% before)

then i tried with 8 threads
and cpu usage jumped to 63-70%

then i disabled the only filter i'm using (resize)
and cpu jumped to 69-77%, with any number of threads bigger than 1

if threads = 0 or 1, cpu usage is always 50-51%

is it supposed to be that way? why not 99-100%? bottleneck?

btw, system specs are: T2400 cpu, 1gb ddr 533mhz ram, Fujitsu MHV2080BH (80gb 5400rpm), Intel GMA945 integrated graphics card, windows xp pro sp2
laptop model is: Lenovo thinkpad R60e

anyway, thanks for the link foxyshadis :)

Sharktooth
3rd January 2007, 14:52
1 thread will use 1 core...
8 is useless and ridiculously high. use 2 or 3 threads.
your CPU doesnt get used at 100% coz there are other bottlenecks. Try using Avisynth MT...

squid_80
3rd January 2007, 15:03
Actually I've noticed if you have other things running in the background, even if they have idle priority (like distributed computing clients etc.) windows will put them on one core and xvid's threads (using 2-4) on the other - so you still only get 1 core for xvid. But if you use a high number of threads like 6-8 some will be pushed onto the second core and the background tasks pre-empted, giving both cores to xvid.

Sharktooth
3rd January 2007, 15:19
never happened to me. when i encode i kill all the unnecessary processes...
however we all know windows is buggy...

henryho_hk
3rd January 2007, 16:03
however we all know windows is buggy...

It is a feature.... single-user optimization. :cool:

BTW, I am also using %NUMBER_OF_PROCESSORS%+1 number of threads for XviD encoding. On squid's advice, I will try +2. :D

Sharktooth
3rd January 2007, 17:31
x264 uses %NUMBER_OF_PROCESSORS% * 1.5

Manao
3rd January 2007, 22:55
But x264's threading method and xvid's are completely different. The optimal number for XviD if it was running alone should be %NUMBER_OF_PROCESSORS%. Since virtual dub runs avisynth in another thread, avisynth will interfere with XviD, so you need to find a compromise between the number of threads, and the relative timing for those threads. If you're using MT in avisynth, i'd still use %NUMBER_OF_PROCESSORS%.

For x264, it's more ( and not necessarily x1.5, there again, it may depends on the settings and the input ).

squid_80
4th January 2007, 14:42
never happened to me. when i encode i kill all the unnecessary processes...
however we all know windows is buggy...
It's not buggy since it works, but perhaps in a sub-optimal way.

The optimal number for XviD if it was running alone should be %NUMBER_OF_PROCESSORS%.
Yes indeedy. Here's some fps figures with xvid_encraw running by itself on my core2duo with different amounts of threads:
1 thread: 31.36
2 threads: 48.92
3 threads: 41.49
4 threads: 47.86
5 threads: 44.54
6 threads: 47.59
7 threads: 44.30
8 threads: 47.34
When the number of threads isn't cleanly divided between the cores it suffers. No real surprise. But as I said I always have background idle priority tasks running (BOINC), so let's see what that does:
1 thread: 29.76
2 threads: 13.10
3 threads: 8.94
4 threads: 17.88
5 threads: 42.94
6 threads: 41.75
7 threads: 40.58
8 threads: 40.40
So if xvid has to compete with other tasks, it performs best when threads / cores > other task threads.