Author: Robert Hyatt
Date: 07:24:56 11/13/03
Go up one level in this thread
On November 13, 2003 at 03:58:43, Russell Reagan wrote: >On November 12, 2003 at 18:09:31, Robert Hyatt wrote: > >>Then that thread malloc's its stuff so that it >>is on that memory, even though it can be shared with others. > >Assuming NUMA, is it possible or likely that one thread will allocate its >memory, and that memory will be located in one of the other CPU's local memory? >Or does the OS make sure this doesn't happen except as a last resort? For windows, it appears to do it correctly. IE if you do a malloc() the O/S looks to see which processor you are running on and it allocates the memory in the local memory of that processor. Of course you had better set processor affinity to keep you on that processor or the entire idea fails. For linux, I don't know yet. I have yet to look at the NUMA-specific changes, but this is obviously an issue. Even better would be for the processor affinity stuff to be done automatically, so that once you run on a specific CPU and malloc() stuff, you continue to run there until hell freezes over. :) > >Are there any issues with reallocation on the fly on a NUMA machine? For >instance, C++'s std::vector will reallocate more space as it grows. Could that >pose any potential problems that wouldn't exist on a single cpu system? I'm not >talking about extreme cases such as an std::vector growing beyond the capacity >of one CPU's local memory. I'm just curious if there are any issues with >(re)allocation on the fly with NUMA, since memory seems to be the delicate >subject matter. In theory that ought to work fine, since malloc()'s are directed to local memory when possible. Of course, you can malloc() enough that you have to spill over into another processor's memory... The only problem might be a thread bouncing to another processor. The reallocation would hurt then as part of the thing would be on one processor, part on another, making efficient access impossible. If you do it right, and set the processor affinity to prevent this, all should work just as planned.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.