diff options
author | Matt Turner <mattst88@gmail.com> | 2009-02-14 21:16:30 +0000 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2009-02-14 21:16:30 +0000 |
commit | 4f4a74e76d0b7dfea9904cbb43a8905cf80768c6 (patch) | |
tree | d021dcf3dde6b76c13467725dedfaa22585febee | |
parent | 3623dac70811c8a8622233ca15a09ebbad331342 (diff) |
More Cleanups, found using icc
git-svn-id: svn://mattst88.com/svn/cleanbench/trunk@92 0d43b9a7-5ab2-4d7b-af9d-f64450cef757
-rw-r--r-- | cleanbench.c | 15 | ||||
-rw-r--r-- | cleanbench.h | 17 | ||||
-rw-r--r-- | emfloat.c | 2 | ||||
-rw-r--r-- | hardware.c | 4 | ||||
-rw-r--r-- | huffman.c | 6 | ||||
-rw-r--r-- | linear.c | 8 | ||||
-rw-r--r-- | neural.c | 39 | ||||
-rw-r--r-- | randnum.c | 2 |
8 files changed, 30 insertions, 63 deletions
diff --git a/cleanbench.c b/cleanbench.c index 703e787..0b97ad0 100644 --- a/cleanbench.c +++ b/cleanbench.c @@ -10,19 +10,6 @@ #include "cleanbench.h" #include "randnum.h" -double DoNumSort(void); -double DoStringSort(void); -double DoBitops(void); -double DoEmFloat(void); -double DoFourier(void); -double DoAssign(void); -double DoIDEA(void); -double DoHuffman(void); -double DoNNET(void); -double DoLU(void); - -void hardware(void); - static bool bench_with_confidence(int benchmark, double* average, double* std_dev, int* runs); static bool calc_confidence(double scores[], int runs, double* c_half_interval, double* average, double* std_dev); @@ -100,7 +87,7 @@ main() double average; /* Average of benchmark results */ double std_dev; /* Standard deviation of benchmark results */ int runs; /* # of runs */ - int benchmark = 0; + int benchmark = FOURIER; puts( "TEST : Iterations/sec. : Old Index : New Index\n" " : : Pentium 90 : AMD K6/233\n" diff --git a/cleanbench.h b/cleanbench.h index 7bf2833..13b0db2 100644 --- a/cleanbench.h +++ b/cleanbench.h @@ -1,2 +1,19 @@ #define MINIMUM_TICKS 60 #define MINIMUM_SECONDS 5 /* Minimum number of seconds to run each test */ + +double DoNumSort(void); +double DoStringSort(void); +double DoBitops(void); +double DoEmFloat(void); +double DoFourier(void); +double DoAssign(void); +double DoIDEA(void); +double DoHuffman(void); +double DoNNET(void); +double DoLU(void); + +void hardware(void); + +int randnum(int val); +int randwc(int num); +int abs_randwc(int num); @@ -180,7 +180,7 @@ uint32_t accum; /* Accumulator */ accum=(uint32_t)b; accum-=(uint32_t)c; accum-=(uint32_t)*borrow; -*borrow=(uint32_t)((accum & 0x00010000) ? 1 : 0); /* New borrow */ +*borrow=(accum & 0x00010000) ? 1 : 0; /* New borrow */ *a=(uint16_t)(accum & 0xFFFF); return; } @@ -4,6 +4,8 @@ #include <proccpuinfo.h> +#include "cleanbench.h" + #define BUF_SIZ 1024 /****************** @@ -69,7 +71,7 @@ static void readProcCpuInfo (char *model, char *cache) { break; } snprintf(model, BUF_SIZ, format, info->hardware_platform, info->architecture, info->frequency); - snprintf(cache, BUF_SIZ, "%d KB", info->cache); + snprintf(cache, BUF_SIZ, "%u KB", info->cache); proccpuinfo_free(info); } @@ -42,7 +42,6 @@ typedef struct { } huff_node; static huff_node *hufftree; /* The huffman tree */ -static long plaintextlen; /* Length of plaintext */ static void create_text_line(char *dt,long nchars); static void create_text_block(char *tb, unsigned long tblen, @@ -103,7 +102,6 @@ DoHuffman(void) randnum((int32_t)13); create_text_block(plaintext,ARRAY_SIZE-1,(unsigned short)500); plaintext[ARRAY_SIZE-1L]='\0'; - plaintextlen=ARRAY_SIZE; /* ** See if we need to perform self adjustment loop. @@ -282,7 +280,7 @@ for(j=0;j<ARRAY_SIZE;j++) hufftree[(int)plaintext[j]].freq+=(float)1.0; for(i=0;i<256;i++) - if(hufftree[i].freq != (float)0.0) + if(hufftree[i].freq != 0.0) hufftree[i].freq/=(float)ARRAY_SIZE; /* Reset the second half of the tree. Otherwise the loop below that @@ -299,7 +297,7 @@ memset(&(hufftree[256]), 0, sizeof(huff_node) * 256); ** pointers and left/right pointers. Also, discard all ** nodes that have a frequency of true 0. */ for(i=0;i<512;i++) -{ if(hufftree[i].freq==(float)0.0) +{ if(hufftree[i].freq == 0.0) hufftree[i].parent=EXCLUDED; else { hufftree[i].right = -1; @@ -321,7 +321,7 @@ for(i=0;i<n;i++) if((double)fabs(a[i][j]) > big) big=fabs(a[i][j]); /* Bail out on singular matrix */ - if(big==(double)0.0) return(0); + if(big == 0.0) return 0; LUtempvv[i]=1.0/big; } @@ -337,7 +337,7 @@ for(j=0;j<n;j++) sum-=(a[i][k]*a[k][j]); a[i][j]=sum; } - big=(double)0.0; + big = 0.0; for(i=j;i<n;i++) { sum=a[i][j]; if(j!=0) @@ -368,7 +368,7 @@ for(j=0;j<n;j++) ** is concerned.) We'll take the original author's ** recommendation and replace 0.0 with "tiny". */ - if(a[j][j]==(double)0.0) + if(a[j][j] == 0.0) a[j][j]=tiny; if(j!=(n-1)) @@ -427,7 +427,7 @@ for(i=0;i<n;i++) ** If a nonzero element is encountered, we have ** to do the sums in the loop above. */ - if(sum!=(double)0.0) + if(sum != 0.0) ii=i; b[i]=sum; } @@ -84,7 +84,6 @@ int learned; /* flag--if true, network has learned all patterns */ static clock_t DoNNetIteration(unsigned long nloops); static void do_mid_forward(int patt); static void do_out_forward(); -void display_output(int patt); static void do_forward_pass(int patt); static void do_out_error(int patt); static void worst_pass_error(); @@ -265,53 +264,15 @@ for (neurode=0; neurode<OUT_SIZE; neurode++) } } -/************************* -** display_output(patt) ** -************************** -** Display the actual output vs. the desired output of the -** network. -** Once the training is complete, and the "learned" flag set -** to true, then display_output sends its output to both -** the screen and to a text output file. -** -** NOTE: This routine has been disabled in the benchmark -** version. -- RG -**/ -/* -void display_output(int patt) -{ -int i; - - fprintf(outfile,"\n Iteration # %d",iteration_count); - fprintf(outfile,"\n Desired Output: "); - - for (i=0; i<OUT_SIZE; i++) - { - fprintf(outfile,"%6.3f ",out_pats[patt][i]); - } - fprintf(outfile,"\n Actual Output: "); - - for (i=0; i<OUT_SIZE; i++) - { - fprintf(outfile,"%6.3f ",out_out[i]); - } - fprintf(outfile,"\n"); - return; -} -*/ - /********************** ** do_forward_pass() ** *********************** ** control function for the forward pass through the network -** NOTE: I have disabled the call to display_output() in -** the benchmark version -- RG. **/ static void do_forward_pass(int patt) { do_mid_forward(patt); /* process forward pass, middle layer */ do_out_forward(); /* process forward pass, output layer */ -/* display_output(patt); ** display results of forward pass */ } /*********************** @@ -1,5 +1,7 @@ #include <stdlib.h> +#include "cleanbench.h" + /**************************** ** RANDOM NUMBER GENERATOR ** ***************************** |