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



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
timing your functions bebop1111116 High Level Programming 3 11-01-2006 04:19 PM
Kshell scripts and timing dbridle AIX 3 10-10-2006 12:26 PM
Timing out a SSH rcunn87 Shell Programming and Scripting 9 07-31-2006 05:11 PM
scp timing out jph UNIX for Advanced & Expert Users 1 06-09-2005 10:59 PM
timing a loop in unix. wolkott Shell Programming and Scripting 1 02-04-2003 02:52 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-22-2008
Tavo Tavo is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 4
Help with __builtin_prefetch function and it's timing

Hello there, I just needed to know how to get the timing right when using the gcc __builtin_prefetch() function, that is, how many instructions before the actual utilization of the data should I make the prefetch call.
I will be measuring the L1 cache hit rate with valgrind's cachegrind, simulating a 1KB L1 Data cache.

Just in case you ask yourself what's the point in doing what I'm doing, I tell you it's a university project.
  #2 (permalink)  
Old 11-24-2008
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,861
AFAIK, it depends on your processor and the 'data' you are processing. Have you looked at prefetch test cases in the GCC testsuite (.../testsuite/gcc.misc-tests/i386- prefetch.exp)?
  #3 (permalink)  
Old 11-24-2008
Tavo Tavo is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 4
The consists in two dimensional arrays that are much bigger than L1D cache. And our professors expect us to "guess" the prefetch distance by introducing timers in the program. But I have yet to see an example of that.
  #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.
Sponsored Links
Closed Thread

Bookmarks

Tags
cachegrind, prefetch

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 07:55 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0