Commits

Anonymous committed 6b3efb7

changed benchmarks to x-fold speedup (from % change) in some cases.
added -lm to usort compilation
fixed naming glitch in usort directory.

  • Participants
  • Parent commits 3b6237a

Comments (0)

Files changed (16)

File hsort/t/cmp-small.sh

 echo "IDENT:     all values of the array are \"1\""
 
 echo "\nRANDOM"
-echo "N               mysort (secs)   GLIBC (secs)    %impr"
+echo "N               mysort (secs)   GLIBC (secs)    x-fold speedup"
 c=1
 while [ $c -lt $sz ] ; do
     ./${APP} ${i[$c]} RAND ${t[$c]}  

File hsort/t/cmp.sh

 echo "IDENT:     all values of the array are \"1\""
 
 echo "\nRANDOM"
-echo "N               mysort (secs)   GLIBC (secs)    %impr"
+echo "N               mysort (secs)   GLIBC (secs)    x-fold speedup"
 c=1
 while [ $c -lt $sz ] ; do
     ./${APP} ${i[$c]} RAND ${t[$c]}  

File hsort/t/hsort-cmp.c

         
     
     fprintf(stdout,"%10ld\t%5.10f\t%5.10f\t%2.2f\n",n,m_tot,g_tot,
-            100*((g_tot/m_tot) - 1));
+            (g_tot/m_tot));
     free (array1);
     return 0; 
 }

File isort/t/isort-cmp.c

     
     }
     m_tot /= (double) (num_trials - 1);
-    
         
-    
     fprintf(stdout,"%10ld\t%5.10f\t%5.10f\t%2.2f\n",n,m_tot,g_tot,
-            100*((g_tot/m_tot) - 1));
+            (g_tot/m_tot));
     free (array1);
     return 0; 
 }

File usort/defs.mk

 #O=-fmudflap -lmudflap
 O=-O5
 G=-g
+L=-lm
 LD_LIBRARY_PATH=/usr/lib:/lib:
 CC=/usr/bin/colorgcc -std=c99 -fgnu89-inline
 OBJS=$(patsubst %.c,%.o,$(wildcard *.c))

File usort/f4_sort.c

 #if __BYTE_ORDER == __LITTLE_ENDIAN
 #  include <stdlib.h>
 #  define CSORT_TY float
-#  define CS_(name) f4_q##name
-#  include "../qsort/csort.c"
+#  define CS_(name) f4_c##name
+#  include "../csort/csort.c"
 
 #  define _0(v) ( (v)         & 0x7FF)
 #  define _1(v) (((v)  >> 11) & 0x7FF)
     long n, sum0=0 , sum1=0 , sum2=0 , tsum=0;
     unsigned *reader, *writer, *buf1=(unsigned*)a, *buf2;
     unsigned long b0[F4_SORT_HIST_SIZE*3], *b1, *b2;
-    if (sz < 256) { f4_qsort(a,sz); return; } 
+    if (sz < 256) { f4_csort(a,sz); return; } 
     buf2 = (unsigned* ) malloc(sz * sizeof(unsigned));
     
     b1 = b0 + F4_SORT_HIST_SIZE;
 #else /* endian */
 #  define CS_(name) f4_## name 
 #  define CSORT_TY float
-#  include "../qsort/csort.c"
+#  include "../csort/csort.c"
 #endif

File usort/f8_sort.c

 #if __BYTE_ORDER == __LITTLE_ENDIAN
 #  include <stdlib.h>
 #  define CSORT_TY double
-#  define CS_(name) f8_q##name
-#  include "../qsort/csort.c"
+#  define CS_(name) f8_c##name
+#  include "../csort/csort.c"
 
 #define _0(v) ( (v)         & 0x7FF)
 #define _1(v) (((v)  >> 11) & 0x7FF)
     unsigned long long *reader, *writer, *buf1 = (unsigned long long*) a, *buf2;
     unsigned long *b0, *b1, *b2, *b3, *b4, *b5;
 
-    if (sz < 2048) { f8_qsort(a,sz); return; } 
+    if (sz < 2048) { f8_csort(a,sz); return; } 
     buf2  = (unsigned long long*) malloc(sz * sizeof(double));
     b0   = calloc(F8_SORT_HIST_SIZE * 6 , sizeof(unsigned long));
     b1   = b0 + F8_SORT_HIST_SIZE;    b2   = b1 + F8_SORT_HIST_SIZE;
 #else /* endian */
 # define CS_(name) f8_## name 
 # define CSORT_TY double
