Auryn simulator

Simulator for spiking neural networks with synaptic plasticity

User Tools

Site Tools


manual:compileandrunaurynsimulations

Howto compile, link and run Auryn simulations

You have installed the latest release of Auryn and compiled the library. Suppose you now want to start writing your own code. A good way to start is by modifying examples. First copy the file to a place where you would like to develop your Auryn code. You could for instance create the directory ~/mycode/ for that purpose. Start with copying the example there (for instance sim_epsp). It is probably a good idea to rename the program too. Let's assume you called it sim_new.cpp.

Compile with the help of a Makefile

I like using my own handwritten makefiles (of course you can follow any other approach you feel most comfortable with). To proceed with my approach create a file called Makefile with the following contents:

# Update the following lines to your system requirements
AURYNPATH=$(HOME)/auryn

# Path to Auryn include files
AURYNINC=$(AURYNPATH)/src

# Path to Auryn library
AURYNLIB=$(AURYNPATH)/build/release/src

# The following should not require updating in most cases 
CXX = mpicxx
CXXFLAGS=-ansi -pipe -O3 -march=native -ffast-math -pedantic -I/usr/include -I$(AURYNINC)
LDFLAGS=$(AURYNLIB)/libauryn.a -lboost_filesystem -lboost_system -lboost_program_options -lboost_mpi -lboost_serialization

# Add your simulation's file name here as default target
all: sim_new

sim_%: sim_%.o
    $(CXX) $(CXXFLAGS) $< $(LDFLAGS) -o $(subst .o,,$<)

%.o : %.cpp
    $(CXX) $(CXXFLAGS) -c $<

Here you might need to update the first three lines if something does not work for you. The first line is the shorthand for you MPI C++ compiler, the second line is the path the root directory where you keep Auryn. Finally, in the third we set the directory where you keep libauryn.a. Per default that is where you build Auryn.

Note that this Makefile assumes that you prefix all your simulation scripts with sim_. If you don't want to do that you will have to modify the macro accordingly.

You can now compile and run your copy of sim_epsp by invoking

make sim_new && ./sim_new

These steps can be conveniently wrapped in a shell script too as has been done here https://github.com/fzenke/malleable/blob/master/bin/auryn_run.sh.

Now you can start modifying sim_new and write your own simulations. If you start to develop new Auryn classes which the advanced user will almost certainly do, you should also checkout the coding style guide. Happy coding!

manual/compileandrunaurynsimulations.txt · Last modified: 2017/03/13 19:43 by zenke