Skip to content

Commit

Permalink
raster: disable parallelization when MASK active (#3561)
Browse files Browse the repository at this point in the history
  • Loading branch information
petrasovaa committed Apr 9, 2024
1 parent a26a54f commit 8a3c6b7
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 8 deletions.
5 changes: 4 additions & 1 deletion raster/r.mfilter/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ int main(int argc, char **argv)
"threads setting."));
nprocs = 1;
#endif

if (nprocs > 1 && G_find_raster("MASK", G_mapset()) != NULL) {
G_warning(_("Parallel processing disabled due to active MASK."));
nprocs = 1;
}
out_name = opt2->answer;
filt_name = opt3->answer;

Expand Down
5 changes: 4 additions & 1 deletion raster/r.neighbors/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,10 @@ int main(int argc, char *argv[])
"threads setting."));
ncb.threads = 1;
#endif

if (ncb.threads > 1 && G_find_raster("MASK", G_mapset()) != NULL) {
G_warning(_("Parallel processing disabled due to active MASK."));
ncb.threads = 1;
}
if (strcmp(parm.weighting_function->answer, "none") && flag.circle->answer)
G_fatal_error(_("-%c and %s= are mutually exclusive"), flag.circle->key,
parm.weighting_function->answer);
Expand Down
5 changes: 4 additions & 1 deletion raster/r.resamp.filter/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,10 @@ int main(int argc, char *argv[])
"threads setting."));
nprocs = 1;
#endif

if (nprocs > 1 && G_find_raster("MASK", G_mapset()) != NULL) {
G_warning(_("Parallel processing disabled due to active MASK."));
nprocs = 1;
}
if (parm.radius->answer) {
if (parm.x_radius->answer || parm.y_radius->answer)
G_fatal_error(_("%s= and %s=/%s= are mutually exclusive"),
Expand Down
5 changes: 4 additions & 1 deletion raster/r.resamp.interp/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ int main(int argc, char *argv[])
"threads setting."));
threads = 1;
#endif

if (threads > 1 && G_find_raster("MASK", G_mapset()) != NULL) {
G_warning(_("Parallel processing disabled due to active MASK."));
threads = 1;
}
bufrows = atoi(memory->answer) * (((1 << 20) / sizeof(DCELL)) / dst_w.cols);
/* set the output buffer rows to be at most covering the entire map */
if (bufrows > dst_w.rows) {
Expand Down
5 changes: 4 additions & 1 deletion raster/r.series/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,10 @@ int main(int argc, char *argv[])
"threads setting."));
nprocs = 1;
#endif

if (nprocs > 1 && G_find_raster("MASK", G_mapset()) != NULL) {
G_warning(_("Parallel processing disabled due to active MASK."));
nprocs = 1;
}
lo = -INFINITY;
hi = INFINITY;
if (parm.range->answer) {
Expand Down
4 changes: 4 additions & 0 deletions raster/r.sim/r.sim.sediment/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,10 @@ int main(int argc, char *argv[])
#else
threads = 1;
#endif
if (threads > 1 && G_find_raster("MASK", G_mapset()) != NULL) {
G_warning(_("Parallel processing disabled due to active MASK."));
threads = 1;
}
G_message(_("Number of threads: %d"), threads);

/* sscanf(parm.nwalk->answer, "%d", &wp.maxwa); */
Expand Down
4 changes: 4 additions & 0 deletions raster/r.sim/r.sim.water/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,10 @@ int main(int argc, char *argv[])
#else
threads = 1;
#endif
if (threads > 1 && G_find_raster("MASK", G_mapset()) != NULL) {
G_warning(_("Parallel processing disabled due to active MASK."));
threads = 1;
}
G_message(_("Number of threads: %d"), threads);

/* if no rain map input, then: */
Expand Down
5 changes: 4 additions & 1 deletion raster/r.slope.aspect/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,10 @@ int main(int argc, char *argv[])
"threads setting."));
nprocs = 1;
#endif

if (nprocs > 1 && G_find_raster("MASK", G_mapset()) != NULL) {
G_warning(_("Parallel processing disabled due to active MASK."));
nprocs = 1;
}
radians_to_degrees = 180.0 / M_PI;
degrees_to_radians = M_PI / 180.0;

Expand Down
4 changes: 4 additions & 0 deletions raster/r.sun/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,10 @@ int main(int argc, char *argv[])
#else
threads = 1;
#endif
if (threads > 1 && G_find_raster("MASK", G_mapset()) != NULL) {
G_warning(_("Parallel processing disabled due to active MASK."));
threads = 1;
}
G_message(_("Number of threads <%d>"), threads);

if (civiltime != NULL) {
Expand Down
5 changes: 4 additions & 1 deletion raster/r.univar/r.univar_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ int main(int argc, char *argv[])
"threads setting."));
nprocs = 1;
#endif

if (nprocs > 1 && G_find_raster("MASK", G_mapset()) != NULL) {
G_warning(_("Parallel processing disabled due to active MASK."));
nprocs = 1;
}
/* table field separator */
zone_info.sep = G_option_to_separator(param.separator);

Expand Down
5 changes: 4 additions & 1 deletion vector/v.surf.rst/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,10 @@ int main(int argc, char *argv[])
G_warning(_("GRASS GIS is not compiled with OpenMP support, parallel "
"computation is disabled."));
#endif

if (threads > 1 && G_find_raster("MASK", G_mapset()) != NULL) {
G_warning(_("Parallel processing disabled due to active MASK."));
threads = 1;
}
if (devi) {
create_devi = true;
if (Vect_legal_filename(devi) == -1)
Expand Down

0 comments on commit 8a3c6b7

Please sign in to comment.