As far as I am aware, the prefetch hardware is designed to guess that
you are going to want to access sequential locations and will start
prefetching on that basis.

If you aren't accessing sequential locations you need to use some kind
of sorting algorithm, i.e. write the locations you want to hit in a
set of sequential lists, one for each large chunk of memory in your
total array. Then sort the bins, then write out in order. That's the
only trick I am aware of. Anything further is going to depend on the
problem itself.

Bill.

On 16 May, 23:08, Michael <mrubi...@uwaterloo.ca> wrote:
> I have a very naive question. I am playing around with binary
> quadratic forms and have a large array of values. I loop through a,b,c
> and, for each triple, compute some quantity that depends on a,b,c.
> Then, in the inner most c loop, I wish to increment value[d], where
> d=4ac-b^2, by that quantity.
>
> I am finding that the step
>
>        value[d]+= quantity;
>
> is taking way too long, presumably because, as c increments by 1,
> d=4ac-b^2, increments by a large amount, 4a, so the way that the array
> is read into the cache in chunks of consecutive array entries, is
> useless here.
>
> Is there a way in c or c++ to control what parts of an array get read
> into cache. For example can
> I ***efficiently*** read/manipulate equally spaced entries (spaced
> apart by 4a) of my value array into cache rather than the default
> consecutive entries.
>
> Any tips would be greatly appreciated.
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to