Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Setting df to use more cpu?  (Read 3440 times)

raledon

  • Bay Watcher
    • View Profile
Setting df to use more cpu?
« on: July 11, 2014, 05:20:37 am »

DF (and many other strategy games) use a lot of cpu at certain times, such as when passing turns.
I was looking at the task manager, and noticed the my cpu usage was only 50%, and DF was taking its time processing stuff.
Is there any way to set windows to allocated more processing power to certain activities, so that it will process the game faster? It seem quite strange that a game could process something over a few seconds on 30%, instead of on 90%.
Logged

Caz

  • Bay Watcher
  • [PREFSTRING:comforting whirs]
    • View Profile
Re: Setting df to use more cpu?
« Reply #1 on: July 11, 2014, 05:23:40 am »

Give the DF process to core 1, and put everything else on core 2(+however many more you have)
Logged

miauw62

  • Bay Watcher
  • Every time you get ahead / it's just another hit
    • View Profile
Re: Setting df to use more cpu?
« Reply #2 on: July 11, 2014, 05:40:08 am »

To do that, open task manager, go to processes, right-click, set process affinity.
You'll have to do it for every process seperately, sadly.
Logged

Quote from: NW_Kohaku
they wouldn't be able to tell the difference between the raving confessions of a mass murdering cannibal from a recipe to bake a pie.
Knowing Belgium, everyone will vote for themselves out of mistrust for anyone else, and some kind of weird direct democracy coalition will need to be formed from 11 million or so individuals.

Thief^

  • Bay Watcher
  • Official crazy person
    • View Profile
Re: Setting df to use more cpu?
« Reply #3 on: July 11, 2014, 05:42:58 am »

Which will do precisely nothing if you have nothing else using CPU.

Simply put Dwarf Fortress (like many games) runs on only a single CPU core. If you have a dual-core CPU, it will only be able to use 50% at max (50% of 2 = 1 core). I suspect this is what you're seeing.
3 cores - 33% max
4 cores - 25% max
6 cores - 16% max
8 cores - 12% max
12 cores - 8% max ( :) )

EDIT: In other words, altering affinity is fairly pointless, the potential gains are unmeasurably small. Competition between multiple apps is best solved by altering their priority in task manager (Low/High as appropriate. Never press "realtime"). The only thing the affinity settings are really for is fixing bugs where a particular application won't run correctly on any core except #1, which isn't true of DF.
« Last Edit: July 11, 2014, 05:52:24 am by Thief^ »
Logged
Dwarven blood types are not A, B, AB, O but Ale, Wine, Beer, Rum, Whisky and so forth.
It's not an embark so much as seven dwarves having a simultaneous strange mood and going off to build an artifact fortress that menaces with spikes of awesome and hanging rings of death.

kingu

  • Bay Watcher
    • View Profile
Re: Setting df to use more cpu?
« Reply #4 on: July 11, 2014, 05:51:08 am »

I am a total retad when it comes to computers (and have bad English) so bear with me plese.

I have 3 cores. It seems all 3 are checked as an option for all processes by default.
If I set DF to use only no 3. Will everthing else automatically use the first 2 until those are at full capacity. Ensuring me that DF most likely is uninterfered with?

does this make sense at all?
Logged

taat

  • Bay Watcher
  • Doesn't notify people when putting them in the sig
    • View Profile
Re: Setting df to use more cpu?
« Reply #5 on: July 11, 2014, 06:12:55 am »

AFAIK the cpu isn't always the bottleneck, often it is the ram read/write speed.
Logged
Hypothesis: I will kill all dwarves in a horrible fashion

alexandertnt

  • Bay Watcher
  • (map 'list (lambda (post) (+ post awesome)) posts)
    • View Profile
Re: Setting df to use more cpu?
« Reply #6 on: July 11, 2014, 07:11:30 am »

I believe the graphics rendering is threaded to some degree, Plus some of the libraries/OS interactions may be multithreaded, so its not technically correct to say DF uses only one core.

In most cases you probably won't get a performance increase (and you may even get a slight performance decrease) by playing with the affinity options under taskmanager, the operating system is quite smart at managing load automatically.

If you are using an Intel processor, disabling Hyper-Threading may improve performance if you can even disable it (I believe you can on the old P4's, but I don't know about the Core processors).

DF is heavy on the RAM, and it's been observed that faster RAM with better timings can help.
Logged
This is when I imagine the hilarity which may happen if certain things are glichy. Such as targeting your own body parts to eat.

You eat your own head
YOU HAVE BEEN STRUCK DOWN!

JAFANZ

  • Bay Watcher
    • View Profile
Re: Setting df to use more cpu?
« Reply #7 on: July 11, 2014, 08:02:18 am »

I am a total retad when it comes to computers (and have bad English) so bear with me plese.

I have 3 cores. It seems all 3 are checked as an option for all processes by default.
If I set DF to use only no 3. Will everthing else automatically use the first 2 until those are at full capacity. Ensuring me that DF most likely is uninterfered with?

does this make sense at all?
I suspect you actually have 4 cores, numbering in Winblows (at least) starts at core #0.

If you really only have 3 cores, I suspect there's something wrong with your computer as computers are usually designed around multiples of 2 (it's a binary thing).
Logged

