From: Erik A. H. <er...@he...> - 2002-01-08 23:49:29
|
On Mon, Jan 07, 2002 at 05:13:06PM -0500, henken wrote: > I am playing around with some of the bproc C functions, and I have noticed > that most of them do not work on the nodes if the program is started > locally on the node instead of through bpsh. here is the sample program: > #include <stdio.h> > #include <sys/bproc.h> > > int main() { > printf("currnode: %d\n", bproc_currnode()): > } > > when invoked via bpsh: > # bpsh <node> test > the out put is as expected, that the right node number is printed. > However, when I ssh to the node and run it: > # ssh node<node> > # ./test > > I always get -1 as the output. Is this the correct behavior? If so, how > would I get the information I am looking for with out using bpsh? This is the correct behavior. The issue here is the process space that test ends up in. The master is the machine that answers current node requests. For the bpsh case, test's request is answered by the master you started it from and you'll get whatever node number that it's on. If you ssh to the node, test is just another (not remotely managed) process on that node. test will be running in the slave's own process space in that case. In that sense it's running on the front end (node -1) of the process space that machine controls. There's no way for local processes on a slave node to make requests of a master they're not being managed by. Keep in mind that a slave can run many slave daemons so it wouldn't even be clear who to ask if you could ask a master you weren't being managed by. I hope that made some sense. - Erik |