Author: bart Date: 2008-03-11 20:06:04 +0000 (Tue, 11 Mar 2008) New Revision: 7640
Log: Depending on the fourth command line argument, a racy or non-racy run is started. Modified: trunk/exp-drd/tests/matinv_openmp.c Modified: trunk/exp-drd/tests/matinv_openmp.c =================================================================== --- trunk/exp-drd/tests/matinv_openmp.c 2008-03-11 19:46:45 UTC (rev 7639) +++ trunk/exp-drd/tests/matinv_openmp.c 2008-03-11 20:06:04 UTC (rev 7640) @@ -26,6 +26,13 @@ typedef double elem_t; +/********************/ +/* Local variables. */ +/********************/ + +static int s_trigger_race; + + /*************************/ /* Function definitions. */ /*************************/ @@ -186,18 +193,37 @@ } // Reduce all rows j != i. -#pragma omp parallel for private(j, k) - for (j = 0; j < rows; j++) + + if (s_trigger_race) { - if (i != j) +# pragma omp parallel for + for (j = 0; j < rows; j++) { - const elem_t factor = a[j * cols + i]; - for (k = 0; k < cols; k++) + if (i != j) { - a[j * cols + k] -= a[i * cols + k] * factor; + const elem_t factor = a[j * cols + i]; + for (k = 0; k < cols; k++) + { + a[j * cols + k] -= a[i * cols + k] * factor; + } } } } + else + { +# pragma omp parallel for private(j, k) + for (j = 0; j < rows; j++) + { + if (i != j) + { + const elem_t factor = a[j * cols + i]; + for (k = 0; k < cols; k++) + { + a[j * cols + k] -= a[i * cols + k] * factor; + } + } + } + } } } @@ -258,9 +284,10 @@ double error; double ratio; - matrix_size = (argc > 1) ? atoi(argv[1]) : 3; - nthread = (argc > 2) ? atoi(argv[2]) : 3; - silent = (argc > 3) ? atoi(argv[3]) : 0; + matrix_size = (argc > 1) ? atoi(argv[1]) : 3; + nthread = (argc > 2) ? atoi(argv[2]) : 3; + silent = (argc > 3) ? atoi(argv[3]) : 0; + s_trigger_race = (argc > 4) ? atoi(argv[4]) : 0; omp_set_num_threads(nthread); omp_set_dynamic(0); ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Valgrind-developers mailing list Valgrind-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-developers