1
Fork 0
mirror of https://github.com/Steffo99/unimore-hpc-assignments.git synced 2024-11-22 16:14:24 +00:00

Use THREAD_COUNT instead of a fixed amount of threads

This commit is contained in:
Steffo 2022-11-16 17:50:41 +01:00
parent cc23d73254
commit c104caa1a6
Signed by: steffo
GPG key ID: 6965406171929D01
2 changed files with 4 additions and 2 deletions

View file

@ -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

View file

@ -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;