Auryn simulator

Simulator for spiking neural networks with synaptic plasticity

User Tools

Site Tools


manual:compileandrunaurynsimulations

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
manual:compileandrunaurynsimulations [2015/12/06 03:55] – Adds version note zenkemanual:compileandrunaurynsimulations [2017/03/13 19:43] (current) – Adds comment string zenke
Line 1: Line 1:
 ====== Howto compile, link and run Auryn simulations ====== ====== Howto compile, link and run Auryn simulations ======
- 
-**Note**: This description applies to Auryn v0.6 and older versions -- Starting with v0.7 Auryn libraries and examples are built using [[cmake]]. 
  
 You have installed the latest release of Auryn and [[manual:compileauryn|compiled the library]]. Suppose you now want to start writing your own code. A good way to start is by modifying [[examples:start]]. 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'' You have installed the latest release of Auryn and [[manual:compileauryn|compiled the library]]. Suppose you now want to start writing your own code. A good way to start is by modifying [[examples:start]]. 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: 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:
 <code> <code>
-Your shorthand for your MPI C++ compiler +Update the following lines to your system requirements 
-CC mpicxx +AURYNPATH=$(HOME)/auryn 
-Your Auryn install path + 
-AURYNDIR = /home/yourname/auryn/ +Path to Auryn include files 
-# Path to libauryn.a (see compiling Auryn) +AURYNINC=$(AURYNPATH)/src 
-BUILDDIR = $(AURYNDIR)/build/home/+ 
 +# Path to Auryn library 
 +AURYNLIB=$(AURYNPATH)/build/release/src
  
-CFLAGS= -ansi -Wall -pipe -O3 -ffast-math -funsafe-math-optimizations \ +# The following should not require updating in most cases  
-        -march=native -mtune=native -pedantic +CXX = mpicxx 
-        -I$(AURYNDIR)/src -I$(AURYNDIR)/dev/src+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
  
-LDFLAGS=-L$(BUILDDIR) -lauryn \ +# Add your simulation's file name here as default target 
-        -lboost_program_options -lboost_serialization -lboost_mpi+all: sim_new
  
 sim_%: sim_%.o sim_%: sim_%.o
-    $(CC) $(CFLAGS) $< $(LDFLAGS) -o $(subst .o,,$<)+    $(CXX) $(CXXFLAGS) $< $(LDFLAGS) -o $(subst .o,,$<)
  
 %.o : %.cpp %.o : %.cpp
-    $(CC) $(CFLAGS) -c $<+    $(CXX) $(CXXFLAGS) -c $<
 </code> </code>
 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. 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.
Line 35: Line 39:
 make sim_new && ./sim_new make sim_new && ./sim_new
 </code> </code>
 +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! 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.1449374154.txt.gz · Last modified: 2015/12/06 03:55 by zenke