CMake Options for NEST

NEST is installed with cmake (at least v3.12). In the simplest case, the commands:

cmake -DCMAKE_INSTALL_PREFIX:PATH=<nest_install_dir> <nest_source_dir>
make
make install

should build and install NEST to /install/path, which should be an absolute path.

Choice of compiler

We systematically test NEST using the GNU gcc and the Clang compiler suites. Compilation with other up-to-date compilers should also work, but we do not regularly test against those compilers and can thus only provide limited support.

To select a specific compiler, please add the following flags to your cmake line:

-DCMAKE_C_COMPILER=<C-compiler> -DCMAKE_CXX_COMPILER=<C++-compiler>

Options for configuring NEST

NEST allows for several configuration options for custom builds:

Use Python to build PyNEST

-Dwith-python=[OFF|ON|<path/to/Python>]

Build PyNEST [default=ON]. To set a specific Python, give the install path.

-Dcythonize-pynest=[OFF|ON]

Use Cython to cythonize pynestkernel.pyx [default=ON]. If OFF, PyNEST has to be build from a pre-cythonized pynestkernel.pyx.

For more details, see the Python binding section below.

Select parallelization scheme

-Dwith-mpi=[OFF|ON|</path/to/mpi>]

Build with MPI parallelization [default=OFF]. Optionally give directory with MPI installation.

-Dwith-openmp=[OFF|ON|<OpenMP-Flag>]

Build with OpenMP multi-threading [default=ON]. Optionally set OMP compiler flags.

See also the section on building with mpi below.

External libraries

-Dwith-libneurosim=[OFF|ON|</path/to/libneurosim>]

Build with libneurosim [default=OFF]. Optionally give the directory where libneurosim is installed.

-Dwith-music=[OFF|ON|</path/to/music>]

Build with MUSIC [default=OFF]. Optionally give the directory where MUSIC is installed.

-Dwith-sionlib=[OFF|ON|</path/to/sionlib>]

Build with sionlib [default=OFF]. Optionally give the directory where sionlib is installed.

-Dwith-boost=[OFF|ON|</path/to/boost>]

Build with Boost [default=ON]. To set a specific Boost installation, give the install path.

-Dwith-readline=[OFF|ON|</path/to/readline>]

Build with GNU Readline library [default=ON]. To set a specific library, give the install path.

-Dwith-ltdl=[OFF|ON|</path/to/ltdl>]

Build with ltdl library [default=ON]. To set a specific ltdl, give the install path. NEST uses ltdl for dynamic loading of external user modules.

-Dwith-gsl=[OFF|ON|</path/to/gsl>]

Build with the GSL library [default=ON]. To set a specific library, give the install path.

NEST properties

-Dtics_per_ms=[number]

Specify elementary unit of time [default=1000 tics per ms].

-Dtics_per_step=[number]

Specify resolution [default=100 tics per step].

-Dexternal-modules=[OFF|<list;of;modules>]

External NEST modules to be linked in, separated by ‘;’, [default=OFF].

-Dwith-detailed-timers=[OFF|ON]

Build with detailed internal time measurements [default=OFF]. Detailed timers can affect the performance.

-Dtarget-bits-split=['standard'|'hpc']

Split of the 64-bit target neuron identifier type [default=’standard’]. ‘standard’ is recommended for most users. If running on more than 262144 MPI processes or more than 512 threads, change to ‘hpc’.

Generic build configuration

-Dstatic-libraries=[OFF|ON]

Build static executable and libraries [default=OFF].

-Dwith-optimize=[OFF|ON|<list;of;flags>]

Enable user defined optimizations [default=OFF (uses ‘-O2’)]. When ON, ‘-O3’ is used. Separate multiple flags by ‘;’.

-Dwith-warning=[OFF|ON|<list;of;flags>]

Enable user defined warnings [default=ON (uses ‘-Wall’)]. Separate multiple flags by ‘;’.

-Dwith-debug=[OFF|ON|<list;of;flags>]

Enable user defined debug flags [default=OFF]. When ON, ‘-g’ is used. Separate multiple flags by ‘;’.

