Skip to content

Commit 8a291d1

Browse files
committed
Some mpirun deployments will add spurious messages to the stream and
`-v` is not enough to suppress them, so use tagged output.
1 parent 937a7d7 commit 8a291d1

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/psij/launchers/scripts/mpi_launch.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,21 @@ fi
1515

1616
pre_launch
1717

18+
filter_out() {
19+
sed -nE 's/^\[[^]]+\]<stdout>:(.*)/\1/p'
20+
}
21+
22+
filter_err() {
23+
sed -nE 's/^\[[^]]+\]<stderr>:(.*)/\1/p'
24+
}
25+
1826
set +e
1927
if [ "$IS_OPENMPI_5" == "1" ]; then
20-
# there is no -q parameter in OMPI 5
21-
mpirun --oversubscribe -n $_PSI_J_PROCESS_COUNT "$@" 1>$_PSI_J_STDOUT 2>$_PSI_J_STDERR <$_PSI_J_STDIN
28+
mpirun --oversubscribe --output TAG -n $_PSI_J_PROCESS_COUNT "$@" \
29+
1> >(filter_out > $_PSI_J_STDOUT) 2> >(filter_err > $_PSI_J_STDERR) <$_PSI_J_STDIN
2230
elif [ "$IS_OPENMPI" == "1" ]; then
23-
mpirun --oversubscribe -q -n $_PSI_J_PROCESS_COUNT "$@" 1>$_PSI_J_STDOUT 2>$_PSI_J_STDERR <$_PSI_J_STDIN
31+
mpirun --oversubscribe --tag-output -q -n $_PSI_J_PROCESS_COUNT "$@" \
32+
1> >(filter_out > "$_PSI_J_STDOUT") 2> >(filter_err > $_PSI_J_STDERR) <$_PSI_J_STDIN
2433
else
2534
mpirun -n $_PSI_J_PROCESS_COUNT "$@" 1>$_PSI_J_STDOUT 2>$_PSI_J_STDERR <$_PSI_J_STDIN
2635
fi

0 commit comments

Comments
 (0)