Skip to content

Commit e7c3397

Browse files
committed
Do not use multi-threads with -Ff (custom filter). It's broken.
1 parent 94ce412 commit e7c3397

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/grdfilter.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,15 @@ static int parse (struct GMT_CTRL *GMT, struct GRDFILTER_CTRL *Ctrl, struct GMT_
895895

896896
#ifdef HAVE_GLIB_GTHREAD
897897
/* Make the default equal to the OMP case where we use all threads if not stated otherwise. */
898-
if (!GMT->common.x.active) GMT->common.x.n_threads = gmtlib_get_num_processors();
898+
if (Ctrl->F.custom && GMT->common.x.n_threads > 1) {
899+
GMT->common.x.n_threads = 1;
900+
GMT->common.x.active = false;
901+
GMT_Report (GMT->parent, GMT_MSG_WARNING, "Sorry, custom filtering does not support multiple threads. Reset to 1.\n" );
902+
}
903+
if (!GMT->common.x.active) {
904+
GMT->common.x.n_threads = gmtlib_get_num_processors();
905+
GMT_Report (GMT->parent, GMT_MSG_INFORMATION, "Enable all available threads (up to %d)\n", gmtlib_get_num_processors());
906+
}
899907
#endif
900908

901909
n_errors += gmt_M_check_condition (GMT, !Ctrl->G.active, "Option -G: Must specify output file\n");

0 commit comments

Comments
 (0)