summaryrefslogtreecommitdiff
path: root/src/maximal_slicing_axi_mg.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/maximal_slicing_axi_mg.c')
-rw-r--r--src/maximal_slicing_axi_mg.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/maximal_slicing_axi_mg.c b/src/maximal_slicing_axi_mg.c
index a94452e..0fe9a54 100644
--- a/src/maximal_slicing_axi_mg.c
+++ b/src/maximal_slicing_axi_mg.c
@@ -158,6 +158,7 @@ static void log_callback(const MG2DContext *ctx, int level,
static CoordPatch *get_coord_patch(MSMGContext *ms, int level)
{
+ const char *omp_threads = getenv("OMP_NUM_THREADS");
cGH *gh = ms->gh;
const size_t grid_size = gh->cctk_lsh[2] * gh->cctk_lsh[1] * gh->cctk_lsh[0];
@@ -242,6 +243,10 @@ static CoordPatch *get_coord_patch(MSMGContext *ms, int level)
cp->solver->opaque = ms;
cp->solver->log_callback = log_callback;
+ if (omp_threads)
+ cp->solver->nb_threads = strtol(omp_threads, NULL, 0);
+ if (cp->solver->nb_threads <= 0)
+ cp->solver->nb_threads = 1;
/* initialize boundary values to zero,
* non-zero values on the outer boundaries of refined levels are filled in elsewhere */