X2 affinity performace gains (a must read)UPDATED!!!

Page 2 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.

IdaGno

Senior member
Sep 2, 2004
452
0
0
RFC Rudel, TY for struggling w/the language to make this post anyway. You're doing just fine.
 

Miros

Junior Member
Nov 1, 2005
1
0
0
You should check out a tool i wrote a while back to deal with a similar performance issues using dual processors called "StartAffinity"

http://budda.phpwebhosting.com/StartAffinity/

It allows you to start a program with a given process mask, such as

startaffinity notepad 0

would start notepad on processor zero

startaffinity notepad 1

processor 1

start affinity notepad 0 1

both.

It supports up to 32 processors, and it's open source if you want to modify it.

The best part is you can put it in your windows directory and then simply modify your shortcuts so that they use it automatically to start your programs with whatever mask you want.

Cheers!
-Miros/Andrew
 

DAPUNISHER

Super Moderator CPU Forum Mod and Elite Member
Super Moderator
Aug 22, 2001
31,754
31,727
146
TTT^ and vote for sticky.
 

biostud

Lifer
Feb 27, 2003
19,765
6,850
136
I tried putting all processes on CPU0, but that made windows sluggish.
 

letdown427

Golden Member
Jan 3, 2006
1,594
1
0
I'll be able to make a program that does that. I'll try and get it done today, but to make it a nice simple rounded package wil take a bit of learning, so won't be done as quick. I know people probably won't trust me to send them a .exe, but just in case people would be interested, I can make it, and I can try and include as much justification of the various bits as I can, to hopefully make it seem safe.

http://forums.anandtech.com/messageview...?catid=28&threadid=1789381&STARTPAGE=1

I made that thread, n was then directed here, should've searched. :(


miros/andrew, I've been lazy, and I'm going to include your application in mine. I'll incorporate it so that once all the windows affinitys are set to one cpu, the game launches on the other one. Thanks for making that and making it open to everyone! I can't believe no1 has used it already! shame I don't know javascript that well (looks like that's what you used? i'm new to this programming thing) i can just about do a bit of vb6, so i probablyhave even less chance of deciphering your code to incorporate sepcific bits i want instead of just leeching the whole program!

if you don't want me to use it just say. admittedly i'll use it anyway for my own personal use, but yeah, any problems jsut say. I'll be happy to stick a notice saying you made the starting of games with the correct affinity possible.

thanks
 

letdown427

Golden Member
Jan 3, 2006
1,594
1
0
bump

I've made the app, it works lol, wouldn't say it's the cleverest of things, but it works. I tried a couple of tests, aquamark3, it made no difference to my CPU score at all. I got what was quite a high score for my curent clock, but I've had very similar before at the same clock speed, so I don't think the affinity made the score higher. I suppose it's possible, I'll have to run lots more tests. If I get consistently higher results then maybe. But even so, it's a tiny difference.

I also tried Live For Speed. It's an awesome game, with great physics, so tend to tax processors a lot. I tried to keep the test consistent, so just started a race with 12 AI (so it has to calculate their physics too) and I stayed put on the grid. I tried minimizing gfx card influence by turning settings right down, but somehow that made it run much slower. :s. either way, although I think maybe the average frame rate was slightly higher, it would be less than 1% different.

I have a 4400+ that I left stock for the tests, currently it's only paired with a 9600pro though, so it's going to be hard to get a game that's CPU bottlenecked for me to test with. I'll try knocking the multiplier right down tonight, so I'm at about 1Ghz, then hopefully Live For Speed will tax it enough. I've only recently started PC gaming again these last couple of months, having a decent paying job(for my age) means I can actually afford to waste money on my PC lol, but I'm still allergic to spending £450 on a gfx card. At the moment.

I'll try superpi at 1Ghz aswell, I suppose a low clock speed will mean any help the cpu can get makes a big difference.

I hope this thread wakes up again, people seemed really interested last year!
 

velis

