Giter Club home page Giter Club logo

neurodriver's Introduction

Neurokernel

Package Description

Project Website | GitHub Repository | Online Documentation | Mailing List | Forum

Neurokernel is a Python framework for developing models of the fruit fly brain and executing them on multiple NVIDIA GPUs.

Support the project

Prerequisites

Neurokernel requires

  • Linux (other operating systems may work, but have not been tested);
  • Python;
  • at least one NVIDIA GPU with Fermi architecture or later;
  • NVIDIA's GPU drivers;
  • CUDA 5.0 or later;
  • OpenMPI 1.8.4 or later compiled with CUDA support.

To check what GPUs are in your system, you can use the inxi command available on most Linux distributions:

inxi -G

You can verify that the drivers are loaded as follows:

lsmod | grep nvidia

If no drivers are present, you may have to manually load them by running something like:

modprobe nvidia

as root.

Although some Linux distributions do include CUDA in their stock package repositories, you are encouraged to use those distributed by NVIDIA because they often are more up-to-date and include more recent releases of the GPU drivers. See this page for download information.

If you install Neurokernel in a virtualenv environment, you will need to install OpenMPI. See this page for OpenMPI installation information. Note that OpenMPI 1.8 cannot run on Windows_.

Some of Neurokernel's demos require either ffmpeg or libav installed to generate visualizations (see Examples).

Installation

Conda

The easiest way to get neurokernel is to install it in a conda environment: :

conda create -n nk python=3.7 c-compiler compilers cxx-compiler openmpi -c conda-forge -y
conda activate nk
python -m pip install neurokernel

Make sure to enable CUDA support in the installed OpenMPI by setting: :

export OMPI_MCA_opal_cuda_support=true

Examples

Introductory examples of how to use Neurokernel to build and integrate models of different parts of the fly brain are available in the Neurodriver package. To install it run the following: :

git clone https://github.com/neurokernel/neurodriver
cd ~/neurodriver
python setup.py develop

Other models built using Neurokernel are available on GitHub.

Building the Documentation

To build Neurokernel's HTML documentation locally, you will need to install

Once these are installed, run the following: :

cd ~/neurokernel/docs
make html

Authors & Acknowledgements

See the included AUTHORS file for more information.

License

This software is licensed under the BSD License. See the included LICENSE file for more information.

neurodriver's People

Contributors

chungheng avatar jonmarty avatar kpsychas avatar lebedov avatar mkturkcan avatar nikulukani avatar tk-21st avatar yiyin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

neurodriver's Issues

`params_dict` should enforce dtype on values

If a given node has a parameter value specified as int (like 'param': 123) instead of float (like 'param':123.),
if is passed into the kernel as integer type. However, if the CUDA kernel specifies that the input argument is a floating point variable (like double), the parameter value will be set to cast to floating type with value 0.

In my opinion, in NDComponent __init__, params_dict should enforce a uniform dtype on the parameter values.
Or if there is a way to check the expected dtype from the cuda kernel in the pre_run stage and, if inconsistent between params_dict and the expected dtypes from the kernel, send a warning and convert to the one required by the kernel.

Refactor LPU code

LPU.py used to be a mega-file that does all of the following in a single file:

  1. Parse networkx graphs
  2. Update connections, adding synapses as per needed
  3. Update components by adding delay and other memory management variables
  4. Setup variable memory
  5. pre_run, run_step, post_run

There is a need to cleanup the file for future development and potentially removing some extraneous functions.

This is tracked in feature/refactor branch starting at commit 3e77638

create new Component parent class for BaseNeuron and BaseSynapse

Given that the current neuron and synapse classes in Neurodriver are not readily extensible to support constructs with more complex input/output relationships (e.g., presynaptic inhibition), we should introduce the notion of a Component that provides an abstract framework that supports aspect common to all such constructs.

An important design consideration that needs to be addressed when implementing the above is imposing an order on the state variable updates performed for each component type.

Copying @nikulukani.

support for NeuroArch data model

The following changes must be made to support loading of graphs of executable entities and ports in accordance with NeuroArch's data model:

  • Only ports should have selectors; neuron and synapse model instances may not.
  • Ports may be connected to synapses so that they can
    • receive data from external inputs or presynaptic neurons in other LPUs or
    • emit output to be recorded.
  • Required neuron model attributes:
    • spiking - True if the neuron's output is boolean, False if it
      is floating point.
    • model - Model name.
      Comments: The currently required public and extern attributes will be
      eliminated in light of the new requirement that all external input/output
      to/from neurons/synapses must be performed via ports. Since not all models support emission of
      both spikes and graded potential values, sanity checking needs to be performed to
      exclude unsupported combinations of the above attributes.
  • Required synapse model attributes:
    • reverse - Reverse potential. If present, the synapse's output is
      a conductance; if absent it is a current.
      Comments: The class attribute will be eliminated because Neurodriver can
      implicitly determine whether presynaptic and postsynaptic neurons are spiking
      from their attributes. The conductance attribute will be eliminated because
      the presence/absence of the reverse attribute signifies whether the synapse
      emits conductance or current values.

LPU.py directly references spike_state

The init_variable_memory function refers to "spike_state" explicitly; this could cause problems when additional spike variables are added into components.

Intro example's intro_demo.py causes Segmentation fault

Log shows that lpu_0 gpot data sent to lpu_1 (specifically, 'initV's from n_dict_0) contain newline characters "\n" in an array of floats. I also ran 2 LPUs on 1 GPU.