-# include "../qsort/csort.c"
+# include "../csort/csort.c"
 #endif

File usort/s2_sort.c

 #else /* endian */
 #define CS_(name) s2_## name 
 #define CSORT_TY short
-#include "../qsort/csort.c"
+#include "../csort/csort.c"
 #endif

File usort/s4_sort.c

 
 #include <stdlib.h>
 #define CSORT_TY int
-#define CS_(name) s4_q##name
-#include "../qsort/csort.c"
+#define CS_(name) s4_c##name
+#include "../csort/csort.c"
 
 #define _0(v) ((unsigned)(v)         & 0x7FF)
 #define _1(v) (((unsigned)(v) >> 11) & 0x7FF)
     long n, sum0=0 , sum1=0 , sum2=0 , tsum=0;
     int *reader, *writer, *buf = (int*) malloc(sz * sizeof(int));
     size_t *b0, *b1, *b2;
-    if (sz < 256) { s4_qsort(a,sz); return; }
+    if (sz < 256) { s4_csort(a,sz); return; }
     b0   = malloc(HIST_SIZE * 3 * sizeof(size_t));
     b1   = b0 + HIST_SIZE;
     b2   = b1 + HIST_SIZE;
 /* endian */
 #define CS_(name) s4_## name 
 #define CSORT_TY int
-#include "../qsort/csort.c"
+#include "../csort/csort.c"
 #endif

File usort/s8_sort.c

 #if __BYTE_ORDER == __LITTLE_ENDIAN
 #include <stdlib.h>
 
-#define CS_(name) s8_q##name
+#define CS_(name) s8_c##name
 #define CSORT_TY long long
-#include "../qsort/csort.c"
+#include "../csort/csort.c"
 
 #define _0(v) ((v)         & 0x7FF)
 #define _1(v) (((v) >> 11) & 0x7FF)
     unsigned long pos;
     long n, sum0=0,sum1=0,sum2=0,sum3=0,sum4=0,sum5=0,tsum=0;
     long long *reader, *writer, *buf = ( long long*) malloc(sz * sizeof( long long));
-    if (sz < 2048) return s8_qsort(a,sz);
+    if (sz < 2048) return s8_csort(a,sz);
     if (sz < 0) { fprintf(stderr,"s8_sort: sz of array < 0: %ld\n",sz); exit(1); }
     long *b0, *b1, *b2, *b3, *b4, *b5;
     b0   = ( long*) malloc(HIST_SIZE * 6 * sizeof(long));
 #else /* big endian */
 #define CS_(name) s8_## name 
 #define CSORT_TY long long
-#include "../qsort/csort.c"
+#include "../csort/csort.c"
 #endif 

File usort/t/Makefile

 	echo $(SRC)
 
 u1  : ctype-cmp.c  $(SRC)  
-	$(CC) $(G) $(W) $(I) $(O)  -o u1 u1.c 
+	$(CC) $(G) $(W) $(I) $(O) $(L)  -o u1 u1.c 
 
 s1  : ctype-cmp.c  $(SRC)  
-	$(CC) $(G) $(W) $(I) $(O)  -o s1 s1.c 
+	$(CC) $(G) $(W) $(I) $(O) $(L)  -o s1 s1.c 
 
 s2  : ctype-cmp.c  $(SRC)  
-	$(CC) $(G) $(W) $(I) $(O)  -o s2 s2.c 
+	$(CC) $(G) $(W) $(I) $(O) $(L)  -o s2 s2.c 
 
 u4  : ctype-cmp.c  $(SRC)  
-	$(CC) $(G) $(W) $(I) $(O) -o u4 u4.c 
+	$(CC) $(G) $(W) $(I) $(O) $(L) -o u4 u4.c 
 
 s4  : ctype-cmp.c  $(SRC)  
-	$(CC) $(G) $(W) $(I) $(O)  -o s4 s4.c 
+	$(CC) $(G) $(W) $(I) $(O) $(L)  -o s4 s4.c 
 
 u2  : ctype-cmp.c  $(SRC)  
-	$(CC) $(G) $(W) $(I) $(O) -o u2 u2.c 
+	$(CC) $(G) $(W) $(I) $(O) $(L) -o u2 u2.c 
 
 u8  : ctype-cmp.c  $(SRC)  
