Access attribute of object owned by other host

General issues of interest both for network and
individual cell parallelization.

Moderator: hines

Post Reply
neuromau
Posts: 97
Joined: Mon Apr 20, 2009 7:02 pm

Access attribute of object owned by other host

Post by neuromau »

Hello,

How can one host access an attribute of an object that exists on another host?

Specifically, I rewrote some code that refers to the position of the cells in my network. Previously, the cell objects weren't actually 'assigned' positions; the positions were just tracked in a vector where the vector indices corresponded to the cell gids. Now I added x, y, and z positions to the cell templates and tracked the positions in the new x, y, and z attributes. However, it seems that those x, y, and z attributes are only available to the host machine that owns the cell. Should I revert to using the vector that can be accessed by all hosts or is there a way to make the position data accessible to all hosts?

Thanks,
Marianne

Code: Select all

begintemplate GranuleCell
   //...
   public x, y, z, position
   //...
   proc position(){x=$1  y=$2  z=$3}
endtemplate GranuleCell

//each object's x, y, and z are set in some other code

//Now I want to access the data and this is the only way I know how:
if (pc.gid_exists(i)) {	      // Of course the program will fail if I try to refer to a cell on a different host
	cell = pc.gid2cell(i)  //get the cell reference from the gid
	pre_xpos = cell.x    // access the x position of the cell
}
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Access attribute of object owned by other host

Post by ted »

Interprocessor communication can be costly, but so can maintaining multiple copies of data. Are the xyz coords empirical data or can they be generated algorithmically by any host that wants them and knows the gid of the cell?
neuromau
Posts: 97
Joined: Mon Apr 20, 2009 7:02 pm

Re: Access attribute of object owned by other host

Post by neuromau »

ted wrote:Are the xyz coords empirical data or can they be generated algorithmically by any host that wants them and knows the gid of the cell?
.

The latter - algorithmically. Each host made its own copy of the position vector and just looked up any cell's position as necessary. Right now I'm working with a 516-cell model, x position only. But in the near future, I'll scale this up to 1 million+ cells. Later, I'll add the y and z coordinates.

Also, once I scale up this model, I was considering taking the algorithm outside of NEURON and just loading in the results from a file generated by MatLab. I haven't tested to see if that would be faster for a larger network yet, though, and there's still the question of whether to store the data with the cell or have each host keep its own copy of the data.

************* ADDED:
Looking at your question again, I'm not sure it's right for me to say the latter one since the 'algorithm' is to look up the position from a vector. The algorithm used to populate the vector requires other data, like the number of cells of that type and the number of available positions (bins), so that it can distribute the cells of each type evenly along the x coordinate. So if the host didn't have access to the vector and needed to calculate the position, it would need the # of cells of that type, the number and size of the bins, and the ordinal # of that cell relative to the other cells of that type (ex: this is mossy cell 3 of 7 total mossy cells), but the gid could be used for that (gid = 103, out of gids 101 to 107). Hope this makes sense.
hines
Site Admin
Posts: 1687
Joined: Wed May 18, 2005 3:32 pm

Re: Access attribute of object owned by other host

Post by hines »

Algorithmic, including randomness, that uses a small amount of data scales best and allows setup time to scale with the number of cells per processor.
For large amounts of global data, reading files is one strategy and exchanging data is another. The latter is supported with the few wrappers to the
MPI collectives mentioned in the index for
http://www.neuron.yale.edu/neuron/stati ... n.html#MPI
For very large networks you can use a sequence of alltoall each of which handles a set of gid data that fits into memory on each processor.
I would first go to great lengths however to try to be algorithmic.
Post Reply