2017-01-31T18:16:04Z:INFO:man       |connecting modules lpu_0 and lpu_1
2017-01-31T18:16:04Z:INFO:man       |updating routing table with pattern
2017-01-31T18:16:04Z:INFO:man       |connected modules lpu_0 and lpu_1
2017-01-31T18:16:05Z:INFO:man       |sending steps message (10000)
2017-01-31T18:16:05Z:INFO:man       |sending start message
2017-01-31T18:16:05Z:INFO:prc 1     |GPU 0 initialized
2017-01-31T18:16:05Z:INFO:prc 0     |GPU 0 initialized
2017-01-31T18:16:05Z:INFO:mod lpu_0 |running code before body of worker 0
2017-01-31T18:16:05Z:INFO:mod lpu_0 |extracting output ports for lpu_1
2017-01-31T18:16:05Z:INFO:mod lpu_1 |running code before body of worker 1
2017-01-31T18:16:05Z:INFO:mod lpu_1 |extracting input ports for lpu_0
2017-01-31T18:16:06Z:INFO:mod lpu_0 |running body of worker 0
2017-01-31T18:16:06Z:INFO:mod lpu_0 |maximum number of steps changed: inf -> 10000
2017-01-31T18:16:06Z:INFO:mod lpu_0 |setting maximum steps to 10000
2017-01-31T18:16:06Z:INFO:mod lpu_0 |starting
2017-01-31T18:16:06Z:INFO:mod lpu_0 |running execution step
2017-01-31T18:16:06Z:INFO:mod lpu_1 |running body of worker 1
2017-01-31T18:16:06Z:INFO:mod lpu_1 |maximum number of steps changed: inf -> 10000
2017-01-31T18:16:06Z:INFO:mod lpu_1 |setting maximum steps to 10000
2017-01-31T18:16:06Z:INFO:mod lpu_1 |starting
2017-01-31T18:16:06Z:INFO:mod lpu_1 |running execution step
2017-01-31T18:16:06Z:INFO:mod lpu_0 |gpot data sent to lpu_1: [-0.05214 -0.05214 -0.05214 -0.05214 -0.05214 -0.05214 -0.05214 -0.05214\n -0.05214 -0.05214 -0.05214 -0.05214 -0.05214 -0.05214 -0.05214 -0.05214\n -0.05214 -0.05214 -0.05214 -0.05214 -0.05214]
[archiso:15797] *** Process received signal ***
[archiso:15797] Signal: Segmentation fault (11)
[archiso:15797] Signal code: Invalid permissions (2)
[archiso:15797] Failing at address: 0xb016e0a00
[archiso:15797] [ 0] /usr/lib/libpthread.so.0(+0x11080)[0x7f2488111080]
[archiso:15797] [ 1] /usr/lib/libc.so.6(+0x128855)[0x7f2487e8a855]
[archiso:15797] [ 2] /usr/lib/openmpi/openmpi/mca_btl_vader.so(mca_btl_vader_sendi+0x186)[0x7f247adddba6]
[archiso:15797] [ 3] /usr/lib/openmpi/openmpi/mca_pml_ob1.so(+0x80f6)[0x7f247a52a0f6]
[archiso:15797] [ 4] /usr/lib/openmpi/openmpi/mca_pml_ob1.so(mca_pml_ob1_isend+0x3fd)[0x7f247a52a95d]
[archiso:15797] [ 5] /usr/lib/openmpi/libmpi.so.12(MPI_Isend+0x2ba)[0x7f248459d28a]
[archiso:15797] [ 6] /usr/lib/python2.7/site-packages/mpi4py/MPI.so(+0xcc861)[0x7f24848e5861]
[archiso:15797] [ 7] /usr/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x5f30)[0x7f2488407c60]
[archiso:15797] [ 8] /usr/lib/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x8dc)[0x7f248840b8dc]
[archiso:15797] [ 9] /usr/lib/libpython2.7.so.1.0(+0x7329d)[0x7f248839029d]
[archiso:15797] [10] /usr/lib/libpython2.7.so.1.0(PyObject_Call+0x52)[0x7f2488369692]
[archiso:15797] [11] /usr/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x3509)[0x7f2488405239]
[archiso:15797] [12] /usr/lib/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x8dc)[0x7f248840b8dc]
[archiso:15797] [13] /usr/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x5fd2)[0x7f2488407d02]
[archiso:15797] [14] /usr/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x6108)[0x7f2488407e38]
[archiso:15797] [15] /usr/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x6108)[0x7f2488407e38]
[archiso:15797] [16] /usr/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x6108)[0x7f2488407e38]
[archiso:15797] [17] /usr/lib/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x8dc)[0x7f248840b8dc]
[archiso:15797] [18] /usr/lib/libpython2.7.so.1.0(PyEval_EvalCode+0x28)[0x7f248840b9e8]
[archiso:15797] [19] /usr/lib/libpython2.7.so.1.0(+0x108efe)[0x7f2488425efe]
[archiso:15797] [20] /usr/lib/libpython2.7.so.1.0(PyRun_FileExFlags+0x81)[0x7f24884271c1]
[archiso:15797] [21] /usr/lib/libpython2.7.so.1.0(PyRun_SimpleFileExFlags+0xf4)[0x7f24884284e4]
[archiso:15797] [22] /usr/lib/libpython2.7.so.1.0(Py_Main+0xce0)[0x7f248843aca0]
[archiso:15797] [23] /usr/lib/libc.so.6(__libc_start_main+0xf1)[0x7f2487d82291]
[archiso:15797] [24] /usr/bin/python2(_start+0x2a)[0x55baed2517ea]
[archiso:15797] *** End of error message ***
2017-01-31T18:16:06Z:INFO:mod lpu_1 |sent all data from lpu_1
2017-01-31T18:16:06Z:INFO:mod lpu_1 |receiving from lpu_0
--------------------------------------------------------------------------
mpiexec noticed that process rank 0 with PID 15797 on node archiso exited on signal 11 (Segmentation fault).
--------------------------------------------------------------------------

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.