From f88338ffa10ea6495c35cde50ddfb5d75f2ce185 Mon Sep 17 00:00:00 2001 From: Jan Vales Date: Wed, 25 Jan 2012 06:26:35 +0100 Subject: [PATCH] fprintf und stderr for all debug output. just print result value/stats to stdout. --- openmp/prefix/datapar.c | 2 -- openmp/prefix/prefix.c | 11 +++++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/openmp/prefix/datapar.c b/openmp/prefix/datapar.c index 0f562ce..7852277 100644 --- a/openmp/prefix/datapar.c +++ b/openmp/prefix/datapar.c @@ -13,7 +13,6 @@ void algorithm (numtype x[], unsigned long size, unsigned int ops[]) { for(i = kk-1; i < size; i+= kk) { x[i] = x[i-k] + x[i]; } - #pragma omp barrier } for(k=kk>>1; k > 1; k = kk){ @@ -22,6 +21,5 @@ void algorithm (numtype x[], unsigned long size, unsigned int ops[]) { for(i = k-1; i < size-kk; i+= k){ x[i+kk] = x[i] + x[i+kk]; } - #pragma omp barrier } } diff --git a/openmp/prefix/prefix.c b/openmp/prefix/prefix.c index c0f0956..43e626e 100644 --- a/openmp/prefix/prefix.c +++ b/openmp/prefix/prefix.c @@ -20,11 +20,11 @@ void usage () { } void array_contents(numtype array[], unsigned long size) { - printf ("[%li", array[0]); + fprintf (stderr, "[%li", array[0]); for (unsigned long i = 1; i < size; i++) { - printf (", %li", array[i]); + fprintf (stderr, ", %li", array[i]); } - printf ("]\n"); + fprintf (stderr, "]\n"); } @@ -108,12 +108,11 @@ int main (int argc, char* argv[]) { array_contents(numarray, size); #endif - printf("init done starting algorithm. size: %li\n", size); + fprintf(stderr, "init done starting algorithm. size: %li\n", size); startTime = omp_get_wtime(); algorithm(numarray, size, NULL); endTime = omp_get_wtime(); - printf("DONE. took %f seconds.\n", endTime-startTime); - printf ("result: %li\n", numarray[size-1]); + fprintf(stdout, "binname=%s size=%li time=%f result=%li\n", binname, size, endTime-startTime, numarray[size-1]); #ifdef DEBUG /* might want to comment this out, if numarray is big */ -- 2.43.0