-Dwith-intel-compiler-flags=[OFF|<list;of;flags>]

User defined flags for the Intel compiler [default=’-fp-model strict’]. Separate multiple flags by ‘;’.

-Dwith-libraries=[OFF|<list;of;libraries>]

Link additional libraries [default=OFF]. Give full path. Separate multiple libraries by ‘;’.

-Dwith-includes=[OFF|<list;of;includes>]

Add additional include paths [default=OFF]. Give full path without ‘-I’. Separate multiple include paths by ‘;’.

-Dwith-defines=[OFF|<list;of;defines>]

Additional defines, e.g. ‘-DXYZ=1’ [default=OFF]. Separate multiple defines by ‘;’.

-Dwith-version-suffix=[string]

Set a user defined version suffix [default=’’].

Configuring NEST for Distributed Simulation with MPI

NEST supports distributed simulations using the Message Passing Interface (MPI). Depending on your setup, you have to use one of the following steps in order to add support for MPI:

  1. Try -Dwith-mpi=ON as argument for cmake.

  2. If 1. does not work, or you want to use a non-standard MPI, try -Dwith-mpi=/path/to/my/mpi. The mpi directory should contain the include, lib and bin subdirectories of the MPI installation.

  3. If 2. does not work, but you know the correct compiler wrapper for your installation, try adding the following to the invocation of cmake:

    -DMPI_CXX_COMPILER=myC++_CompilerWrapper \
    -DMPI_C_COMPILER=myC_CompilerWrapper -Dwith-mpi=ON
    

When running large-scale parallel simulations and recording from many neurons, writing to ASCII files might become prohibitively slow due to the large number of resulting files. By installing the SIONlib library and supplying its installation path to the -Dwith-sionlib=<path> option when calling cmake, you can enable the recording backend for binary files, which solves this problem.

If you compiled NEST with support for MPI and also want to run the corresponding tests, you have to tell it about how your mpirun/mpiexec command works by defining the mpirun function in your ~/.nestrc file. The file already contains an example implementation that should work with the OpenMPI implementation. For more details, see the documentation on the Configuration Options.

See the Guide to parallel computing to learn how to execute threaded and distributed simulations with NEST.

Support for libneurosim

In order to allow NEST to create connections using external libraries, it provides support for the Connection Generator Interface from libneurosim. To request the use of libneurosim, you have to use the follwing switch for the invocation of cmake. It expects either ON or OFF, or the directory where libneurosim is installed:

-Dwith-libneurosim=[OFF|ON|</path/to/libneurosim>]

For details on how to use the Connection Generator Interface, see the guide on connection management.

Python Binding (PyNEST)

Note that since NEST 3.0, support for Python 2 has been dropped. Please use Python 3 instead.

cmake usually autodetects your Python installation. In some cases cmake might not be able to localize the Python interpreter and its corresponding libraries correctly. To circumvent such a problem following cmake built-in variables can be set manually and passed to cmake:

 PYTHON_EXECUTABLE ..... path to the Python interpreter
 PYTHON_LIBRARY ........ path to libpython
 PYTHON_INCLUDE_DIR .... two include ...
 PYTHON_INCLUDE_DIR2 ... directories

e.g.: Please note ``-Dwith-python=ON`` is the default::
 cmake -DCMAKE_INSTALL_PREFIX=<nest_install_dir> \
       -DPYTHON_EXECUTABLE=/usr/bin/python3 \
       -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.4m.so \
       -DPYTHON_INCLUDE_DIR=/usr/include/python3.4 \
       -DPYTHON_INCLUDE_DIR2=/usr/include/x86_64-linux-gnu/python3.4m \
       <nest_source_dir>

Compiler-specific options

NEST has reasonable default compiler options for the most common compilers.

Intel compiler

To ensure that computations obey the IEEE754 standard for floating point numerics, the -fp-model strict flag is used by default, but can be overridden with

-Dwith-intel-compiler-flags="<intel-flags>"

Portland compiler

Use the -Kieee flag to ensure that computations obey the IEEE754 standard for floating point numerics.