Giter VIP home page Giter VIP logo

mozaik's Introduction

Mozaik

Computational neurosceince is shifting towards more heterogeneous models of neuronal circuits, and application of complex experimental protocols. This escalation of complexity is not sufficiently met by existing tool chains. Mozaik is a workflow system for spiking neuronal network simulations written in Python that integrates model, experiment and stimulation specification, simulation execution, data storage, data analysis and visualization into a single automated workflow. This way, Mozaik increases the productivity of running virtual experiments on complex heterogenous spiking neuronal networks.

You can read more about Mozaik here.

Currently, Mozaik is being fully tested only on Ubuntu Linux distribution.

Ubuntu installation instructions

Following these instruction should give you a working copy of mozaik on a fresh installation of current Ubuntu system.

First the list of ubuntu package dependencies:

sudo apt-get install python3 python3-dev python3-pip python3-setuptools python3-tk python-nose subversion git libopenmpi-dev g++ libjpeg8 libjpeg8-dev libfreetype6 libfreetype6-dev zlib1g-dev libpng++-dev libncurses5 libncurses5-dev libreadline-dev liblapack-dev libblas-dev gfortran libgsl0-dev openmpi-bin python-tk cmake libboost-all-dev

Virtual env

Then python virtualenv and virtualenvwrapper (a handy way to manage python virtual environments):

$ sudo pip3 install virtualenv
$ sudo pip3 install virtualenvwrapper

To setup virtualenvwrapper add the following lines at the top of ~/.bashrc :

# virtualenvwrapper
export WORKON_HOME=~/virt_env
source /usr/local/bin/virtualenvwrapper.sh
export PIP_VIRTUALENV_BASE=$WORKON_HOME
export PIP_RESPECT_VIRTUALENV=true

For the first time, run .bashrc (in the future it will be loaded by your terminal):

$ source .bashrc

To create a new managed virtualenv you just need to:

$ mkvirtualenv --python=/usr/bin/python3 mozaik
$ workon mozaik
(mozaik)$>

Dependencies

Now you can install all other dependencies in this protected environment:

pip3 install numpy==1.23.5 scipy mpi4py matplotlib quantities lazyarray interval Pillow param==1.5.1 parameters neo==0.12.0 cython psutil future requests elephant pytest-xdist pytest-timeout junitparser numba

Next we will manually install several packages. It is probably the best if you create a separate directory in an appropriate place, where you will download and install the packages from.

First install the imagen package:

git clone https://github.com/CSNG-MFF/imagen.git
cd imagen
pip install .

Then install the PyNN package from the PyNNStepCurrentModule branch:

git clone https://github.com/CSNG-MFF/PyNN.git
cd PyNN
git checkout PyNNStepCurrentModule
pip install .

Next install the Nest simulator (always in the virtual environment):

  • download the latest version from their website:

    wget https://github.com/nest/nest-simulator/archive/refs/tags/v3.4.tar.gz
  • untar and cd into it:

    tar xvfz v3.4.tar.gz
    cd nest-simulator-3.4
  • then configure (change path to wherever you installed your virtual environemnt):

    (mozaik)$ cmake -Dwith-mpi=ON -Dwith-boost=ON -DCMAKE_INSTALL_PREFIX:PATH=$HOME/virt_env/mozaik -Dwith-optimize='-O3' ./
  • finally, by launching make and install, it installs PyNest in the activated virtual environment mozaik. If you're using Slurm, run these commands through srun :

    (mozaik)$ make
    (mozaik)$ make install
  • Then:

    (mozaik)$ make installcheck

    or if you are using Slurm:

    (mozaik)$ salloc -n8 make installcheck
  • nest will reside in $HOME/virt_env/mozaik/lib/python3.*/site-packages. Check that the package is seen by python using:

    (mozaik)$ python -c 'import nest'

