The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 11-25-2008
spirtle spirtle is offline
Registered User
  
 

Join Date: Jun 2008
Location: Scotland
Posts: 150
The prefetch instruction should be issued at a time before the data is used at least as large as the L1 cache latency. You should be able to find out what that latency is for the machine you are using. I imagine that your code will have some sort of loop over the array, so you take into account the time taken per loop iteration (without cache latency), the amount of data read per iteration and the size of the L1 data cache. These figures should give you an idea of the memory bandwidth you need to sustain and hence how often you need to prefetch and how far ahead each prefetch should touch the data. This gives you somewhere to start, but your professors are correct; guessing and timing is the only way to be sure.