diff options
author | Anton Khirnov <anton@khirnov.net> | 2018-12-28 12:51:14 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2018-12-28 12:51:14 +0100 |
commit | 133c5ff7ebce3bb4301a841bf9de9ba85fca23a2 (patch) | |
tree | 4afeee73a7d574fc44024e9044f552f38996e60f | |
parent | b47af8f35656a42f1e94510159c64629b9a75d30 (diff) |
Set the number of solver threads from OMP_NUM_THREADS.
-rw-r--r-- | src/maximal_slicing_axi_mg.c | 5 |
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 */ |