2

I am running simulations in parallel using mpich2. I've got rather stringent security on my workstation, and must register using a new password each time I run a simulation. I have to enter:

mpiexec -register

which then prompt me for a username, and then prompt me for a password. Unfortunately, there seem to be no way to pass the user/pass to mpiexec on a single line, e.g.

mpiexec -register user:pass

does not work.

I'm trying to prepare a batch file that can automatically pass the username and password to the mpiexec prompts, but I cannot seem to get it to work. I've tried various things like timeout /t 5 but that doesn't work.

Can anyone tell me how to pass these inputs to the mpiexec program prompts in a batch file?

Thanks!

EDIT: I think I am getting closer. I've tried

(
echo username 
echo password 
echo password 
) | mpiexec -register

which appears to be passing the username and password inputs to the mpiexec prompts. Program is still hanging at the next step however - not sure if that's a problem with the way I'm passing these or not.

Thomas
  • 2,484
  • 8
  • 30
  • 49
  • Try this `((echo user)& (echo pass)) | mpiexec -register`. But this will only work when mpiexec reads from stdin – jeb May 10 '17 at 14:45
  • Hey jeb, thanks! I'm not sure what stdin is. I will give this a try but is it different from the EDIT that I entered above? Thanks! – Thomas May 10 '17 at 14:48

1 Answers1

2

You could redirect or pipe into mpiexec.
With redirection it's gets a bit nasty for user/password entries, as there are often unwanted (and unvisible) spaces at the line ends.

(
echo user
echo pwd
) | more > fetch.txt

Creates in fetch.txt

user<space>
pwd<space>

When you want to suppress the spaces use a file redirection instead

(
echo user
echo pwd
) > file.tmp
< file.tmp mpiexec -register

In both cases (redirection or pipe), you need to serve all inputs for the program, not only username and password.
You can't enter inputs from keyboard anymore.

jeb
  • 78,592
  • 17
  • 171
  • 225