-	$(CC) $(G) $(W) $(I) $(O) -o u8 u8.c 
+	$(CC) $(G) $(W) $(I) $(O) $(L) -o u8 u8.c 
 
 s8  : ctype-cmp.c  $(SRC)  
-	$(CC) $(G) $(W) $(I) $(O) -o s8 s8.c 
+	$(CC) $(G) $(W) $(I) $(O) $(L) -o s8 s8.c 
 
 f4  : ctype-cmp.c $(SRC)
-	$(CC) $(G) $(W) $(I) $(O) -o f4  f4.c
+	$(CC) $(G) $(W) $(I) $(O) $(L) -o f4  f4.c
 
 f8  : ctype-cmp.c $(SRC)
-	$(CC) $(G) $(W) $(I) $(O) -o f8  f8.c
+	$(CC) $(G) $(W) $(I) $(O) $(L) -o f8  f8.c
 
 
 clean :

File usort/t/ctype-cmp.c

     
 
 long long k,j;
-const char* usage="qsort-cmp N dist trials\n"
+const char* usage="csort-cmp N dist trials\n"
 "dist is one of: RAND, BOUNDED , SORTED, REVSORTED, IDENT\n"
 "N:              size of the array.\n"
 "trials:         how many trials to do.  Necessary for small N.\n";

File usort/t/f4-cmp.c

-/* Test harness for qsort.c, useful for all C base types up to 64 bits.  
+/* Test harness for csort.c, useful for all C base types up to 64 bits.  
    Uses macros for polymorphism.
    To use, define macro TY (e.g. #define TY float) then #include this file. */
 
 enum generator {RAND,BOUNDED,SORTED, REVERSE ,IDENT} ;
 
 long long k,j;
-const char* usage="qsort-cmp N dist trials\n"
+const char* usage="csort-cmp N dist trials\n"
 "dist is one of: RAND, BOUNDED , SORTED, REVSORTED, IDENT\n"
 "N:              size of the array.\n"
 "trials:         how many trials to do.  Necessary for small N.\n";
         memcpy(array_g,array_orig,n*sizeof(TY));
         memcpy(array_m,array_orig,n*sizeof(TY));
         start = TIME();
-        qsort (array_g,n,sizeof(TY),&compare);
+        csort (array_g,n,sizeof(TY),&compare);
         end   = TIME();
         if (i) {
             g_tot += end-start;

File usort/u2_sort.c

 #else
 #define CS_(name) u2_## name 
 #define CSORT_TY unsigned short
-#include "../qsort/csort.c"
+#include "../csort/csort.c"
 #endif

File usort/u4_sort.c

 
 #include <stdlib.h>
 #define CSORT_TY unsigned
-#define CS_(name) u4_q##name
-#include "../qsort/csort.c"
+#define CS_(name) u4_c##name
+#include "../csort/csort.c"
 
 #define _0(v) (unsigned) ((v)         & 0x7FF)
 #define _1(v) (unsigned) (((v) >> 11) & 0x7FF)
 #else /* endian */
 #define CS_(name) u4_## name 
 #define CSORT_TY unsigned
-#include "../qsort/csort.c"
+#include "../csort/csort.c"
 #endif

File usort/u8_sort.c

 #include <stdlib.h>
 
 #define CSORT_TY unsigned long long 
-#define CS_(name) u8_q##name
-#include "../qsort/csort.c"
+#define CS_(name) u8_c##name
+#include "../csort/csort.c"
 
 #define _0(v) ((v)         & 0x7FF)
 #define _1(v) (((v) >> 11) & 0x7FF)
     unsigned long pos;
     unsigned long long n, sum0=0,sum1=0,sum2=0,sum3=0,sum4=0,sum5=0,tsum=0;
     unsigned long long *reader, *writer, *buf = (unsigned long long*) malloc(sz * sizeof(unsigned long long));
-    if (sz < 2048) return u8_qsort(a,sz);
+    if (sz < 2048) return u8_csort(a,sz);
     if (sz < 0) { fprintf(stderr,"u8_sort: sz of array < 0: %ld\n",sz); exit(1); }
     unsigned long long *b0, *b1, *b2, *b3, *b4, *b5;
     b0   = (unsigned long long*) malloc(HIST_SIZE * 6 * sizeof(unsigned long long));
 #else  /* endian */
 #define CS_(name) u8_## name 
 #define CSORT_TY unsigned long long
-#include "../qsort/csort.c"
+#include "../csort/csort.c"
 #endif