Solomon
01-17-2008, 04:12 PM
Folks,
I have a code that in one section deals out the coordinates of a set of points to each PE. This is typically 6 points. THE PEs then work out the distance (squared) from this point to a reference point. Points which are beyond a certain distance are rejected leaving a subset of typically 2-5 per PE.
I want to return this back to mono such that the resulting list is packed - i.e. points that were beyond eth cutoff are removed and the holes closed up.
Does anyone have a good algorithm to suggest for this ?
One Idea I had was this:
1. First take the number of valid points per PE: npts.
2. Swazzle this along all PEs and sum such that each PE knows teh cummulative sum of all the PEs to the left (As a mathamatician I know that this can be done is less that 96 steps - it can be done with all only 7 additions seperated by 1,2,4,8,16,.. swazzles
3. each PE uses this number as the target location in the mono results array
4. You then PIO the coords back.- maybe as the full (6) points per PE when the the right hand entries are zeros.
For this to work it relies on the writes back to mono being sequential: first PE0 and lastly PE95 otherwise the 'dummy' points returned would clobber valid points from the next highest numbered PE.
Is this a safe assumption ?
p.s.. the PIO docs also refer to some hardware functionality where there is automatic packing when PEs are disabled - not sure if this is useful or relevant here?
I have a code that in one section deals out the coordinates of a set of points to each PE. This is typically 6 points. THE PEs then work out the distance (squared) from this point to a reference point. Points which are beyond a certain distance are rejected leaving a subset of typically 2-5 per PE.
I want to return this back to mono such that the resulting list is packed - i.e. points that were beyond eth cutoff are removed and the holes closed up.
Does anyone have a good algorithm to suggest for this ?
One Idea I had was this:
1. First take the number of valid points per PE: npts.
2. Swazzle this along all PEs and sum such that each PE knows teh cummulative sum of all the PEs to the left (As a mathamatician I know that this can be done is less that 96 steps - it can be done with all only 7 additions seperated by 1,2,4,8,16,.. swazzles
3. each PE uses this number as the target location in the mono results array
4. You then PIO the coords back.- maybe as the full (6) points per PE when the the right hand entries are zeros.
For this to work it relies on the writes back to mono being sequential: first PE0 and lastly PE95 otherwise the 'dummy' points returned would clobber valid points from the next highest numbered PE.
Is this a safe assumption ?
p.s.. the PIO docs also refer to some hardware functionality where there is automatic packing when PEs are disabled - not sure if this is useful or relevant here?