matthusby / ga-bitbot

Automatically exported from code.google.com/p/ga-bitbot
GNU General Public License v3.0
0 stars 0 forks source link

Limiting the gts.py priority and processor core preference #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello =)

    Since most of us use ga-bitbot on multi-purpose machines, it would be very nice to be able to limit individual proceses to certain cores on your processor [one clone of your project on google code was made for exactly the same purpose, but seems abandoned =] and set their priority. Since different OSes have different ways and utilities for accomplishing the same purpose, it would be great if a config file [maybe global_config.json =] had two additional keys for 'process prefix' which would when be used by gal.py as a prefix before launching monitored and unmonitored processes. Anyone could then just edit that value at one place, according to his/her needs and OS, and hopefully preserve it through git updates =]

Grateful in advance!

Original issue reported on code.google.com by purge...@gmail.com on 24 Feb 2012 at 3:27

GoogleCodeExporter commented 9 years ago
It seems that there's no built-in cross platform way to set cpu affinity within 
python.

There are a couple of options currently implemented:

1) Increase the "load_throttle_sleep_interval" in global_config.json. If you do 
this make sure to increase "cycle_time and min_cycle_time" to ensure a decent 
population size. This will decrease the cpu load across all cores... which 
isn't too helpful if you're trying to reserve a couple of cores for other tasks.

2) gal.py can be manually edited down to only two clients - 'gts.py all y' & 
'gts.py all n'. However, in this configuration the BOBs and high scoring genes 
will not be used to generate new populations. Instead they will only be 
retested to update the scores. With this method users can manually set the cpu 
affinity in task manager to limit processing to certain cpu cores. 

To improve the second option I'll need to add another command line option 
'score_only' to gts.py and change the behavior of 'gts.py all y' to generate 
and test new populations.

Original comment by brian.mo...@gmail.com on 25 Feb 2012 at 2:39

GoogleCodeExporter commented 9 years ago
Thank you for the clarification. If it helps anyone, my knowledge of 
accomplishing the limiting using the tools that come with various OSes is as 
follows:

Under the *nix OSes, I tend to use two 'prefixes':
- the 'nice' utility which sets the process priority during the process startup
- the 'taskset' utility which restricts the process to only one [selected] core
...so I would run it as:
taskset -p 01 nice -19 pypy gal.py
...It seems the process priority when set to the parent process [gal.py] also 
propagets to it's children [for example, gts.py instances]

For windows machines it seems that process priority can be set during the 
startup by prefixing the command with:
start /low /b

Original comment by purge...@gmail.com on 25 Feb 2012 at 7:07

GoogleCodeExporter commented 9 years ago
Another option is to use VMware player with a linux image. VMware player allows 
you to set a hard limit on the number of cpu cores to use.

Original comment by brian.mo...@gmail.com on 29 Feb 2012 at 1:34

GoogleCodeExporter commented 9 years ago
Going any further into this topic the solutions become very OS specific. 
Users can modify the gal.py script to add any required command line switches to 
meet their needs. 

Original comment by brian.mo...@gmail.com on 6 Mar 2013 at 2:03