nhost returning 1 on non-mpi machine

General issues of interest both for network and
individual cell parallelization.

Moderator: hines

Post Reply
sl
Posts: 21
Joined: Wed Nov 28, 2007 12:52 am
Location: Cornell University

nhost returning 1 on non-mpi machine

Post by sl »

When I run the code below in a non-cluster enivornment (i.e. nrniv filename.hoc - ) it prints out 1 instead of 0.

Code: Select all

objref pc
pc = new ParallelContext()
print pc.nhost()
The documentation says, however, that nhost should return 0 in this setting.

I am using the January Alpha 315 installer on Linux, although I verified this with a vanilla Windows NEURON 7.0 install as well.

Any ideas as to why this is happening?
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: nhost returning 1 on non-mpi machine

Post by ted »

No, but it is an alpha. If this is important to your particular application, try the latest 7.1 alpha.
sl
Posts: 21
Joined: Wed Nov 28, 2007 12:52 am
Location: Cornell University

Re: nhost returning 1 on non-mpi machine

Post by sl »

It isn't only a problem in the alpha, though. I tested this in the standard distributions on Linux and Windows of NEURON 7.0 and they both return nhost() = 1. I distinctly remember it returning 0 before version 7.0 (and the documentation, of course, requires it to be the case). I looked through the logs of the repository, and none of them seem to touch this bit.

As for why I need it, I want to make a run() statement that works both on a single computer (started without mpi) and on a cluster. run() itself doesn't work. psolve() crashes for me when I use it without mpi. nhost() is the only method I know to switch between psolve() and run() as appropriate.
sl
Posts: 21
Joined: Wed Nov 28, 2007 12:52 am
Location: Cornell University

Re: nhost returning 1 on non-mpi machine

Post by sl »

I just got psolve() working on a single machine (forgot to call stdinit() before it) so this is no longer a dire need for me.
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: nhost returning 1 on non-mpi machine

Post by ted »

sl wrote:I want to make a run() statement that works both on a single computer (started without mpi) and on a cluster. run() itself doesn't work.
Are you sure that's necessary? For examples of code that works just fine on single processor boxes without mpi, and on clusters with mpi, see the parallelized implementations in
http://senselab.med.yale.edu/modeldb/Sh ... odel=96444
(from
Hines ML, Carnevale NT (2008) Translating network models to parallel hardware in NEURON
J. Neurosci. Meth. 169:425-455).
hines
Site Admin
Posts: 1687
Joined: Wed May 18, 2005 3:32 pm

Re: nhost returning 1 on non-mpi machine

Post by hines »

The documentation of
http://www.neuron.yale.edu/neuron/stati ... html#nhost
needs to be fixed. The behavior changed when mpi was added in 2005 (I believe). So
when mpi is not being used, pc.nhost == 1 and pc.id == 0 .
sl
Posts: 21
Joined: Wed Nov 28, 2007 12:52 am
Location: Cornell University

Re: nhost returning 1 on non-mpi machine

Post by sl »

Are you sure that's necessary? For examples of code that works just fine on single processor boxes without mpi, and on clusters with mpi
Yes, indeed they do. As I said, it was my mistake of not calling stdinit() before calling pc.psolve() that was causing my issues. One slight difference remains between run() and psolve() in that I couldn't yet make psolve() work properly with the GUI, but that is just a matter of having a gui (that uses run() ) and a non-gui (that uses psolve()) versions of my model available: a far more tenable distinction than the one I thought I had to make, since it's not like GUI works with in the mpi mode anyway.
Post Reply