Then install the stepcurrentmodule Nest module:

  • get the module from github and cd into it:

    git clone https://github.com/CSNG-MFF/nest-step-current-module.git
    cd nest-step-current-module
  • then, in the following command, replace NEST_CONFIG_PATH by your nest-config installation path (should reside in $HOME/virt_env/mozaik/bin/nest-config) and run it:

    (mozaik)$ cmake -Dwith-mpi=ON -Dwith-boost=ON -Dwith-optimize='-O3' -Dwith-nest=NEST_CONFIG_PATH ./
  • finally, by launching make and install, it installs the nest module in the activated virtual environment mozaik. If you're using Slurm, run these commands through srun :

    (mozaik)$ make
    (mozaik)$ make install
  • Check that the package is seen by python using:

    (mozaik)$ python -c 'import nest; nest.Install("stepcurrentmodule")'

And, finally, Mozaik:

git clone https://github.com/CSNG-MFF/mozaik.git
cd mozaik
pip install .

Running examples

Go to the examples directory in the mozaik cloned from github (see above) and launch the model VogelsAbbott2005:

cd examples
cd VogelsAbbott2005
python run.py nest 2 param/defaults 'test'

This will launch the example with the nest simulator running 2 MPI processes, each process running 2 threads, using the parameterization of the model rotted in param/defaults. Finally, 'test' is the name of this run.

Testing, Autoformat, Continuous Integration

In case you want to contribute to the project, you need to make sure your code passes all unit tests and is formatted with the Black autoformatter. You can make sure this is the case by running following from the project directory:

pytest && black --check .
Note that the mpi tests are currently not working when invoking pytest in this manner. You can run these specific tests the following way::

pytest tests/full_model/test_models_mpi.py

This command will run all tests that it can find recursively under the current directory, as well as check all non-blacklisted files for formatting. Travis-CI will run the same steps for your pull request once you submit it to the project. To install pytest and black:

pip3 install pytest pytest-cov pytest-randomly coverage black

There are additional useful options for pytests that you can use during development:

  • You may exclude tests running the model by adding the option:

    pytest -m "not model"
  • You can run the tests in a single file by:

    pytest path/to/file
  • Pytest doesn't, print to stdout by default, you can enable this by:

    pytest -s

Due to the impossibility of using more than 2 cores in Github actions, the test test_mozaik_rng_mpi7 invoking 7 MPI processes cannot be ran there. It is therefore necessary to run it locally, by following these steps:

  • Modify the sbatch_test_RNG_MPI7.sh sbatch script to include your virtual environment after the source command.
  • Using the following command to run it locally if using slurm:

    sbatch sbatch_test_RNG_MPI7.sh
  • Check the slurm output file to verify whether the test passed
copyright

Copyright 2011-2013 by the mozaik team, see AUTHORS.

license

CECILL, see LICENSE for details.

mozaik's People

Contributors

antolikjan avatar apdavison avatar dberling avatar dependabot[bot] avatar dguarino avatar fojtikvit avatar h-mayorquin avatar hamanpa avatar kkorvasova avatar racagnol avatar rcagnol avatar rozsatib avatar sjawhar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mozaik's Issues

explicit the model we should use in Tutorial_2

By building the doc directory (make html), I could go through the tutorial page.
There are two tutorials: the first one looks clear. On the second one, the base model to use is not clearly defined

Check if cache_path folder exists

in spatiotemporalfilter.py
write_cache function assumes that self.parameters.cache_path already exists --> create folder if not existent at that time
suggestion: since this is likely to happen also in other models that will cache / write something to disk, it might be useful to have a global object (in the scope of an experiment) which scans for non-existent paths ... (?)

Required parameters formatting -> sets

/mozaik/framework/interfaces.py
in check_parameters:
when raising KeyError: would be nice to display the difference between the two required and provided parameter lists using sets (e.g. set_a.difference(set_b))

'period' parameter should imply default 'bounds'

In a stimulus class (in stimuli/vision/topographica_based.py), the parameters are given as SNumber (see mozaik.tools.mozaik_parametrized). We can give as SNumber parameters 'bounds' that permit to define the range of authorized value of the parameters. Another SNumber parameter is 'period'. When 'period' is given, we want that it implies that bounds=[0,period]. Either, it shoulds set these default bounds, or it should throw an error if the bounds are given together with the period.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.