mirror of
https://github.com/Steffo99/unimore-hpc-assignments.git
synced 2024-11-23 00:24:23 +00:00
Use THREAD_COUNT
instead of a fixed amount of threads
This commit is contained in:
parent
cc23d73254
commit
c104caa1a6
2 changed files with 4 additions and 2 deletions
|
@ -13,6 +13,8 @@ CFLAGS+= -Wextra
|
||||||
CFLAGS+= -O3
|
CFLAGS+= -O3
|
||||||
# -g3 enables some useful debug things
|
# -g3 enables some useful debug things
|
||||||
CFLAGS+= -g3
|
CFLAGS+= -g3
|
||||||
|
# -DTHREAD_COUNT allows us to alter the number of threads used in the whole file
|
||||||
|
CFLAGS+= -DTHREAD_COUNT=4
|
||||||
|
|
||||||
# Disable make output
|
# Disable make output
|
||||||
MAKEFLAGS+= --silent
|
MAKEFLAGS+= --silent
|
||||||
|
|
|
@ -25,7 +25,7 @@ static void init_array(int nx, int ny,
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
/// Initialize the `x` array with PI and its multiples.
|
/// 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++) {
|
for (i = 0; i < ny; i++) {
|
||||||
x[i] = i * M_PI;
|
x[i] = i * M_PI;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ static void kernel_atax(int nx, int ny,
|
||||||
{
|
{
|
||||||
int i, j;
|
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++)
|
for (i = 0; i < _PB_NY; i++)
|
||||||
y[i] = 0;
|
y[i] = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue