From dee56d41503d258017ee2cab51c07522136178ae Mon Sep 17 00:00:00 2001 From: someone Date: Mon, 16 Jan 2012 21:20:56 +0100 Subject: [PATCH] hillis is broken :( --- openmp/prefix/hillis.c | 20 ++++++++++++++++++-- openmp/prefix/prefix.c | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/openmp/prefix/hillis.c b/openmp/prefix/hillis.c index 0ddeda3..a9ba133 100644 --- a/openmp/prefix/hillis.c +++ b/openmp/prefix/hillis.c @@ -3,7 +3,23 @@ */ #include "hillis.h" -void algorithm (numtype in[], unsigned long size, unsigned int ops[]) { - printf ("hillis. TODO\n"); +void algorithm (numtype x[], unsigned long size, unsigned int ops[]) { + numtype tmp[size]; + unsigned long k; + unsigned long i; + printf ("hillis.\n"); + for(k=1; k < size; k <<=1){ +printf ("hier.%li\n", k); + for(i = k; i < size; i++){ +printf (" da.%li\n",i); + x[i] = x[i-k] + x[i]; + } + //barrier; + } + + /* Copy out array to in */ +// for (i = 0; i < size; i++){ +// x[i] = tmp[i+1]; +// } } diff --git a/openmp/prefix/prefix.c b/openmp/prefix/prefix.c index 4318d2b..076e8f3 100644 --- a/openmp/prefix/prefix.c +++ b/openmp/prefix/prefix.c @@ -3,7 +3,7 @@ #include "prefix.h" /* TODO: Replace with file read. */ -#define NUMBERS 5 +#define NUMBERS 16 int main (int argc, char* argv[]) { numtype numarray[NUMBERS]; -- 2.43.0