This is the handout directory for the CS:APP Cache Lab.
This is the handout directory for the CS:APP Cache Lab.
************************
Running the autograders:
@ -16,7 +16,7 @@ Check the correctness and performance of your transpose functions:
@@ -16,7 +16,7 @@ Check the correctness and performance of your transpose functions:
linux> ./test-trans -M 61 -N 67
Check everything at once (this is the program that your instructorruns):
@ -52,11 +52,11 @@ void eval_perf(unsigned int s, unsigned int E, unsigned int b)
@@ -52,11 +52,11 @@ void eval_perf(unsigned int s, unsigned int E, unsigned int b)
charbuf[1000],cmd[255];
charfilename[128];
registerFunctions();
registerFunctions();
/* Open the complete trace file */
FILE*full_trace_fp;
FILE*part_trace_fp;
FILE*full_trace_fp;
FILE*part_trace_fp;
/* Evaluate the performance of each registered transpose function */
@ -71,7 +71,7 @@ void eval_perf(unsigned int s, unsigned int E, unsigned int b)
@@ -71,7 +71,7 @@ void eval_perf(unsigned int s, unsigned int E, unsigned int b)
printf("Validation error at function %d! Run ./tracegen -M %d -N %d -F %d for details.\nSkipping performance evaluation for this function.\n",flag-1,M,N,i);
printf("Validation error at function %d! Run ./tracegen -M %d -N %d -F %d for details.\nSkipping performance evaluation for this function.\n",flag-1,M,N,i);
continue;
}
@ -97,7 +97,7 @@ void eval_perf(unsigned int s, unsigned int E, unsigned int b)
@@ -97,7 +97,7 @@ void eval_perf(unsigned int s, unsigned int E, unsigned int b)
sprintf(filename,"trace.f%d",i);
part_trace_fp=fopen(filename,"w");
assert(part_trace_fp);
/* Locate trace corresponding to the trans function */
flag=0;
while(fgets(buf,1000,full_trace_fp)!=NULL){
@ -106,7 +106,7 @@ void eval_perf(unsigned int s, unsigned int E, unsigned int b)
@@ -106,7 +106,7 @@ void eval_perf(unsigned int s, unsigned int E, unsigned int b)
if(buf[0]==''&&buf[2]==''&&
(buf[1]=='S'||buf[1]=='M'||buf[1]=='L')){
sscanf(buf+3,"%llx,%u",&addr,&len);
/* If start marker found, set flag */
if(addr==marker_start)
flag=1;
@ -137,10 +137,10 @@ void eval_perf(unsigned int s, unsigned int E, unsigned int b)
@@ -137,10 +137,10 @@ void eval_perf(unsigned int s, unsigned int E, unsigned int b)
/* Collect results from the reference simulator */
FILE*in_fp=fopen(".csim_results","r");
assert(in_fp);
@ -151,13 +151,13 @@ void eval_perf(unsigned int s, unsigned int E, unsigned int b)
@@ -151,13 +151,13 @@ void eval_perf(unsigned int s, unsigned int E, unsigned int b)