From 412f907df6db6a7fa57e9655c10c93eb0e3a1a05 Mon Sep 17 00:00:00 2001 From: David Kaufmann Date: Fri, 4 Nov 2011 23:50:43 +0100 Subject: [PATCH] cleanup generate script --- openmp/merge/Makefile | 4 ++-- openmp/merge/generate_random.sh | 14 +++++++++++++- openmp/merge/numlist1.h | 1 - openmp/merge/numlist2.h | 1 - openmp/merge/sort.c | 5 +---- 5 files changed, 16 insertions(+), 9 deletions(-) delete mode 100644 openmp/merge/numlist1.h delete mode 100644 openmp/merge/numlist2.h diff --git a/openmp/merge/Makefile b/openmp/merge/Makefile index 33d790e..0f10ac0 100644 --- a/openmp/merge/Makefile +++ b/openmp/merge/Makefile @@ -9,7 +9,7 @@ OBJECTS = $(BINARIES).o all: sort -sort: sort.o numlist1.o numlist2.o +sort: sort.o numlist.o $(CC) -o $@ $? $(LDFLAGS) %.o: %.c @@ -17,4 +17,4 @@ sort: sort.o numlist1.o numlist2.o .PHONY: clean clean: - rm -rf $(OBJECTS) $(BINARIES) numlist1.o numlist1.o + rm -rf $(OBJECTS) $(BINARIES) numlist.o diff --git a/openmp/merge/generate_random.sh b/openmp/merge/generate_random.sh index c63b115..deb5126 100755 --- a/openmp/merge/generate_random.sh +++ b/openmp/merge/generate_random.sh @@ -8,7 +8,7 @@ function pwait() { } # 10 ^ x values -X=6 +X=7 NULLEN="" PUNKTE="." for i in $(seq `expr $X - 1`); @@ -41,12 +41,24 @@ sed '/^$/d' unsorted1a >> unsorted1 sed '/^$/d' unsorted1b >> unsorted1 sed '/^$/d' unsorted2a >> unsorted2 sed '/^$/d' unsorted2b >> unsorted2 +rm -f unsorted1a unsorted1b unsorted2a unsorted2b echo "formatting numlist" echo $(date) cat unsorted1 | sort -n | sed -e ':a;N;$!ba;s/\n/,/g' -e 's/^/,/' -e 's/,[0]*/,/g' -e 's/^,/\tint a[] = {/' -e 's/{,/{0,/' -e 's/$/,-1};/' >numlist1.c & cat unsorted2 | sort -n | sed -e ':a;N;$!ba;s/\n/,/g' -e 's/^/,/' -e 's/,[0]*/,/g' -e 's/^,/\tint b[] = {/' -e 's/{,/{0,/' -e 's/$/,-1};/' >numlist2.c & pwait +rm -f unsorted1 unsorted2 + +rm -f numlist.h +echo "#define LISTSIZE ${VALUES}" >> numlist.h +echo "extern int a[" `expr ${VALUES} + 1` "];" >> numlist.h +echo "extern int b[" `expr ${VALUES} + 1` "];" >> numlist.h + +rm -f numlist.c +cat numlist1.c >> numlist.c +cat numlist2.c >> numlist.c +rm -f numlist1.c numlist2.c echo "Done." echo $(date) diff --git a/openmp/merge/numlist1.h b/openmp/merge/numlist1.h deleted file mode 100644 index 4b47834..0000000 --- a/openmp/merge/numlist1.h +++ /dev/null @@ -1 +0,0 @@ -extern int a[10000001]; diff --git a/openmp/merge/numlist2.h b/openmp/merge/numlist2.h deleted file mode 100644 index 5098b8d..0000000 --- a/openmp/merge/numlist2.h +++ /dev/null @@ -1 +0,0 @@ -extern int b[10000001]; diff --git a/openmp/merge/sort.c b/openmp/merge/sort.c index dcf16b3..2edb8ef 100644 --- a/openmp/merge/sort.c +++ b/openmp/merge/sort.c @@ -3,10 +3,7 @@ #include #include #include -#include "numlist1.h" -#include "numlist2.h" - -#define LISTSIZE 100000 +#include "numlist.h" void printlist(char * message, int * ptr) { printf (message); -- 2.43.0