From 78d642fe6ccb5c8bde379f399f6abf6b26d71c9e Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 24 Oct 2010 14:35:37 -0400 Subject: [PATCH] Document DEBUG usage and ordered-data generation in src/sorting/README and Makefile. --- src/sorting/Makefile | 5 ++++- src/sorting/README | 18 ++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/sorting/Makefile b/src/sorting/Makefile index c85a83c..4d84d0f 100644 --- a/src/sorting/Makefile +++ b/src/sorting/Makefile @@ -2,7 +2,7 @@ RM = /bin/rm DATA_SIZE = 8191 # the 5th Mersenne prime -DATA = data +DATA = data ordered-data # Non-MPI Environment @@ -24,6 +24,9 @@ clean: data : data.py ./$< $(DATA_SIZE) > $@ +ordered-data : data.py + ./$< --ordered $(DATA_SIZE) > $@ + $(EXECS:%=%.o) main.o : %.o : %.c sort.h $(CC) -c $(CFLAGS) -o $@ $< diff --git a/src/sorting/README b/src/sorting/README index 4f619ff..e000dae 100644 --- a/src/sorting/README +++ b/src/sorting/README @@ -22,7 +22,14 @@ Just run $ make -which also builds a random data file 'data'. +which also builds a random data file 'data'. To build with the DEBUG +macro defined (to enable some stderr printouts in main.c), run + + $ make CFLAGS=-DDEBUG + +Remove auto-generated files with + + $ make clean Usage ----- @@ -38,4 +45,11 @@ Timing 8191 data points on my 571 MHz netbook with $ time ./bubble data > /dev/null $ time ./quicksort data > /dev/null -quicksort takes 0.075 s and bubble takes 3.994s. +quicksort takes 0.075 s and bubble takes 3.994 s. + +On ordered data bubble does much better + + $ time ./bubble ordered-data > /dev/null + $ time ./quicksort ordered-data > /dev/null + +quicksort takes 0.048 s and bubble takes 0.046 s. -- 2.26.2