MPI4py and Neuron

When Python is the interpreter, what is a good
design for the interface to the basic NEURON
concepts.

Moderator: hines

Post Reply
mattions
Posts: 65
Joined: Tue Jul 15, 2008 11:21 am
Location: EMBL-EBI Cambridge UK

MPI4py and Neuron

Post by mattions »

I'm trying to use neuron with MPI but it seems the initialization of NEURON is not correct:

Code: Select all

mpi4py thinks I am 1 of 4, NEURON thinks I am 0 of 1

mpi4py thinks I am 2 of 4, NEURON thinks I am 0 of 1

mpi4py thinks I am 0 of 4, NEURON thinks I am 0 of 1

mpi4py thinks I am 3 of 4, NEURON thinks I am 0 of 1
The script that I'm using is:

Code: Select all

from mpi4py import MPI
import os

# Removing display to import neuron properly
if os.environ.has_key("DISPLAY"):
    del os.environ['DISPLAY']

from neuron import h
pc = h.ParallelContext()

s = "mpi4py thinks I am %d of %d, NEURON thinks I am %d of %d\n"
cw = MPI.COMM_WORLD
print s % (cw.rank, cw.size, pc.id(), pc.nhost())

pc.done()
do you have any suggestions?
hines
Site Admin
Posts: 1687
Joined: Wed May 18, 2005 3:32 pm

Re: MPI4py and Neuron

Post by hines »

Did you build NEURON from the sources by configureing with the --with-nrnmpi
configure argument? The DMG installer version is not linked against mpi.
mattions
Posts: 65
Joined: Tue Jul 15, 2008 11:21 am
Location: EMBL-EBI Cambridge UK

Re: MPI4py and Neuron

Post by mattions »

we compiled with this options:

Code: Select all

./configure --with-nrnpython --with-mpi --with-paranrn --with-x
and if I run the

Code: Select all

./configure --help
this is the result

Code: Select all

mattions@triton:nrn-7.0$ ./configure --help
`configure' configures nrn 7.0 to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or `..']

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
			  [/usr/local/nrn]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
			  [PREFIX]

