Skip to content

Commit

Permalink
mpirun can mangle tagged output lines, so use heuristics to unmangle
Browse files Browse the repository at this point in the history
them.
  • Loading branch information
hategan committed Feb 28, 2025
1 parent 06120fc commit 0a62a3c
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/psij/launchers/scripts/mpi_launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,22 @@ fi
pre_launch

filter_out() {
sed -nE 's/^\[[^]]+\]<stdout>:(.*)/\1/p'
}

filter_err() {
sed -nE 's/^\[[^]]+\]<stderr>:(.*)/\1/p'
# must start with [n,n]<stdout>:
# may contain one or more [n,n]<stdout>: lodged into the line
sed -nE 's/^\[[^]]+\]<std[oe][ur][tr]>:(.*)/\1/p' | sed -E 's/\[[^]]+\]<std[oe][ur][tr]>://g'
}

filter_out_5() {
sed -nE 's/^\[[^]]+\]<stdout>: (.*)/\1/p'
}

filter_err_5() {
sed -nE 's/^\[[^]]+\]<stderr>: (.*)/\1/p'
sed -nE 's/^\[[^]]+\]<std[oe][ur][tr]>: (.*)/\1/p'
}

set +e
if [ "$IS_OPENMPI_5" == "1" ]; then
mpirun --oversubscribe --output TAG -n $_PSI_J_PROCESS_COUNT "$@" \
1> >(filter_out_5 > $_PSI_J_STDOUT) 2> >(filter_err_5 > $_PSI_J_STDERR) <$_PSI_J_STDIN
1> >(filter_out_5 > $_PSI_J_STDOUT) 2> >(filter_out_5 > $_PSI_J_STDERR) <$_PSI_J_STDIN
elif [ "$IS_OPENMPI" == "1" ]; then
mpirun --oversubscribe --tag-output -q -n $_PSI_J_PROCESS_COUNT "$@" \
1> >(filter_out > "$_PSI_J_STDOUT") 2> >(filter_err > $_PSI_J_STDERR) <$_PSI_J_STDIN
1> >(filter_out > "$_PSI_J_STDOUT") 2> >(filter_out > $_PSI_J_STDERR) <$_PSI_J_STDIN
else
mpirun -n $_PSI_J_PROCESS_COUNT "$@" 1>$_PSI_J_STDOUT 2>$_PSI_J_STDERR <$_PSI_J_STDIN
fi
Expand Down

0 comments on commit 0a62a3c

Please sign in to comment.