Changes between Version 10 and Version 11 of Orio/TuneSpecs


Ignore:
Timestamp:
06/13/08 09:04:28 (15 years ago)
Author:
hartono
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Orio/TuneSpecs

    v10 v11  
    9696One prerequisite of a user-provided initialization program is that the input variables’ initializations must be enclosed inside a function named `init_input_vars`; otherwise, Orio will report an error message. 
    9797 
    98 == Overriding the Performance Testing Code == 
     98== Extending the Performance Testing Code == 
    9999 
    100 ''Under construction'' 
     100First, let us look at the basic C skeleton code used by Orio to measure the performance of the optimized code. 
    101101 
     102{{{ 
     103#include <stdio.h>  
     104#include <stdlib.h>  
     105#include <sys/time.h>  
     106 
     107/*@ global @*/  
     108 
     109double rtclock()  
     110{  
     111  struct timezone tzp;  
     112  struct timeval tp;  
     113  int stat;  
     114  gettimeofday(&tp, &tzp);  
     115  return (tp.tv_sec + tp.tv_usec*1.0e-6);  
     116}  
     117 
     118int main()  
     119{  
     120  /*@ prologue @*/  
     121 
     122  double orio_t_start=0, orio_t_end=0, orio_t_total=0;  
     123  int orio_i;  
     124 
     125  for (orio_i=0; orio_i<REPS; orio_i++)  
     126  {  
     127    orio_t_start = rtclock();  
     128      
     129    /*@ tested code @*/  
     130 
     131    orio_t_end = rtclock();  
     132    orio_t_total += orio_t_end - orio_t_start;  
     133  }  
     134    
     135  orio_t_total = orio_t_total / REPS;  
     136  printf("%f\n", orio_t_total);  
     137    
     138  /*@ epilogue @*/  
     139 
     140  return 0;  
     141} 
     142}}} 
     143 
     144Four important tags exist in the skeleton code, each with its own special purpose. The '`/*@ global @*/`' tag is used by the driver to place global declarations such as input variable declarations and the initialization function of the input arrays. The ‘`/*@ prologue @*/`’ tag is the spot where to dynamically allocate memory space for input arrays and to call the function that initializes all input variables. The ‘`/*@ tested code @*/`’ tag designates the location of the code tested for its performance. And the last tag ‘`/*@ epilogue @*/`’ remains unused until now, but it is kept for potential development in the future. 
     145 
     146From the skeleton code, it can also be observed that Orio simply uses elapsed time as its performance metric through the standard C’s `gettimeofday` function. As a part of our future plans, we intend to employ a performance counter tool, such as TAO and PAPI, to facilitate a finer grained performance measurement (e.g. the number of processor clock cycles). 
     147