CARLsim
3.0.3
CARLsim: a GPU-accelerated SNN simulator
|
CARLsim now has a software interface to an evolutionary computation system written in Java (ECJ) (Luke et al., 2006) to provide an automated parameter tuning framework. We found that an automated tuning framework became increasingly useful as our SNN models became more complex. Evolutionary Algorithms (EAs) enable flexible parameter tuning by means of optimizing a generic fitness function. The first version of the automated paramter-tuning framework used an EA library called Evolving Objects (EO) as the EA engine (Carlson et al., 2014). ECJ was chosen to supercede EO because it is under active development (Linux), supports multi-threading, has excellent documentation, and implements a variety of EAs (Luke at al., 2006).
Source: Beyeler et al., 2015
Fig. 1 shows the general approach of the automated parameter tuning framework. ECJ implements an EA with a parameter file that includes: EA parameters, the number of individuals per generation, and parameter ranges. Each step of the EA is executed by ECJ except for the evaluation of the fitness function, which is completed by CARLsim. CARLsim evaluates the fitness function in parallel by running multiple SNN individuals simultaneously on the GPU, where the bulk of the computations occur. ECJ is written in Java, which is slower than C, but the majority of the execution time is spent running CARLsim’s optimized C++/CUDA code. At the beginning of every generation, the parameters to be tuned are passed from ECJ to CARLsim using standard input/output streams in Linux. CARLsim evaluates individuals in parallel and returns the resulting fitness values to ECJ via standard streams. The tuning framework allows users to tune virtually any SNN parameter, while the fitness functions can be written to depend on the neuronal activity or synaptic weights of the SNN.
The current version of the CARLsim paramter-tuning framework uses Evolutionary Computations in Java (ECJ) (version 22 or greater is required). For up-to-date installation instructions, please go to the official ECJ website.
At the time of writing, installing ECJ 22 on Unix systems involves the following steps.
$JAVA_HOME
points to the OpenJDK library: ~/Downloads
)./opt/ecj
: $CLASSPATH
environment variable: You can verify the installation by running (for example) Tutorial 1:
If the installation was successful, you should see the app report evolving fitness values, such as:
$CLASSPATH
environment variable exists and points to the right location (see above).After ECJ version 22 or greater has been installed the user then needs to set the ECJ_DIR
and ECJ_PTI_DIR
environment variables in either the .bashrc file or the user.mk
file located in the tools/ecj_pti
subdirectory. The ECJ_DIR
environment variable points to the current installation location of ECJ. The ECJ_PTI_DIR
environment variable points to the desired location of the CARLsim-ECJ PTI code. The code below shows the default values that can be changed in the user.mk
file:
tools/ecj_pti directory
is distinct from the user.mk
file in the main carlsim directory and not confuse them. Here we are configuring the user.mk file in the tools/ecj_pti
subdirectory.You can also place this command in your ~/.bashrc so you don't have to run it every time you open a new terminal.
$ source ~/.bashrc
these variables exported.Once the environment variables have been set, navigate to tools/ecj_pti
and run:
This will install the CARLsim-ECJ PTI static library into the location pointed to by ECJ_PTI_DIR
.
You can verify the installation by (for example) running Tutorial 5: Parameter Tuning Interface (PTI).
In general, users will create their own project directory and model it after the tutorial program found in Tutorial 5: Parameter Tuning Interface (PTI). Users configure a ECJ parameter file and implement a CARLsim fitness evaluation function. ECJ performs the EA utilizing the user-defined parameter file and runs the CARLsim 'main' program every generation to evaluate the fitness for all individuals in parallel. Each individual represents a different SNN with a unique set of parameter values. ECJ outputs the fitness and parameter files to log files every generation. Parameter values from high-fitness SNNs can then be used in SNN modeling and simulation.
First the ECJ configuration file must be edited. Parts of the ECJ configuration file are shown below:
It's probably easiest to start with this ECJ parameter file and modify it to your project's needs. The particular variables the user needs to edit are:
eval.problem.simulationCommand
: which is the name of the carlsim binary ECJ executes every generation to evaluate the fitness function. The $ sign means the path is relative to the location of the parameter file.
generations
: number of maximum generations to run.
pop.subpop.0.size
: number of individuals in each generation.
pop.subpop.0.species.genome-size
: total number of parameters to be tuned in each individual.
pop.subpop.0.species.min-gene
: default minimum range value for all parameters to be tuned
pop.subpop.0.species.max-gene
: default maximum range value for all parameters to be tuned
To specify the parameter range for each parameter individually, you define min-gene and max.gene values for additional pop.subpop members as is shown in the code below:
However,you still need to keep the pop.subpop.0.species.min-gene
and pop.subpop.0.species.max-gene
in the parameter file.
for more information about the ECJ configuration file, please visit the ECJ homepage.
Users then need to implement their own CARLsim evaluation function. The overall structure is as follows. A specific Experiment class is implemented and inherited from the base Experiment class:
The only class functions functions are the default class constructor and the run function. The run function is where CARLsim code is written and executed. At the final step, the fitness values are output back to ECJ using standard Linux streams.