diff options
-rw-r--r-- | src/brill.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/brill.c b/src/brill.c index 2bf40a1..bc56734 100644 --- a/src/brill.c +++ b/src/brill.c @@ -9,8 +9,6 @@ #include <brill_data.h> -#include <lapacke.h> - #include "cctk.h" #include "cctk_Arguments.h" #include "cctk_Parameters.h" @@ -40,6 +38,7 @@ void brill_data(CCTK_ARGUMENTS) /* on the first run, solve the equation for ψ */ if (!prev_bd) { + const char *omp_threads = getenv("OMP_NUM_THREADS"); bd = bd_context_alloc(); if (!bd) @@ -53,6 +52,11 @@ void brill_data(CCTK_ARGUMENTS) bd->basis_scale_factor[0] = scale_factor; bd->basis_scale_factor[1] = scale_factor; + if (omp_threads) + bd->nb_threads = strtol(omp_threads, NULL, 0); + if (bd->nb_threads <= 0) + bd->nb_threads = 1; + ret = bd_solve(bd); if (ret < 0) CCTK_WARN(0, "Error solving the Brill wave initial data equation\n"); @@ -87,7 +91,6 @@ void brill_data(CCTK_ARGUMENTS) psi_val = malloc(sizeof(*psi_val) * grid_size); q_val = malloc(sizeof(*q_val) * grid_size); -#pragma omp parallel for for (int j = 0; j < cctkGH->cctk_lsh[1]; j++) { double *r_y = r_val + j * cctkGH->cctk_lsh[0]; double *psi_y = psi_val + j * cctkGH->cctk_lsh[0] * cctkGH->cctk_lsh[2]; |