By default, `make install' will install all the files in
`/usr/local/nrn/bin', `/usr/local/nrn/lib' etc.  You can specify
an installation prefix other than `/usr/local/nrn' using `--prefix',
for instance `--prefix=$HOME'.

For better control, use the options below.

Fine tuning of the installation directories:
  --bindir=DIR           user executables [EPREFIX/bin]
  --sbindir=DIR          system admin executables [EPREFIX/sbin]
  --libexecdir=DIR       program executables [EPREFIX/libexec]
  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
  --libdir=DIR           object code libraries [EPREFIX/lib]
  --includedir=DIR       C header files [PREFIX/include]
  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
  --infodir=DIR          info documentation [PREFIX/info]
  --mandir=DIR           man documentation [PREFIX/man]

Program names:
  --program-prefix=PREFIX            prepend PREFIX to installed program names
  --program-suffix=SUFFIX            append SUFFIX to installed program names
  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names

X features:
  --x-includes=DIR    X include files are in DIR
  --x-libraries=DIR   X library files are in DIR

System types:
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]

Optional Features:
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --enable-UniversalMacBinary
                          combined binary for ppc and i386, fake arch is
                          called umac
  --disable-DiscreteEventObserver
                          Save space, but danger of use of freed memory if any
                          NetCon destroyed.
  --enable-bluegene       For BlueGene/L, supplies many extra configuration
                          options
  --enable-bluegeneP      For BlueGene/P, supplies many extra configuration
                          options
  --enable-bgPlinux       For BlueGene/P mpicc, supplies many extra
                          configuration options
  --disable-dependency-tracking  speeds up one-time build
  --enable-dependency-tracking   do not reject slow dependency extractors
  --enable-rpm-rules       Try to create rpm make rules (defaults to yes for Linux)
  --enable-shared[=PKGS]
                          build shared libraries [default=yes]
  --enable-static[=PKGS]
                          build static libraries [default=no]
  --enable-fast-install[=PKGS]
                          optimize for fast installation [default=yes]
  --disable-libtool-lock  avoid locking (might break parallel builds)
  --disable-cygwin        build as MINGW program. Only for mswin.
  --enable-ncs            Compile with USENCS defined - Allows NCS to use
                          NEURON
  --disable-ncs           This is the default

  --enable-realtime       rtlinux dynamic clamp
  --enable-NI6229         use National Instruments PCI-6229 DAQ


Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-nmodl-only       When cross compiling, nocmodl and hoc_e need to be
                          compiled for the build machine
  --without-nmodl         When cross compiling, nocmodl and hoc_e should NOT
                          be compiled for the host machine
  --with-rpm-prog=PROG   Which rpm to use (optional)
  --with-rpm-extra-args=ARGS       Run rpm with extra arguments (defaults to none)
  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
  --with-pic              try to use only PIC/non-PIC objects [default=use
                          both]
  --with-tags[=TAGS]
                          include additional configurations [automatic]
  --with-nrnpython=desired python binary or 'dynamic'
                          Python interpreter can be used (default is NO)
                          Probably need to set PYLIBDIR to find libpython...
                          and PYINCDIR to find Python.h
  --with-paranrn          parallel variable step integration for individual
                          cells
  --without-paranrn       default. No parallel integration

  --with-multisend        Allow optional MPI_ISend/Recv for spike transfer
  --with-multisend=bgp    Use BlueGene/P style dma spike transfer

  --with-mpi              Also compile the parallel code in
                          src/sundials/shared
  --without-mpi           This is the default. Do not compile the parallel
                          sundials code

  --with-metis            use METIS to distribute cell equations among
                          processors
  --without-metis         default.

  --without-memacs        leave out everything that depends on terminal cursor
                          capabilities

  -with-readline=dir      Specify the location of the readline library. You
                          must specify this option if readline is not located
                          in a standard place. The configure script looks for
                          the library in the subdirectory lib underneath the
                          directory you specify.

  --with-neosim           Compile with USENEOSIM defined
  --without-neosim        This is the default

  --with-nrnjava          Must explicitly use it if you want it. Enable the
                          java interface. This builds libnrnjava.so and makes
                          the NrnJava class available in hoc.
  --without-nrnjava       No java interface. This is the default

  --with-x                use the X Window System
  --without-x             disable everything depending on x11 equivalent to
                          --without-iv --without-nrnoc-x11 --without-x
  --with-nrniv            This is the default. Build as much of nrniv as is
                          consistent with the existence or non-existence of
                          InterViews. I.e if InterViews is not found List,
                          Vector, File, Impedance, SaveState, etc. will still
                          be built.

  --without-nrniv         Build only nrnoc

  --with-iv=dir           Specify the location of the InterViews graphics
                          package. You must specify this option if you do not
                          have them installed in a standard place. The
                          standard places are (from high to low precedence)
                          prefix/../iv /usr/local/iv /usr/local
  --without-iv            Do not compile graphics into neuron.

  --with-nrnoc-x11        This is the default Add the x11 window code to NRNOC
                          to allow the old style x11 window for plot, axis,
                          etc.
  --without-nrnoc-x11     Do not compile the old style nrnoc x11 window


Some influential environment variables:
  CXX         C++ compiler command
  CXXFLAGS    C++ compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
              headers in a nonstandard directory <include dir>
  CC          C compiler command
  CFLAGS      C compiler flags
  CPP         C preprocessor
  CXXCPP      C++ preprocessor
  F77         Fortran 77 compiler command
  FFLAGS      Fortran 77 compiler flags
  MPICC       MPI C compiler command
  MPICXX      MPI C++ compiler command

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
The --with-mpi seems to be the option that trigger mpi.
I ran the configure with --with-nrnmpi and I got the same configure output.

A snippet:

Code: Select all

checking for mpicc... mpicc
checking for MPI_Init... yes
checking for mpi.h... yes
checking for mpic++... mpic++
checking for mpi.h... yes
So, if I'm not wrong, we compile the software correctly. Or not?
Post Reply