Senior member
Jul 28, 2005
600
14
81
Just a dumb guess, but could it be that the performance improvements stem from more optimized cache usage? The way I see it, windows scheduler will divide a single task between cores equally so that both will be at 50% CPU usage. My guess would be that the scheduler schedules the task to CPU0 at first, but in next time slice it will assign it to CPU1 since CPU0 "seems" to be more busy. That seems rather dumb to me since it would mean filling the cache anew for each time slice. Granted, the cache gets filled from the other core, but it still takes x cycles to accomplish that. And so on and so on for each and every slice the app gets. Seems to me a simple change in scheduler to lookup the LAST CPU used for a particular thread would solve this problem.

Of course the DB and similar server apps don't suffer from this problem since thir time slice usually yields due to some breaking request (I/O) or the routine finishes it's work before the timeslice is due.
Games and other compute intensive apps however want the CPU all the time and haven't finished processing their data in the time slice that was given to them. I would suspect that shared L2 cache CPUs (Yonah) won't see any benefit from setting affinity while dual socket systems should see an even greater improvement (takes a lot more to get the L2 data across the bus than across the CPU die).

letdown427: You don't need to underclock your CPU. Just set your game to 640x480 low detail to make it CPU bottlenecked on 9600pro.
 

letdown427

Golden Member
Jan 3, 2006
1,594
1
0
Progress Report:

K, glad to see people are paying attention to the thread again!

I've decided that as opposed to testing things myself, with my limited resources, I'd do better to just make the program, and then let others test it aswell. Baically, unless the games are dual core optimized, this affinity splitting isn't going to do any harm, so I'll just make the program and let others use it if they want.



OK, so far, I've managed to make it work, but using a pretty crap method of just listing as many processes I know and getting it to assign all of those. I've now managed to get it to cycle through every running process and assign it to CPU0. And there's still the undo option, whereby it cycles through every process and assigns it to cpu 0 and 1. Would people prefer a text input box instead? I.e, one button, that assigns the processes to the CPU of your choice? So you cna set it to 1, or 2, or i suppose 3 or 4 if you have dual core hyperthreading, not sure how well that will work.


Also, the other current slightly crappy bit, is how you launch your programs on cpu 2. If you want to launch it from the form, you have to put in the full address. Which is kind of annoying. You can simply change your shortcuts to send the command line parameters to the relevant program, so it's not too much hassle, but doingi it from within the form is probably going to be annoying. Any ideas?

I'll try to find out how to make it store user input in the text boxes, so you could type in your game locations once, and then just have them there for future use, accessible at the click of a button.


can't think of anything else at the moment, ideas welcome!


EDIT:


How many games do you want to be able to run straight from the applications form?

I was thinking of making basically a list of input boxes, so you put in the full address of the game, then you have your button to run it by each box? Is this jst a waste of time on my part? It's easy to just modify say your desktop shortcut to a games executable, to make it include the necessary stuff to launch it on cpu2, and once that's done, you can just run my app, assign everything to cpu1, then click ur shortcut as normal, and it will run on cpu2 by itself. I'll probably just leave it like this for the moment, if anybody wants the program, PM me or post here, and we can try to arrange something.
 

letdown427

Golden Member
Jan 3, 2006
1,594
1
0
bumpety bump

I tested it with Live For Speed again. (Great game, made by 3 guys, no bullsh!t. d/l the demo!! www.liveforspeed.net)

In the interest of fair testing, I again didn't move my car at all. Instead, I started at the back of a grid of 12, and just kept a beady eye on the frame rate as the AI cars pulled away. It definately made a difference, lowest frame rate was I'd say 1-2fps higher (about 41.x was the lowest, and before affinity setting it briefly flashed 39.x). Yes, I repeated it a few times each, alternating between affinity divided by the program, and by windows. The difference is less than 5%, but still, it's more than 0%!

As I said before, PM me or post if you're interested in the program.
 

letdown427

Golden Member
Jan 3, 2006
1,594
1
0
more bumping

I'm having some problems. And I can't see what the issue is.

Basically, yes it works fine, but, if i try to launch chaos theory using the program, i get a BSOD, insisting INVALID_AFFINITY_SET . it says 0x0000003, which I thought must mean, ah, i've made a mess in the code and put 11 and not 01. but I haven't. And more annoyingly, i've tried putting notepad.exe into the same folder as splintercell3.exe, and launched it onto cpu 2 without a hitch. Any ideas?! I'm baffled.

