@@ -448,21 +448,23 @@ int main(int argc, char ** argv) {
448
448
}
449
449
450
450
error_t argp_error = argp_parse (& argp , argc , argv , argp_flags , & arg_index , & args );
451
- if (args .output == NULL ) {
452
- fprintf (stderr , "ERROR: No output file specified\n" );
453
- exit (-1 );
454
- }
455
- if (arg_index == argc ) {
456
- fprintf (stderr , "ERROR: No input files specified\n" );
457
- exit (-1 );
458
- }
459
- if (comm_size < 2 ) {
460
- fprintf (stderr , "ERROR: Please run with at least 2 MPI processes\n" );
461
- exit (-1 );
462
- }
463
- if (argp_error != 0 ) {
464
- log_message (LOG_ERROR , "ERROR parsing arguments" );
465
- MPI_Abort (MPI_COMM_WORLD , argp_error );
451
+ if (comm_rank == 0 ) {
452
+ if (args .output == NULL ) {
453
+ log_message (LOG_ERROR , "No output file specified" );
454
+ MPI_Abort (MPI_COMM_WORLD , -1 );
455
+ }
456
+ if (arg_index == argc ) {
457
+ log_message (LOG_ERROR , "No input files specified" );
458
+ MPI_Abort (MPI_COMM_WORLD , -1 );
459
+ }
460
+ if (comm_size < 2 ) {
461
+ log_message (LOG_ERROR , "Please run with at least 2 MPI processes" );
462
+ MPI_Abort (MPI_COMM_WORLD , -1 );
463
+ }
464
+ if (argp_error != 0 ) {
465
+ log_message (LOG_ERROR , "ERROR parsing arguments" );
466
+ MPI_Abort (MPI_COMM_WORLD , argp_error );
467
+ }
466
468
}
467
469
468
470
const char * in_path = argv [arg_index ];
@@ -476,7 +478,7 @@ int main(int argc, char ** argv) {
476
478
glob_flags |= GLOB_APPEND ;
477
479
}
478
480
479
- if (globs .gl_pathc < 1 ) {
481
+ if (globs .gl_pathc < 1 && comm_rank == 0 ) {
480
482
log_message (LOG_ERROR , "No matching input files found" );
481
483
MPI_Abort (MPI_COMM_WORLD , -1 );
482
484
}
0 commit comments