CARLsim
5.0.0
CARLsim: a GPU-accelerated SNN simulator
|
Go to the documentation of this file.
79 #if defined(WIN32) || defined(WIN64)
86 #define isnan(x) _isnan(x)
90 #define isinf(x) (!_finite(x))
94 #define srand48(x) srand(x)
98 #define drand48() (double(rand())/RAND_MAX)
104 #include <sys/stat.h>
247 short int connect(
int grpId1,
int grpId2,
const std::string& connType,
const RangeWeight& wt,
float connProb,
249 float mulSynFast=1.0f,
float mulSynSlow=1.0f);
386 void setConductances(
bool isSet,
int tdAMPA,
int tdNMDA,
int tdGABAa,
int tdGABAb);
408 void setConductances(
bool isSet,
int tdAMPA,
int trNMDA,
int tdNMDA,
int tdGABAa,
int trGABAb,
int tdGABAb);
438 void setHomeostasis(
int grpId,
bool isSet,
float homeoScale,
float avgTimeScale);
508 void setNeuronParameters(
int grpId,
float izh_a,
float izh_a_sd,
float izh_b,
float izh_b_sd,
509 float izh_c,
float izh_c_sd,
float izh_d,
float izh_d_sd);
539 float izh_a,
float izh_b,
float izh_vpeak,
float izh_c,
float izh_d);
570 void setNeuronParameters(
int grpId,
float izh_C,
float izh_C_sd,
float izh_k,
float izh_k_sd,
571 float izh_vr,
float izh_vr_sd,
float izh_vt,
float izh_vt_sd,
572 float izh_a,
float izh_a_sd,
float izh_b,
float izh_b_sd,
573 float izh_vpeak,
float izh_vpeak_sd,
float izh_c,
float izh_c_sd,
574 float izh_d,
float izh_d_sd);
615 void setNeuromodulator(
int grpId,
float baseDP,
float tauDP,
float base5HT,
float tau5HT,
616 float baseACh,
float tauACh,
float baseNE,
float tauNE);
627 float tauACh = 100.0f,
float tauNE = 100.0f);
638 void setSTDP(
int grpId,
bool isSet);
649 void setSTDP(
int grpId,
bool isSet,
STDPType type,
float alphaPlus,
float tauPlus,
float alphaMinus,
float tauMinus);
660 void setESTDP(
int grpId,
bool isSet);
701 void setISTDP(
int grpId,
bool isSet);
762 void setSTP(
int grpId,
bool isSet,
float STP_U,
float STP_tau_u,
float STP_tau_x);
785 void setSTP(
int grpId,
bool isSet);
808 int runNetwork(
int nSec,
int nMsec=0,
bool printRunSummary=
true);
841 void saveSimulation(
const std::string& fileName,
bool saveSynapseInfo=
true);
877 void setLogsFpCustom(FILE* fpInf=NULL, FILE* fpErr=NULL, FILE* fpDeb=NULL, FILE* fpLog=NULL);
905 void biasWeights(
short int connId,
float bias,
bool updateWeightRange=
false);
969 void scaleWeights(
short int connId,
float scale,
bool updateWeightRange=
false);
1263 void setWeight(
short int connId,
int neurIdPre,
int neurIdPost,
float weight,
bool updateWeightRange=
false);
1386 uint8_t*
getDelays(
int gIDpre,
int gIDpost,
int& Npre,
int& Npost);
void setExternalCurrent(int grpId, const std::vector< float > ¤t)
Sets the amount of current (mA) to inject into a group.
int getNumNeuronsRegExc()
returns the total number of regular (Izhikevich) excitatory neurons
int createSpikeGeneratorGroup(const std::string &grpName, int nNeur, int neurType, int preferredPartition=ANY, ComputingBackend preferredBackend=CPU_CORES)
creates a spike generator group
void stopTesting()
Exits a testing phase, making weight changes possible again.
integrationMethod_t
Integration methods.
std::string getGroupName(int grpId)
gets group name
void setSTP(int grpId, bool isSet, float STP_U, float STP_tau_u, float STP_tau_x)
Sets STP params U, tau_u, and tau_x of a neuron group (pre-synaptically)
void setDefaultSaveOptions(std::string fileName, bool saveSynapseInfo)
Sets default options for save file.
GroupNeuromodulatorInfo getGroupNeuromodulatorInfo(int grpId)
returns the neuromodulator information of a group specified by grpId
void setDefaultConductanceTimeConstants(int tdAMPA, int trNMDA, int tdNMDA, int tdGABAa, int trGABAb, int tdGABAb)
Sets default values for conductance time constants.
a range struct for synaptic weight magnitudes
std::vector< float > getConductanceGABAb(int grpId)
gets GABAb vector of a group
Point3D getNeuronLocation3D(int neurId)
returns the 3D location a neuron codes for
int runNetwork(int nSec, int nMsec=0, bool printRunSummary=true)
run the simulation for time=(nSec*seconds + nMsec*milliseconds)
void biasWeights(short int connId, float bias, bool updateWeightRange=false)
Adds a constant bias to the weight of every synapse in the connection.
void startTesting(bool updateWeights=true)
Enters a testing phase in which all weight changes are disabled.
int getNumSynapses()
returns the total number of allocated synaptic connections in the network
void setConductances(bool isSet)
Sets default values for conduction decay and rise times or disables COBA alltogether.
int getNumNeuronsReg()
returns the total number of regular (Izhikevich) neurons
int getSimTimeMsec()
returns
void scaleWeights(short int connId, float scale, bool updateWeightRange=false)
reset Spike Counter to zero
short int connectCompartments(int grpIdLower, int grpIdUpper)
make a compartmental connection between two compartmentally enabled groups Note: all compartmentally ...
int getNumNeurons()
returns the total number of allocated neurons in the network
void setDefaultESTDPparams(float alphaPlus, float tauPlus, float alphaMinus, float tauMinus, STDPType stdpType)
sets default values for E-STDP params
CARLsimState
CARLsim states.
const FILE * getLogFpDeb()
returns file pointer to debug log
void setNeuronParametersLIF(int grpId, int tau_m, int tau_ref=0, float vTh=1.0f, float vReset=0.0f, const RangeRmem &rMem=RangeRmem(1.0f))
Sets neuron parameters for a group of LIF spiking neurons.
void setCompartmentParameters(int grpId, float couplingUp, float couplingDown)
Sets coupling constants G_u and G_d for the compartment.
void saveSimulation(const std::string &fileName, bool saveSynapseInfo=true)
Saves important simulation and network infos to file.
int getNumGroups()
returns the number of groups in the network
A struct for retrieving STDP related information of a group.
void setLogFile(const std::string &fileName)
Sets the name of the log file.
void setDefaultSTDPparams(float alphaPlus, float tauPlus, float alphaMinus, float tauMinus, STDPType stdpType)
sets default STDP params
void setHomeoBaseFiringRate(int grpId, float baseFiring, float baseFiringSD=0.0f)
Sets the homeostatic target firing rate (enforced through homeostatic synaptic scaling)
struct to assign a pulse I-STDP curve
GroupMonitor * setGroupMonitor(int grpId, const std::string &fname)
Sets a group monitor for a group, custom GroupMonitor class.
Class for generating Poisson spike trains.
ConnectionMonitor * setConnectionMonitor(int grpIdPre, int grpIdPost, const std::string &fname)
Sets a connection monitor for a group, custom ConnectionMonitor class.
int getNumNeuronsRegInh()
returns the total number of regular (Izhikevich) inhibitory neurons
int getGroupStartNeuronId(int grpId)
returns the first neuron id of a groupd specified by grpId
@ USER
User mode, for experiment-oriented simulations.
std::vector< float > getConductanceGABAa(int grpId)
gets GABAa vector of a group
void setSpikeRate(int grpId, PoissonRate *spikeRate, int refPeriod=1)
Sets a spike rate.
void setWeight(short int connId, int neurIdPre, int neurIdPost, float weight, bool updateWeightRange=false)
Sets the weight value of a specific synapse.
void setSpikeGenerator(int grpId, SpikeGenerator *spikeGenFunc)
A SpikeCounter keeps track of the number of spikes per neuron in a group.
void setDefaultISTDPparams(float betaLTP, float betaLTD, float lambda, float delta, STDPType stdpType)
sets default values for I-STDP params
std::vector< float > getConductanceAMPA(int grpId)
gets AMPA vector of a group
bool isExcitatoryGroup(int grpId)
returns
A struct to assign a timing-based E-STDP curve.
const FILE * getLogFpErr()
returns file pointer to error log
void setupNetwork()
build the network
GroupSTDPInfo getGroupSTDPInfo(int grpId)
returns the stdp information of a group specified by grpId
void setISTDP(int grpId, bool isSet)
Sets default I-STDP mode and parameters.
a range struct for synaptic delays
void setNeuronParameters(int grpId, float izh_a, float izh_a_sd, float izh_b, float izh_b_sd, float izh_c, float izh_c_sd, float izh_d, float izh_d_sd)
Sets Izhikevich params a, b, c, and d with as mean +- standard deviation.
void setIntegrationMethod(integrationMethod_t method, int numStepsPerMs)
void setHomeostasis(int grpId, bool isSet, float homeoScale, float avgTimeScale)
Sets custom values for implementation of homeostatic synaptic scaling.
RangeDelay getDelayRange(short int connId)
returns the RangeDelay struct for a specific connection ID
std::vector< float > getConductanceNMDA(int grpId)
gets NMDA vector of a group
uint8_t * getDelays(int gIDpre, int gIDpost, int &Npre, int &Npost)
gets delays
void setSTDP(int grpId, bool isSet)
Sets default STDP mode and params.
int getNumSynapticConnections(short int connectionId)
returns the number of connections associated with a connection ID
ComputingBackend
computing backend
const FILE * getLogFpInf()
returns file pointer to info log
bool isInhibitoryGroup(int grpId)
returns
@ CPU_MODE
model is run on CPU core(s)
SpikeMonitor * getSpikeMonitor(int grpId)
Returns the number of spikes per neuron for a certain group.
int getSimTimeSec()
returns
CARLsim User Interface This class provides a user interface to the public sections of CARLsimCore sou...
RangeWeight getWeightRange(short int connId)
returns the RangeWeight struct for a specific connection ID
A struct to assign exponential STDP curves.
short int connect(int grpId1, int grpId2, const std::string &connType, const RangeWeight &wt, float connProb, const RangeDelay &delay=RangeDelay(1), const RadiusRF &radRF=RadiusRF(-1.0), bool synWtType=SYN_FIXED, float mulSynFast=1.0f, float mulSynSlow=1.0f)
Connects a presynaptic to a postsynaptic group using fixed/plastic weights and a range of delay value...
bool isGroupWithHomeostasis(int grpId)
Returns whether a group has homeostasis enabled.
A struct to arrange neurons on a 3D grid (a primitive cubic Bravais lattice with cubic side length 1)
void setESTDP(int grpId, bool isSet)
Sets default E-STDP mode and parameters.
Grid3D getGroupGrid3D(int grpId)
returns the 3D grid struct of a group
CARLsimState getCARLsimState()
Writes population weights from gIDpre to gIDpost to file fname in binary.
int getNumNeuronsGenExc()
returns the total number of excitatory spike generator neurons
Struct defines the minimum and maximum membrane resisatnces of the LIF neuron group.
int getGroupNumNeurons(int grpId)
returns the number of neurons of a group specified by grpId
NeuronMonitor * setNeuronMonitor(int grpId, const std::string &fileName)
Sets a Neuron Monitor for a groups, print voltage, recovery, and total current values to binary file.
CARLsim(const std::string &netName="SNN", SimMode preferredSimMode=CPU_MODE, LoggerMode loggerMode=USER, int ithGPUs=0, int randSeed=-1)
CARLsim constructor. Creates a new instance of class CARLsim. All input arguments are optional,...
bool isPoissonGroup(int grpId)
returns
void loadSimulation(FILE *fid)
Loads a simulation (and network state) from file. The file pointer fid must point to a valid CARLsim ...
void setDefaultSTPparams(int neurType, float STP_U, float STP_tau_u, float STP_tau_x)
Sets default values for STP params U, tau_u, and tau_x of a neuron group (pre-synaptically)
int getNumConnections()
Returns the number of connections (pairs of pre-post groups) in the network.
void setLogsFpCustom(FILE *fpInf=NULL, FILE *fpErr=NULL, FILE *fpDeb=NULL, FILE *fpLog=NULL)
Sets the file pointers for all log files in CUSTOM mode.
void setDefaultHomeostasisParams(float homeoScale, float avgTimeScale)
Sets default homeostasis params.
A struct for retrieving neuromodulator information of a group.
int getNumNeuronsGen()
returns the total number of spike generator neurons
int getGroupEndNeuronId(int grpId)
returns the last neuron id of a groupd specified by grpId
UpdateInterval
Update frequency for weights.
SpikeMonitor * setSpikeMonitor(int grpId, const std::string &fileName)
Sets a Spike Monitor for a groups, prints spikes to binary file.
void setNeuromodulator(int grpId, float baseDP, float tauDP, float base5HT, float tau5HT, float baseACh, float tauACh, float baseNE, float tauNE)
Sets baseline concentration and decay time constant of neuromodulators (DP, 5HT, ACh,...
void setWeightAndWeightChangeUpdate(UpdateInterval wtANDwtChangeUpdateInterval, bool enableWtChangeDecay, float wtChangeDecay=0.9f)
Sets the weight and weight change update parameters.
int createGroupLIF(const std::string &grpName, int nNeur, int neurType, int preferredPartition=ANY, ComputingBackend preferredBackend=CPU_CORES)
creates a group of Leaky-Integrate-and-Fire (LIF) spiking neurons
bool isConnectionPlastic(short int connId)
Returns whether a connection is fixed or plastic.
A struct to specify the receptive field (RF) radius in 3 dimensions.
#define ANY
used for create* method to specify any GPU or a specific GPU
int getGroupId(std::string grpName)
finds the ID of the group with name grpName
int createGroup(const std::string &grpName, int nNeur, int neurType, int preferredPartition=ANY, ComputingBackend preferredBackend=CPU_CORES)
creates a group of Izhikevich spiking neurons
int getMaxNumCompConnections()
Returns the maximum number of allowed compartmental connections per group.
const FILE * getLogFpLog()
returns file pointer to log file
int getNumNeuronsGenInh()
returns the total number of inhibitory spike generator neurons