Page 1 of 1
MPI on Raspberry Pi - problem with logging into devices
Posted: Wed Nov 11, 2015 9:25 pm
by Graymalk
Hi,
This isn't exactly Raspberry Pi specific but I was hoping people here might know what to do since running MPI on Raspberry Pis is starting to get popular.
I am trying to learn MPI and I have a pair of Raspberry Pis that I thought I would use for this. I also have a Mac that I would like to use as node 0. There's no major reason why the Mac has to be node 0. It just might as well be. Anyway, I've mostly been following the steps listed on OpenMPI's site. I just struggled with getting my devices to all log into one another via SSH without asking for a password. I followed these instructions (with lots of other googling):
https://www.open-mpi.org/faq/?category=rsh#rsh-not-ssh
So I can successfully SSH from any device to any device, now, without it demanding a password.
However, the moment I try to
mpirun -nolocal -H <my devices> <sample program>
it demands passwords. Why? What have I still got left to do? Is it defaulting to trying to use rsh or something? I thought it was supposed to use ssh by default. And note that if I try giving it passwords, no known password works - it just keeps telling me I'm wrong and then asks for a password again.
(before anyone asks, I'm using -nolocal to force it to actually run on my nodes so I don't get fooled)
I get this password stuff no matter which device I run it from.
Re: MPI on Raspberry Pi - problem with logging into devices
Posted: Wed Nov 11, 2015 10:03 pm
by Graymalk
Actually, I'm wrong. I can't SSH from the Pi's to the Mac without triggering a password request. Could this be the issue?
They all have each other's public keys so I'm really confused.
Re: MPI on Raspberry Pi - problem with logging into devices
Posted: Wed Nov 11, 2015 10:19 pm
by Graymalk
OK, I'm just super confused. Here is what is happening currently:
I can get it to log in via SSH without password prompt from any device to any device, but only after I've done the following on the Pis:
exec ssh-agent bash
ssh-add $HOME/.ssh/<name of private key>
If I do that, then the next time I SSH into the other device, I'm prompted for the passphrase for the encryption key, but only once. After that, I can log back in as many times as I want. BUT, the moment I reboot, I have to do this all over again.
I do not seem to have to do this when going from the Mac to the Pis, though. But from Pi to anything else, yes, I have to do this.
Regardless, once I get manual SSH login working, it seems to have no effect on mpirun, which will still trigger a password prompt no matter what, and no matter which device I launch it from.
Re: MPI on Raspberry Pi - problem with logging into devices
Posted: Wed Nov 11, 2015 11:07 pm
by topguy
Disclaimer: I dont even know what MPI is..
but...
SSHD is really picky about the access-rights for the files inside "~/.ssh", AND the directory itself. "group" and "other" should not have any access.
Looking for some info in "/var/log/sshd.log" maybe or running ssh client with "-v" or "-vv" option might also give more information.
Re: MPI on Raspberry Pi - problem with logging into devices
Posted: Wed Nov 11, 2015 11:33 pm
by fruitoftheloom
Re: MPI on Raspberry Pi - problem with logging into devices
Posted: Thu Nov 12, 2015 5:34 am
by Graymalk
I think the problem is essentially one of scope, as in each time I set everything up on one Pi, whenever I exit out of that session, it's lost (the files stay, of course - I'm talking about the changes ssh-agent and ssh-add make). I've noticed my Mac will also prompt for a password after a reboot. I just tried it. If I said earlier that it didn't, I was misremembering (I've forgotten, now, if I posted that

). But the difference with my Mac is I can store the passphrase in the keychain and never be bugged about it again. I need to know how to accomplish something similar with the Pis. Surely there is a way to do this otherwise all those MPI clusters I keep hearing about that are running on Raspberry Pis would be impossible. I doubt everyone is lying about getting this to work. I'm surely doing something wrong, or just not doing something I should be doing but that isn't listed in the various tutorials for some reason.
Re: MPI on Raspberry Pi - problem with logging into devices
Posted: Thu Nov 12, 2015 5:39 am
by Graymalk
The key requirement with MPI is that it *must* be able to SSH into all nodes without it being prompted for a password. The moment it gets prompted, it's dead. Setting up SSH properly is key. I've already got MPI running on each node as a singular process - just can't get it to successfully open communication with the other nodes.
And I thought storing my passphrase in my keychain on the Mac would at least get the Mac to be able to act as node 0 and enslave the Pis. Nope. Still prompted for password.
And I'm not using passphrase and password interchangeably. Passphrase is for the public key. Password is when it thinks there is no public key and is trying to log into the specified account. (except supplying the correct password for the account in question still fails but that might be because MPI fails when this happens so I can't trust any behaviour that happens once the password prompt comes up)
Re: MPI on Raspberry Pi - problem with logging into devices
Posted: Thu Nov 12, 2015 6:23 am
by Graymalk
Provided I run these two lines each and every time I log in:
exec ssh-agent bash
ssh-add $HOME/.ssh/<private key file>
And then run MPI after that, it works, provably. I prove it to myself thusly:
mpirun -nooversubscribe -n 2 -H <the two raspberry pi addresses here> <program linked below>
Sample program:
https://github.com/wesleykendall/mpitut ... lo_world.c
Outputs:
Hello world from processor raspberrypione, rank 1 out of 2 processors
Hello world from processor raspberrypitwo, rank 0 out of 2 processors
Oddly enough, I can't get this to work with the Mac. It only works with the two Pis, and it only works if I follow the exact steps each time. Well, this will be enough for me to learn MPI I suppose. Obviously, it would be a whole bunch better to just let it run threaded on my Mac, but where's the fun in that? And I wouldn't want to lock up my Mac with race conditions (there *shouldn't* be race conditions with MPI but I would expect it to happen anyway running on a single CPU). Besides, I plan to acquire more Pis for this over time.

I definitely need to learn how to automate this password thing. I wish I could just fix it.
Re: MPI on Raspberry Pi - problem with logging into devices
Posted: Thu Nov 12, 2015 6:26 am
by Graymalk
Re: MPI on Raspberry Pi - problem with logging into devices
Posted: Fri Apr 08, 2016 12:15 am
by MichelTrahan