AnimatLab
2
Test
|
Contains all of CARLsim's core functionality. More...
#include <snn.h>
Public Member Functions | |
CpuSNN (const string &_name, int _numConfig=1, int randomize=0, int mode=CPU_MODE) | |
int | connect (int gIDpre, int gIDpost, const string &_type, float initWt, float maxWt, float _C, uint8_t minDelay, uint8_t maxDelay, bool synWtType=SYN_FIXED, const string &wtType=" ") |
make from each neuron in grpId1 to 'numPostSynapses' neurons in grpId2 | |
int | connect (int gIDpre, int gIDpost, ConnectionGenerator *conn, bool synWtType=SYN_FIXED, int maxM=0, int maxPreM=0) |
void | copyGrpInfo_GPU () |
void | copyUpdateVariables_GPU () |
void | CpuSNNInit (unsigned int _numN, unsigned int _numPostSynapses, unsigned int _numPreSynapses, unsigned int _D) |
int | createGroup (const string &_name, unsigned int _numN, int _nType, int configId=ALL) |
creates a group of Izhikevich spiking neurons | |
int | createSpikeGeneratorGroup (const string &_name, int unsigned size_n, int stype, int configId=ALL) |
creates a spike generator group (dummy-neurons, not Izhikevich spiking neurons). | |
grpConnectInfo_t * | getConnectInfo (int connectId, int configId=0) |
int | getConnectionId (int connId, int configId) |
uint8_t * | getDelays (int gIDpre, int gIDpost, int &Npre, int &Npost, uint8_t *delays=NULL) |
int | getGroupId (int groupId, int configId) |
group_info_t | getGroupInfo (int groupId, int configId=0) |
group_info2_t | getGroupInfo2 (int groupId, int configId=0) |
int | getNextGroupId (int) |
int | getNumConfigurations () |
int | getNumConnections (int connectionId) |
Input: connectionID. Output: the number of connections associated with that connection ID. | |
void | getPopWeights (int gIDpre, int gIDpost, float *&weights, int &size, int configId=0) |
Writes weights from synaptic connections from gIDpre to gIDpost. Returns a pointer to the weights and the size of the 1D array in size. gIDpre(post) is the group ID for the pre(post)synaptic group, weights is a pointer to a single dimensional array of floats, size is the size of that array which is returned to the user, and configID is the configuration ID of the SNN. NOTE: user must free memory from weights to avoid a memory leak. | |
uint64_t | getSimTime () |
uint32_t | getSimTimeMs () |
uint32_t | getSimTimeSec () |
unsigned int * | getSpikeCntPtr (int grpId=-1, int simType=CPU_MODE) |
Returns pointer to nSpikeCnt, which is a 1D array of the number of spikes every neuron in the group has fired. Takes the grpID and the simulation mode (CPU_MODE or GPU_MODE) as arguments. More... | |
float * | getWeightChanges (int gIDpre, int gIDpost, int &Npre, int &Npost, float *weightChanges=NULL) |
float * | getWeights (int gIDpre, int gIDpost, int &Npre, int &Npost, float *weights=NULL) |
int | grpEndNeuronId (int g) |
int | grpNumNeurons (int g) |
int | grpStartNeuronId (int g) |
void | plotProbes () |
void | printConnection (const string &fname) |
void | printConnection (FILE *fp=stdout) |
void | printConnection (int grpId, FILE *fp=stdout) |
print the connection info of grpId | |
void | printConnectionInfo (FILE *fp) |
void | printConnectionInfo2 (FILE *fpg) |
void | printDotty () |
prints a network graph using Dotty (GraphViz) | |
void | printFiringRate (char *fname=NULL) |
void | printGroupInfo (FILE *fp) |
void | printGroupInfo (string &strName) |
void | printGroupInfo2 (FILE *fpg) |
void | printMemoryInfo (FILE *fp=stdout) |
prints memory info to file | |
void | printNetworkInfo () |
void | printNeuronState (int grpId, FILE *fp=stderr) |
void | printNeuronStateBinary (string fname, int grpId, int configId=0, int count=-1) |
Debugging function that outputs regular neuron state variables to a binary file at every timestep. Warning: drastically reduces speed of simulation. Only use for debugging purposes. | |
void | printParameters (FILE *fp) |
void | printPostConnection (FILE *fp=stdout) |
print all the connections... | |
void | printPostConnection (int grpId, FILE *fp=stdout) |
int | printPostConnection2 (int grpId, FILE *fpg) |
void | printPreConnection (FILE *fp=stdout) |
void | printPreConnection (int grpId, FILE *fp=stdout) |
int | printPreConnection2 (int grpId, FILE *fpg) |
void | printSimSummary (FILE *fp=stdout) |
prints a simulation summary to file | |
void | printState (const char *str="") |
void | printTuningLog () |
void | printWeight (int grpId, const char *str="") |
void | readNetwork (FILE *fid) |
reads the network state from file | |
int | readNetwork_internal (bool onlyPlastic) |
void | reassignFixedWeights (int connectId, float weightMatrix[], int matrixSize, int configId=ALL) |
Reassigns fixed weights to values passed into the function in a single 1D float matrix called weightMatrix. The user passes the connection ID (connectID), the weightMatrix, the matrixSize, and configuration ID (configID). This function only works for fixed synapses. | |
void | resetSpikeCnt (int grpId=-1) |
Resets the spike count for a particular group. | |
void | resetSpikeCnt_GPU (int _startGrp, int _endGrp) |
Utility function to clear spike counts in the GPU code. | |
void | resetSpikeCntUtil (int grpId=-1) |
Resets the spike count for a particular neuron group. Input: group ID variable named grpID. Output: none. | |
int | runNetwork (int _nsec, int _tstep=0, int simType=CPU_MODE, int ithGPU=0, bool enablePrint=false, int copyState=false) |
run the simulation for n sec simType can either be CPU_MODE or GPU_MODE ithGPU: specify on which CUDA device to establish a context | |
void | setBaseFiring (int groupId, int configId, float _baseFiring, float _baseFiringSD) |
Sets the homeostatic target firing rate. Neurons will try to attain this firing rate using homeostatic synaptic scaling. | |
void | setConductances (int g, bool enable, int configId=ALL) |
void | setConductances (int g, bool enable, float tAMPA, float tNMDA, float tGABAa, float tGABAb, int configId=ALL) |
void | setCopyFiringStateFromGPU (bool _enableGPUSpikeCntPtr) |
Sets enableGpuSpikeCntPtr to true or false. True allows getSpikeCntPtr_GPU to copy firing state information from GPU kernel to cpuNetPtrs. Warning: setting this flag to true will slow down the simulation significantly. | |
void | setGroupInfo (int groupId, group_info_t info, int configId=ALL) |
void | setHomeostasis (int g, bool enable, int configId=0) |
Sets the homeostasis parameters. g is the grpID, enable=true(false) enables(disables) homeostasis, and configId is the configuration ID that homeostasis will be enabled/disabled. | |
void | setHomeostasis (int g, bool enable, float homeostasisScale, float avgTimeScale, int configId=0) |
Sets the homeostasis parameters. g is the grpID, enable=true(false) enables(disables) homeostasis, configId is the configuration ID that homeostasis will be enabled/disabled, homeostasisScale is strength of homeostasis compared to the strength of normal LTP/LTD from STDP (which is 1), and avgTimeScale is the time frame over which the average firing rate is averaged (it should be larger in scale than STDP timescales). | |
void | setLogCycle (unsigned int _cnt, int mode=0, FILE *fp=NULL) |
sets the update cycle for log messages | |
void | setNeuronParameters (int groupId, float _a, float a_sd, float _b, float b_sd, float _c, float c_sd, float _d, float d_sd, int configId=ALL) |
Sets the Izhikevich parameters a, b, c, and d of a neuron group. More... | |
void | setNeuronParameters (int groupId, float _a, float _b, float _c, float _d, int configId=ALL) |
Sets the Izhikevich parameters a, b, c, and d of a neuron group. | |
void | setNeuronParameters (int groupId, IzhGenerator *IzhGen, int configId=ALL) |
void | setPrintState (int grpId, bool _status, int neuronId=-1) |
void | setProbe (int g, const string &type, int startId=0, int cnt=1, uint32_t _printProbe=0) |
void | setSimLogs (bool enable, string logDirName="") |
void | setSpikeGenerator (int grpId, SpikeGenerator *spikeGen, int configId=ALL) |
void | setSpikeMonitor (int gid, SpikeMonitor *spikeMon=NULL, int configId=ALL) |
void | setSpikeMonitor (int gid, const string &fname, int configId=0) |
a simple wrapper that uses a predetermined callback to save the data to a file | |
void | setSpikeRate (int grpId, PoissonRate *spikeRate, int refPeriod=1, int configId=ALL) |
void | setSpikeRateUpdated () |
void | setSTDP (int grpId, bool enable, int configId=ALL) |
void | setSTDP (int grpId, bool enable, float _ALPHA_LTP, float _TAU_LTP, float _ALPHA_LTD, float _TAU_LTD, int configId=ALL) |
void | setStepFeedback (StepFeedback *feedback) |
void | setSTP (int g, bool enable, int configId=ALL) |
void | setSTP (int g, bool enable, float STP_U, float STP_tD, float STP_tF, int configId=ALL) |
void | setTuningLog (string fname) |
void | showDottyViewer (int _f) |
void | showGroupStatus (int _f) |
void | updateNetwork (bool resetFiringInfo, bool resetWeights) |
Resets either the neuronal firing rate information by setting resetFiringRate = true and/or the weight values back to their default values by setting resetWeights = true. | |
void | updateNetwork () |
Original updateNetwork() function used by JMN. | |
void | updateNetwork_GPU (bool resetFiringInfo) |
bool | updateTime () |
returns true when a new second is started | |
void | writeNetwork (FILE *fid) |
stores the pre and post synaptic neuron ids with the weight and delay | |
void | writePopWeights (string fname, int gIDpre, int gIDpost, int configId=0) |
function writes population weights from gIDpre to gIDpost to file fname in binary. | |
Static Public Attributes | |
static const unsigned int | MAJOR_VERSION = 2 |
major release version, as in CARLsim X | |
static const unsigned int | MINOR_VERSION = 3 |
minor release version, as in CARLsim 2.X | |
Contains all of CARLsim's core functionality.
This is a more elaborate description of our main class.
void CpuSNN::copyUpdateVariables_GPU | ( | ) |
Copies synaptic weight information, neuronal state information, and STP state information from the host to the device (GPU).
Referenced by reassignFixedWeights().
void CpuSNN::CpuSNNInit | ( | unsigned int | _numN, |
unsigned int | _numPostSynapses, | ||
unsigned int | _numPreSynapses, | ||
unsigned int | _D | ||
) |
homeostasis variables
< Temporary array to store the delays of each connection
< Possible delay values are 0....D (inclusive of D)
Temporary array to hold pre-syn connections. will be deleted later if necessary
Definition at line 159 of file snn_cpu.cpp.
|
inline |
void CpuSNN::setNeuronParameters | ( | int | groupId, |
float | _a, | ||
float | a_sd, | ||
float | _b, | ||
float | b_sd, | ||
float | _c, | ||
float | c_sd, | ||
float | _d, | ||
float | d_sd, | ||
int | configId = ALL |
||
) |
Sets the Izhikevich parameters a, b, c, and d of a neuron group.
Parameter values for each neuron are given by a normal distribution with mean _a, _b, _c, _d standard deviation a_sd, b_sd, c_sd, and d_sd, respectively.
Definition at line 923 of file snn_cpu.cpp.
Referenced by setNeuronParameters().
void CpuSNN::setSpikeMonitor | ( | int | gid, |
SpikeMonitor * | spikeMon = NULL , |
||
int | configId = ALL |
||
) |
sets up a spike monitor registered with a callback to process the spikes, there can only be one SpikeMonitor per group
Definition at line 3981 of file snn_cpu.cpp.
Referenced by setSpikeMonitor().
void CpuSNN::updateNetwork_GPU | ( | bool | resetFiringInfo | ) |
Allows parameters to be reset in the middle of the simulation. This component is required for the GPU version.
Referenced by updateNetwork().