diff --git a/OpenMP/linear-algebra/kernels/atax/Makefile b/OpenMP/linear-algebra/kernels/atax/Makefile index 96c7b77..b499897 100644 --- a/OpenMP/linear-algebra/kernels/atax/Makefile +++ b/OpenMP/linear-algebra/kernels/atax/Makefile @@ -13,6 +13,8 @@ CFLAGS+= -Wextra CFLAGS+= -O3 # -g3 enables some useful debug things CFLAGS+= -g3 +# -DTHREAD_COUNT allows us to alter the number of threads used in the whole file +CFLAGS+= -DTHREAD_COUNT=4 # Disable make output MAKEFLAGS+= --silent diff --git a/OpenMP/linear-algebra/kernels/atax/atax.c b/OpenMP/linear-algebra/kernels/atax/atax.c index 84fde91..787db79 100644 --- a/OpenMP/linear-algebra/kernels/atax/atax.c +++ b/OpenMP/linear-algebra/kernels/atax/atax.c @@ -25,7 +25,7 @@ static void init_array(int nx, int ny, int i, j; /// Initialize the `x` array with PI and its multiples. - #pragma omp parallel for num_threads(4) schedule(static) + #pragma omp parallel for num_threads(THREAD_COUNT) schedule(static) for (i = 0; i < ny; i++) { x[i] = i * M_PI; } @@ -64,7 +64,7 @@ static void kernel_atax(int nx, int ny, { int i, j; - #pragma omp parallel for num_threads(4) schedule(static) + #pragma omp parallel for num_threads(THREAD_COUNT) schedule(static) for (i = 0; i < _PB_NY; i++) y[i] = 0;