kingu

  • Bay Watcher
    • View Profile
Re: Setting df to use more cpu?
« Reply #8 on: July 11, 2014, 08:31:20 am »

I am a total retad when it comes to computers (and have bad English) so bear with me plese.

I have 3 cores. It seems all 3 are checked as an option for all processes by default.
If I set DF to use only no 3. Will everthing else automatically use the first 2 until those are at full capacity. Ensuring me that DF most likely is uninterfered with?

does this make sense at all?
I suspect you actually have 4 cores, numbering in Winblows (at least) starts at core #0.

If you really only have 3 cores, I suspect there's something wrong with your computer as computers are usually designed around multiples of 2 (it's a binary thing).

you are correct sir. Threre is a  #0 indeed
Logged

undersuit

  • Escaped Lunatic
    • View Profile
Re: Setting df to use more cpu?
« Reply #9 on: July 11, 2014, 12:21:05 pm »

If you really only have 3 cores, I suspect there's something wrong with your computer as computers are usually designed around multiples of 2 (it's a binary thing).

Not true. AMD Triple cores work perfectly fine, AMD and Intel have hex cores, and Intel's Xeons are actually built around 5 and 10 cores right now.

3 cores - 33% max
4 cores - 25% max
6 cores - 16% max
8 cores - 12% max
12 cores - 8% max ( :) )

OP, just remember that even if your CPU utilization is anything like Thief^'s chart, the cpu isn't necessarily suffering in performance. You're seeing a snapshot of the CPU activity. Windows Taskmanager gives you an update every 500ms I think. During that time each core has had about 1.5 billion cycles to to do things. The cpu scheduler has been bouncing the DF thread around your cores multiple times while DF waits for the memory access to clear, and letting other processes use some of the core while it waits. The actual DF thread is running at 100% on one core until it needs more data, at which point it may be hefted to another core for optimization purposes.
« Last Edit: July 11, 2014, 12:23:32 pm by undersuit »
Logged

JAFANZ

  • Bay Watcher
    • View Profile
Re: Setting df to use more cpu?
« Reply #10 on: July 11, 2014, 12:59:37 pm »

If you really only have 3 cores, I suspect there's something wrong with your computer as computers are usually designed around multiples of 2 (it's a binary thing).

Not true. AMD Triple cores work perfectly fine, AMD and Intel have hex cores, and Intel's Xeons are actually built around 5 and 10 cores right now.
Well you (ideally) learn something every day, so thank you.

Apologies for the misinformation provided.
Logged

Cobbler89

  • Bay Watcher
  • Cobbler cancels celebrate Caesar: mending soles
    • View Profile
Re: Setting df to use more cpu?
« Reply #11 on: July 11, 2014, 05:12:52 pm »

Discussion of cores aside, the OP sounded like the question was about *priority* (devoting more cpu time to DF as opposed to other things, nevermind which cores anything's on). That can generally also be set from Task Manager, in the Processes tab. You may also want to sort the processes by cpu use and see whether any one other application besides DF is hogging it; you could either close that application if you're not actually using it, or lower it's priority on top of raising DF's.
Logged
Quote from: Mr S
You've struck embedded links. Praise the data miners!
Quote from: Strong Bad
The magma is seeping under the door.

Quote from: offspring
Quote from: Cobbler89
I have an idea. Let's play a game where you win by being as quiet as possible.
I get it, it's one of those games where losing is fun!
I spend most of your dimension's time outside of your dimension. I can't guarantee followup or followthrough on any comments, ideas, or plans.

Kamamura

  • Bay Watcher
    • View Profile
Re: Setting df to use more cpu?
« Reply #12 on: July 12, 2014, 01:08:41 pm »

Don't set process affinities manually, the OS can do it just as well/better.
Logged
The entire content consists of senseless murder, a pile of faceless naked women and zero regard for human life in general, all in the service of the protagonist's base impulses. It is clearly a cry for help from a neglected, self absorbed and disempowered juvenile badly in need of affectionate guidance. What a sad, sad display.