EDIT:

Think i've got an idea. I'm confident it's because chaos theory does the whole disk checking thing, I don't know why that causes this invalid affinity set, but it does. Other programs work fine. I might try checking to see which process it is that needs to be on both cores for splinter cell to successfully check the disc, it's probably just while it accesses the disc drive, so I could easily just incorporate a quick affinity set when you click to launch it on both cores, and then wait a couple of seconds and assign it back to core 1. or, I could just leave it, as no-one cares! ah well.
 

vvume

Junior Member
Jan 20, 2005
11
0
0
There is no need for Windows Resource Mangager. A free and wonderful tool called THG Task Assignment Manager V1.0 is an excellent tool to set affinity of single threaded apps to specific processors. The performance differences can be dramatic. My Matlab (single threaded) benched a score of 35 (=Pentium 3.0) without affinity and 54 (=FX-60) with affinity on a dual core X2 4400+. Just configure the THG and put a shortcut to the startup folder.

Read this link for more information and download:
http://www.tomshardware.com/2004/05/28/...bang_out_of_your_dual_processing_buck/
 

letdown427

Golden Member
Jan 3, 2006
1,594
1
0
K, bump for update


Have added command line option, if you enter auto, it'll just set all the running processes affinities to 1. No form loaded, just done. So if you wanted, you could have it run on startup kind of thing too. I'll put in an option to make it wait for a bit before it runs, so that all your processes have a chance to start up first. so for example. if you put in auto10 it'll wait for seconds then set all the affinities. That should make it fairly flexible, so if you have a lot of stuff start at startup, then you can just put in a longer value.

Combine that with the fact that you could then make all your game shortcuts start it on cpu 2, this is almost becoming a useful app. lol.

Any ideas? At all? Anybody? lol
 

letdown427

Golden Member
Jan 3, 2006
1,594
1
0
this bumping is shameless isn't it?

I've fixed the splintercell issue, no more BSOD.

if anyone wants the app, PM me / post
 

velis

Senior member
Jul 28, 2005
600
14
81
Letdown, just a dumb question, but how did you solve account security there? Typically an administrator account does not have permission to set affinity for many service processes. Do you ignore those or did you change your app's security attributes?
 

letdown427

Golden Member
Jan 3, 2006
1,594
1
0
For some reason, it's only through task manager that you can't change the affinities for many processes. I presume you mean when you get the Access Denied message up?

I cheated somewhat in that someone had already made a program that could change the affinity of a process, provided you put in either the process name (and path if not in sys32) or the PID. It turns out that this program has the 'authority' to change the affinity of any process (i checked this using SysInternals Process Explorer, which I recommened! It's heaps better than task manager)

So basically my program enumerates the first process, gets the PID, then runs the affinity program with the appropriate command line parameters, and repeats through all the running processes.

Hope that helps
 

Daniel420

Junior Member
Nov 21, 2005
1
0
0
Letdown...
So what's the current state of the software? has it been posted for download? have a couple of people volunteered to test it?

I'm interested in optimizing the performance of my Opteron 165, but I am slightly leery of being one of the first three or four people to try the program.
 

Elfear

Diamond Member
May 30, 2004
7,163
819
126
Bump for you. I'll give the software a test as soon as I can and report back.
 

letdown427

Golden Member
Jan 3, 2006
1,594
1
0
hey. the 'software' is all done and works fine. I need somewhere to host it really, as most email accounts refuse to either send/receive/both .exe files.unsurprisingly.i've tested it on windows 2000 and windows xp, it works fine, and there's nothing really that can go wrong, so you shouldn't be too wary about 'testing' it. it'd be cool if you could do some tests with it though, as in, benchmark etc to see if it makes a difference.

 

Avalon

Diamond Member
Jul 16, 2001
7,571
178
106
What settings were you using in BF2 and HL2 to see these gains? It's important not to leave those details out.
 

letdown427

Golden Member
Jan 3, 2006
1,594
1
0
you'd have to contact RFC Rudel for that, I PM'd him to say I'd made the app, but he hasn't been online that I've seen.