0

My question is a bit technical.

For specific reason, I need to call vim after mpiexec.

Example :

mpiexec -n 1 vim mytext.txt

But this gives the following warning message:

Vim: Warning: Output is not to a terminal 
Vim: Warning: Input is not from a terminal

And then, vim does not behave naturally, my input commands are not well interpreted in the editor, and things are not as if I had done simply:

vim mytext.txt

Any idea on how to redirect correctly input/output from/to my launching terminal in order to be able to use vim after mpiexec ?

Actually, the final goal is to debug in parallel using gdb on a specific proc and to edit functions with vim editor from gdb.

Example :

mpiexec -s 1 myprog : gdb myprog

So I am starting my program "myprog" on two processes, using gdb on the second one (which is proc 1), and redirecting stdin to proc 1 (thanks to -s 1 [see mpiexec -help]).

But then, if I want to edit a function with vim editor in gdb, I will face the same problems :

Vim: Warning: Output is not to a terminal
Vim: Warning: Input is not from a terminal

A quick solution would be to start an xterm window, but I want to avoid that approach:

mpiexec myprog : xterm -e gdb myprog

Thanks for your help.

Here is my Linux distribution:

NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

1 Answer 1

0

mpiexec starts up the argument process through ssh, so indeed, input and output are no longer connected with a terminal. What you want is this trick:

mpiexec -n 4 xterm -e gdb yourprogram
7
  • Thank you, I was aware of this solution as I mentioned it in my post, but I really want to avoid the xterm trick if possible... I would like to have input/output reconnected with my launching terminal. Is it impossible ? Commented Feb 11, 2022 at 16:57
  • I can do it in python with the paramiko module which gives you a handle to the ssh tunnel. I have no idea how to do this with simple shell commands. I think the ssh tunnel is somewhere internal to mpiexec, so you can't pipe to it. Commented Feb 11, 2022 at 17:03
  • Btw, why do you want to avoid the xterm approach? Commented Feb 11, 2022 at 17:03
  • Thanks, I want to avoid the xterm approach because the loading time for the xterm window is very slow in my environment, so any workaround is welcome :). Commented Feb 11, 2022 at 17:12
  • Longer than your debug session? I think if you would have debugged in an xterm you would have been done quicker than this dialog through SE. Commented Feb 11, 2022 at 17:15

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.