@@ -2607,8 +2607,8 @@ GMT_LOCAL int gmtinit_parse_U_option (struct GMT_CTRL *GMT, char *item) {
2607
2607
}
2608
2608
2609
2609
/*! -x[[-]<ncores>] */
2610
+ GMT_LOCAL int gmtinit_parse_x_option (struct GMT_CTRL *GMT, char *arg) { /* Only effective if MP is enabled */
2610
2611
#ifdef GMT_MP_ENABLED
2611
- GMT_LOCAL int gmtinit_parse_x_option (struct GMT_CTRL *GMT, char *arg) {
2612
2612
GMT->common.x.active = true;
2613
2613
if (!arg) return (GMT_PARSE_ERROR); /* -x requires a non-NULL argument */
2614
2614
if (arg[0] == '\0') /* Use all processors */
@@ -2622,9 +2622,9 @@ GMT_LOCAL int gmtinit_parse_x_option (struct GMT_CTRL *GMT, char *arg) {
2622
2622
GMT->common.x.n_threads = MAX(gmtlib_get_num_processors() - abs (GMT->common.x.n_threads), 1); /* Max-n but at least one */
2623
2623
if (GMT->current.setting.max_cores) /* Limit to max core defaults setting */
2624
2624
GMT->common.x.n_threads = GMT->current.setting.max_cores;
2625
+ #endif
2625
2626
return (GMT_NOERROR);
2626
2627
}
2627
- #endif
2628
2628
2629
2629
/*! . */
2630
2630
GMT_LOCAL int gmtinit_parse_colon_option (struct GMT_CTRL *GMT, char *item) {
@@ -8124,9 +8124,9 @@ void gmtlib_explain_options (struct GMT_CTRL *GMT, char *options) {
8124
8124
8125
8125
#if defined(GMT_MP_ENABLED)
8126
8126
case 'y': /* Number of threads (reassigned from -x in GMT_Option) */
8127
- if (strlen (GMT_x_OPT) > 1) { /* Only print this if it is in fact available */
8127
+ if (strlen(GMT_x_OPT) > 1 || strlen(GMT_xg_OPT ) > 1) { /* Only print this if it is in fact available */
8128
8128
cores = gmtlib_get_num_processors();
8129
- GMT_Usage (API, 1, "\n%s", GMT_x_OPT);
8129
+ (strlen(GMT_x_OPT) > 1) ? GMT_Usage (API, 1, "\n%s", GMT_x_OPT) : GMT_Usage(API, 1, "\n%s", GMT_xg_OPT );
8130
8130
GMT_Usage (API, -2, "Limit the number of cores used in multi-threaded algorithms [Default uses all %d cores]. "
8131
8131
"If <n> is negative then we select (%d - <n>) cores (or at least 1).", cores, cores);
8132
8132
}
@@ -9151,9 +9151,12 @@ int gmt_default_error (struct GMT_CTRL *GMT, char option) {
9151
9151
case 's': error += GMT->common.s.active == false; break;
9152
9152
case 't': error += GMT->common.t.active == false; break;
9153
9153
case 'w': error += GMT->common.w.active == false; break;
9154
- #if defined(GMT_MP_ENABLED)
9155
- case 'x': error += GMT->common.x.active == false; break;
9154
+ case 'x': error += GMT->common.x.active == false;
9155
+ #if !defined(GMT_MP_ENABLED)
9156
+ error --;
9157
+ GMT_Report (GMT->parent, GMT_MSG_INFORMATION, "Option -x: GMT is not compiled with parallel support. Only one core is used\n");
9156
9158
#endif
9159
+ break;
9157
9160
case ':': error += GMT->common.colon.active == false; break;
9158
9161
9159
9162
default:
@@ -18792,12 +18795,13 @@ int gmt_parse_common_options (struct GMT_CTRL *GMT, char *list, char option, cha
18792
18795
error += gmt_M_more_than_once (GMT, GMT->common.w.active) || gmtinit_parse_w_option (GMT, item);
18793
18796
break;
18794
18797
18795
- #ifdef GMT_MP_ENABLED
18796
18798
case 'x':
18797
18799
error += (gmt_M_more_than_once (GMT, GMT->common.x.active) || gmtinit_parse_x_option (GMT, item));
18798
18800
GMT->common.x.active = true;
18799
- break;
18801
+ #if !defined(GMT_MP_ENABLED)
18802
+ GMT_Report (GMT->parent, GMT_MSG_WARNING, "Option -x: GMT is not compiled with parallel support. Only one core is used\n");
18800
18803
#endif
18804
+ break;
18801
18805
18802
18806
case ':':
18803
18807
error += (gmt_M_more_than_once (GMT, GMT->common.colon.active) || gmtinit_parse_colon_option (GMT, item));
0 commit comments