CARLsim  5.0.0
CARLsim: a GPU-accelerated SNN simulator
carlsim.h
Go to the documentation of this file.
1 /* * Copyright (c) 2016 Regents of the University of California. All rights reserved.
2 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions
5 * are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * 3. The names of its contributors may not be used to endorse or promote
15 * products derived from this software without specific prior written
16 * permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 * *********************************************************************************************** *
31 * CARLsim
32 * created by: (MDR) Micah Richert, (JN) Jayram M. Nageswaran
33 * maintained by:
34 * (MA) Mike Avery <averym@uci.edu>
35 * (MB) Michael Beyeler <mbeyeler@uci.edu>,
36 * (KDC) Kristofor Carlson <kdcarlso@uci.edu>
37 * (TSC) Ting-Shuo Chou <tingshuc@uci.edu>
38 * (HK) Hirak J Kashyap <kashyaph@uci.edu>
39 *
40 * CARLsim v1.0: JM, MDR
41 * CARLsim v2.0/v2.1/v2.2: JM, MDR, MA, MB, KDC
42 * CARLsim3: MB, KDC, TSC
43 * CARLsim4: TSC, HK
44 * CARLsim5: HK, JX, KC
45 *
46 * CARLsim available from http://socsci.uci.edu/~jkrichma/CARLsim/
47 * Ver 12/31/2016
48 */
49 
50 #ifndef _CARLSIM_H_
51 #define _CARLSIM_H_
52 
53 #include <stdint.h> // uint64_t, uint32_t, etc.
54 #include <string> // std::string
55 #include <vector> // std::vector
56 #include <algorithm>
57 
58 #include <carlsim_definitions.h>
59 #include <carlsim_datastructures.h>
60 
61 // include the following core functionalities instead of forward-declaring, so that the user only needs to include
62 // carlsim.h
63 #include <callback.h>
64 #include <poisson_rate.h>
65 #include <spike_monitor.h>
66 #include <neuron_monitor.h>
67 #include <connection_monitor.h>
68 #include <group_monitor.h>
69 #include <linear_algebra.h>
70 
71 class GroupMonitor;
72 class ConnectionMonitor;
73 class SpikeMonitor;
74 class SpikeGenerator;
75 
76 
77 
78 // Cross-platform definition (Linux, Windows)
79 #if defined(WIN32) || defined(WIN64)
80 #include <Windows.h>
81 
82 #include <float.h>
83 #include <time.h>
84 
85 #ifndef isnan
86 #define isnan(x) _isnan(x)
87 #endif
88 
89 #ifndef isinf
90 #define isinf(x) (!_finite(x))
91 #endif
92 
93 #ifndef srand48
94 #define srand48(x) srand(x)
95 #endif
96 
97 #ifndef drand48
98 #define drand48() (double(rand())/RAND_MAX)
99 #endif
100 
101 #else
102 
103 #include <pthread.h> // pthread
104 #include <sys/stat.h> // mkdir
105 #include <unistd.h> //unix thread affinity macros
106 
107 
108 #endif
109 
110 
111 
138 class CARLsim {
139 public:
140  // +++++ PUBLIC METHODS: CONSTRUCTOR / DESTRUCTOR +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
141 
175  CARLsim(const std::string& netName = "SNN", SimMode preferredSimMode = CPU_MODE, LoggerMode loggerMode = USER, int ithGPUs = 0, int randSeed = -1);
176  ~CARLsim();
177 
178 
179 
180  // +++++ PUBLIC METHODS: SETTING UP A SIMULATION ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
181 
247  short int connect(int grpId1, int grpId2, const std::string& connType, const RangeWeight& wt, float connProb,
248  const RangeDelay& delay=RangeDelay(1), const RadiusRF& radRF=RadiusRF(-1.0), bool synWtType=SYN_FIXED,
249  float mulSynFast=1.0f, float mulSynSlow=1.0f);
250 
258  short int connect(int grpId1, int grpId2, ConnectionGenerator* conn, bool synWtType=SYN_FIXED);
259 
266  short int connect(int grpId1, int grpId2, ConnectionGenerator* conn, float mulSynFast, float mulSynSlow,
267  bool synWtType=SYN_FIXED);
268 
277  short int connectCompartments(int grpIdLower, int grpIdUpper);
278 
279 
285  int createGroup(const std::string& grpName, int nNeur, int neurType, int preferredPartition = ANY, ComputingBackend preferredBackend = CPU_CORES);
286 
292  int createGroupLIF(const std::string& grpName, int nNeur, int neurType, int preferredPartition = ANY, ComputingBackend preferredBackend = CPU_CORES);
293 
315  int createGroup(const std::string& grpName, const Grid3D& grid, int neurType, int preferredPartition = ANY, ComputingBackend preferredBackend = CPU_CORES);
316 
327  int createGroupLIF(const std::string& grpName, const Grid3D& grid, int neurType, int preferredPartition = ANY, ComputingBackend preferredBackend = CPU_CORES);
328 
334  int createSpikeGeneratorGroup(const std::string& grpName, int nNeur, int neurType, int preferredPartition = ANY, ComputingBackend preferredBackend = CPU_CORES);
335 
352  int createSpikeGeneratorGroup(const std::string& grpName, const Grid3D& grid, int neurType, int preferredPartition = ANY, ComputingBackend preferredBackend = CPU_CORES);
353 
354 
368  void setConductances(bool isSet);
369 
386  void setConductances(bool isSet, int tdAMPA, int tdNMDA, int tdGABAa, int tdGABAb);
387 
408  void setConductances(bool isSet, int tdAMPA, int trNMDA, int tdNMDA, int tdGABAa, int trGABAb, int tdGABAb);
409 
438  void setHomeostasis(int grpId, bool isSet, float homeoScale, float avgTimeScale);
439 
454  void setHomeostasis(int grpId, bool isSet);
455 
473  void setHomeoBaseFiringRate(int grpId, float baseFiring, float baseFiringSD=0.0f);
474 
475  /*
476  * \brief Sets the integration method for the simulation
477  *
478  * This function specifies the integration method for the simulation. Currently, the chosen integration method
479  * will apply to all neurons in the network.
480  *
481  * The basic simulation time step is 1ms, meaning that spike times cannot be retrieved with sub-millisecond
482  * precision. However, the integration time step can be lower than 1ms, which is specified by numStepsPerMs.
483  * A numStepsPerMs set to 10 would take 10 integration steps per 1ms simulation time step.
484  *
485  * By default, the simulation will use Forward-Euler with an integration step of 0.5ms (i.e.,
486  * <tt>numStepsPerMs</tt>=2).
487  *
488  * Currently CARLsim supports the following integration methods:
489  * - FORWARD_EULER: The most basic, forward-Euler method. Suggested value for <tt>numStepsPerMs</tt>: >= 2.
490  * - RUNGE_KUTTA4: Fourth-order Runge-Kutta (aka classical Runge-Kutta, aka RK4).
491  * Suggested value for <tt>numStepsPerMs</tt>: >= 10.
492  *
493  * \STATE ::CONFIG_STATE
494  * \param[in] method the integration method to use
495  * \param[in] numStepsPerMs the number of integration steps per 1ms simulation time step
496  *
497  * \note Note that the higher numStepsPerMs the slower the simulation may be, due to increased computational load.
498  * \since v3.1
499  */
500  void setIntegrationMethod(integrationMethod_t method, int numStepsPerMs);
501 
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);
510 
517  void setNeuronParameters(int grpId, float izh_a, float izh_b, float izh_c, float izh_d);
518 
538  void setNeuronParameters(int grpId, float izh_C, float izh_k, float izh_vr, float izh_vt,
539  float izh_a, float izh_b, float izh_vpeak, float izh_c, float izh_d);
540 
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);
575 
587  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));
588 
598  void setCompartmentParameters(int grpId, float couplingUp, float couplingDown);
599 
615  void setNeuromodulator(int grpId, float baseDP, float tauDP, float base5HT, float tau5HT,
616  float baseACh, float tauACh, float baseNE, float tauNE);
617 
626  void setNeuromodulator(int grpId, float tauDP = 100.0f, float tau5HT = 100.0f,
627  float tauACh = 100.0f, float tauNE = 100.0f);
628 
638  void setSTDP(int grpId, bool isSet);
639 
649  void setSTDP(int grpId, bool isSet, STDPType type, float alphaPlus, float tauPlus, float alphaMinus, float tauMinus);
650 
660  void setESTDP(int grpId, bool isSet);
661 
675  void setESTDP(int grpId, bool isSet, STDPType type, ExpCurve curve);
676 
690  void setESTDP(int grpId, bool isSet, STDPType type, TimingBasedCurve curve);
691 
701  void setISTDP(int grpId, bool isSet);
702 
716  void setISTDP(int grpId, bool isSet, STDPType type, ExpCurve curve);
717 
731  void setISTDP(int grpId, bool isSet, STDPType type, PulseCurve curve);
732 
762  void setSTP(int grpId, bool isSet, float STP_U, float STP_tau_u, float STP_tau_x);
763 
785  void setSTP(int grpId, bool isSet);
786 
795  void setWeightAndWeightChangeUpdate(UpdateInterval wtANDwtChangeUpdateInterval, bool enableWtChangeDecay, float wtChangeDecay=0.9f);
796 
797 
798  // +++++ PUBLIC METHODS: RUNNING A SIMULATION ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
799 
808  int runNetwork(int nSec, int nMsec=0, bool printRunSummary=true);
809 
815  void setupNetwork();
816 
817  // +++++ PUBLIC METHODS: LOGGING / PLOTTING +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
818 
819  const FILE* getLogFpInf();
820  const FILE* getLogFpErr();
821  const FILE* getLogFpDeb();
822  const FILE* getLogFpLog();
823 
841  void saveSimulation(const std::string& fileName, bool saveSynapseInfo=true);
842 
857  void setLogFile(const std::string& fileName);
858 
877  void setLogsFpCustom(FILE* fpInf=NULL, FILE* fpErr=NULL, FILE* fpDeb=NULL, FILE* fpLog=NULL);
878 
879 
880 
881  // +++++ PUBLIC METHODS: INTERACTING WITH A SIMULATION ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
882 
905  void biasWeights(short int connId, float bias, bool updateWeightRange=false);
906 
926  void loadSimulation(FILE* fid);
927 
945  //void resetSpikeCounter(int grpId);
946 
969  void scaleWeights(short int connId, float scale, bool updateWeightRange=false);
970 
1003  ConnectionMonitor* setConnectionMonitor(int grpIdPre, int grpIdPost, const std::string& fname);
1004 
1042  void setExternalCurrent(int grpId, const std::vector<float>& current);
1043 
1072  void setExternalCurrent(int grpId, float current);
1073 
1080  GroupMonitor* setGroupMonitor(int grpId, const std::string& fname);
1081 
1106  //void setSpikeCounter(int grpId, int recordDur=-1);
1107 
1127  void setSpikeGenerator(int grpId, SpikeGenerator* spikeGenFunc);
1128 
1171  SpikeMonitor* setSpikeMonitor(int grpId, const std::string& fileName);
1172 
1215  NeuronMonitor* setNeuronMonitor(int grpId, const std::string& fileName);
1216 
1234  void setSpikeRate(int grpId, PoissonRate* spikeRate, int refPeriod=1);
1235 
1263  void setWeight(short int connId, int neurIdPre, int neurIdPost, float weight, bool updateWeightRange=false);
1264 
1286  void startTesting(bool updateWeights=true);
1287 
1300  void stopTesting();
1301 
1308  //void writePopWeights(std::string fname, int gIDpre, int gIDpost);
1309 
1310 
1311 
1312  // +++++ PUBLIC METHODS: GETTERS / SETTERS +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
1313 
1330 
1338  std::vector<float> getConductanceAMPA(int grpId);
1339 
1347  std::vector<float> getConductanceNMDA(int grpId);
1348 
1356  std::vector<float> getConductanceGABAa(int grpId);
1357 
1365  std::vector<float> getConductanceGABAb(int grpId);
1366 
1378  RangeDelay getDelayRange(short int connId);
1379 
1386  uint8_t* getDelays(int gIDpre, int gIDpost, int& Npre, int& Npost);
1387 
1388  // FIXME: This function is called in SNN::connect() at CONFIG_STATE, which violate the restriction
1401  Grid3D getGroupGrid3D(int grpId);
1402 
1409  int getGroupId(std::string grpName);
1410 
1417  std::string getGroupName(int grpId);
1418 
1437  Point3D getNeuronLocation3D(int neurId);
1438 
1446 
1468  Point3D getNeuronLocation3D(int grpId, int relNeurId);
1469 
1479  int getNumConnections();
1480 
1487  int getNumSynapticConnections(short int connectionId);
1488 
1496  int getNumGroups();
1497 
1505  int getNumNeurons();
1506 
1514  int getNumNeuronsReg();
1515 
1523  int getNumNeuronsRegExc();
1524 
1532  int getNumNeuronsRegInh();
1533 
1541  int getNumNeuronsGen();
1542 
1550  int getNumNeuronsGenExc();
1551 
1559  int getNumNeuronsGenInh();
1560 
1567  int getNumSynapses();
1568 
1575  int getGroupStartNeuronId(int grpId);
1576 
1583  int getGroupEndNeuronId(int grpId);
1584 
1591  int getGroupNumNeurons(int grpId);
1592 
1600  GroupSTDPInfo getGroupSTDPInfo(int grpId);
1601 
1611 
1618  int getSimTime();
1619 
1626  int getSimTimeSec();
1627 
1634  int getSimTimeMsec();
1635 
1676  //int* getSpikeCounter(int grpId);
1677 
1689  SpikeMonitor* getSpikeMonitor(int grpId);
1690 
1702  RangeWeight getWeightRange(short int connId);
1703 
1713  bool isConnectionPlastic(short int connId);
1714 
1724  bool isGroupWithHomeostasis(int grpId);
1725 
1732  bool isExcitatoryGroup(int grpId);
1733 
1740  bool isInhibitoryGroup(int grpId);
1741 
1748  bool isPoissonGroup(int grpId);
1749 
1750  // +++++ PUBLIC METHODS: SET DEFAULTS +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
1751 
1763  void setDefaultConductanceTimeConstants(int tdAMPA, int trNMDA, int tdNMDA, int tdGABAa, int trGABAb, int tdGABAb);
1764 
1771  void setDefaultHomeostasisParams(float homeoScale, float avgTimeScale);
1772 
1779  void setDefaultSaveOptions(std::string fileName, bool saveSynapseInfo);
1780 
1789  void setDefaultSTDPparams(float alphaPlus, float tauPlus, float alphaMinus, float tauMinus, STDPType stdpType);
1790 
1799  void setDefaultESTDPparams(float alphaPlus, float tauPlus, float alphaMinus, float tauMinus, STDPType stdpType);
1800 
1809  void setDefaultISTDPparams(float betaLTP, float betaLTD, float lambda, float delta, STDPType stdpType);
1810 
1832  void setDefaultSTPparams(int neurType, float STP_U, float STP_tau_u, float STP_tau_x);
1833 
1834 
1835 private:
1836  // This class provides a pImpl for the CARLsim User API.
1837  // \see https://marcmutz.wordpress.com/translated-articles/pimp-my-pimpl/
1838  class Impl;
1839  Impl* _impl;
1840 };
1841 #endif
CARLsim::setExternalCurrent
void setExternalCurrent(int grpId, const std::vector< float > &current)
Sets the amount of current (mA) to inject into a group.
Definition: carlsim.cpp:1955
CARLsim::getNumNeuronsRegExc
int getNumNeuronsRegExc()
returns the total number of regular (Izhikevich) excitatory neurons
Definition: carlsim.cpp:2053
CARLsim::createSpikeGeneratorGroup
int createSpikeGeneratorGroup(const std::string &grpName, int nNeur, int neurType, int preferredPartition=ANY, ComputingBackend preferredBackend=CPU_CORES)
creates a spike generator group
Definition: carlsim.cpp:1780
CARLsim::stopTesting
void stopTesting()
Exits a testing phase, making weight changes possible again.
Definition: carlsim.cpp:1996
SimMode
SimMode
simulation mode
Definition: carlsim_datastructures.h:114
integrationMethod_t
integrationMethod_t
Integration methods.
Definition: carlsim_datastructures.h:133
ConnectionGenerator
Definition: callback.h:91
CARLsim::getGroupName
std::string getGroupName(int grpId)
gets group name
Definition: carlsim.cpp:2027
CARLsim::setSTP
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)
Definition: carlsim.cpp:1894
CARLsim::setDefaultSaveOptions
void setDefaultSaveOptions(std::string fileName, bool saveSynapseInfo)
Sets default options for save file.
Definition: carlsim.cpp:2123
CARLsim::getGroupNeuromodulatorInfo
GroupNeuromodulatorInfo getGroupNeuromodulatorInfo(int grpId)
returns the neuromodulator information of a group specified by grpId
Definition: carlsim.cpp:2083
CARLsim::setDefaultConductanceTimeConstants
void setDefaultConductanceTimeConstants(int tdAMPA, int trNMDA, int tdNMDA, int tdGABAa, int trGABAb, int tdGABAb)
Sets default values for conductance time constants.
Definition: carlsim.cpp:2111
RangeWeight
a range struct for synaptic weight magnitudes
Definition: carlsim_datastructures.h:312
CARLsim::getConductanceGABAb
std::vector< float > getConductanceGABAb(int grpId)
gets GABAb vector of a group
Definition: carlsim.cpp:2011
spike_monitor.h
SpikeMonitor
Class SpikeMonitor.
Definition: spike_monitor.h:120
CARLsim::getNeuronLocation3D
Point3D getNeuronLocation3D(int neurId)
returns the 3D location a neuron codes for
Definition: carlsim.cpp:2030
CARLsim::runNetwork
int runNetwork(int nSec, int nMsec=0, bool printRunSummary=true)
run the simulation for time=(nSec*seconds + nMsec*milliseconds)
Definition: carlsim.cpp:1910
CARLsim::biasWeights
void biasWeights(short int connId, float bias, bool updateWeightRange=false)
Adds a constant bias to the weight of every synapse in the connection.
Definition: carlsim.cpp:1937
CARLsim::startTesting
void startTesting(bool updateWeights=true)
Enters a testing phase in which all weight changes are disabled.
Definition: carlsim.cpp:1993
CARLsim::getNumSynapses
int getNumSynapses()
returns the total number of allocated synaptic connections in the network
Definition: carlsim.cpp:2068
CARLsim::setConductances
void setConductances(bool isSet)
Sets default values for conduction decay and rise times or disables COBA alltogether.
Definition: carlsim.cpp:1789
CARLsim::~CARLsim
~CARLsim()
Definition: carlsim.cpp:1737
CARLsim::getNumNeuronsReg
int getNumNeuronsReg()
returns the total number of regular (Izhikevich) neurons
Definition: carlsim.cpp:2050
carlsim_datastructures.h
CARLsim::getSimTimeMsec
int getSimTimeMsec()
returns
Definition: carlsim.cpp:2091
CARLsim::scaleWeights
void scaleWeights(short int connId, float scale, bool updateWeightRange=false)
reset Spike Counter to zero
Definition: carlsim.cpp:1945
CARLsim::connectCompartments
short int connectCompartments(int grpIdLower, int grpIdUpper)
make a compartmental connection between two compartmentally enabled groups Note: all compartmentally ...
Definition: carlsim.cpp:1756
CARLsim::Impl
Definition: carlsim.cpp:80
CARLsim::getNumNeurons
int getNumNeurons()
returns the total number of allocated neurons in the network
Definition: carlsim.cpp:2047
CARLsim::setDefaultESTDPparams
void setDefaultESTDPparams(float alphaPlus, float tauPlus, float alphaMinus, float tauMinus, STDPType stdpType)
sets default values for E-STDP params
Definition: carlsim.cpp:2133
CARLsimState
CARLsimState
CARLsim states.
Definition: carlsim_datastructures.h:260
CARLsim::getLogFpDeb
const FILE * getLogFpDeb()
returns file pointer to debug log
Definition: carlsim.cpp:1919
CARLsim::setNeuronParametersLIF
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.
Definition: carlsim.cpp:1841
CARLsim::setCompartmentParameters
void setCompartmentParameters(int grpId, float couplingUp, float couplingDown)
Sets coupling constants G_u and G_d for the compartment.
Definition: carlsim.cpp:1784
CARLsim::saveSimulation
void saveSimulation(const std::string &fileName, bool saveSynapseInfo=true)
Saves important simulation and network infos to file.
Definition: carlsim.cpp:1923
CARLsim::getNumGroups
int getNumGroups()
returns the number of groups in the network
Definition: carlsim.cpp:2044
callback.h
GroupSTDPInfo_s
A struct for retrieving STDP related information of a group.
Definition: carlsim_datastructures.h:412
CARLsim::setLogFile
void setLogFile(const std::string &fileName)
Sets the name of the log file.
Definition: carlsim.cpp:1928
CARLsim::setDefaultSTDPparams
void setDefaultSTDPparams(float alphaPlus, float tauPlus, float alphaMinus, float tauMinus, STDPType stdpType)
sets default STDP params
Definition: carlsim.cpp:2128
CARLsim::setHomeoBaseFiringRate
void setHomeoBaseFiringRate(int grpId, float baseFiring, float baseFiringSD=0.0f)
Sets the homeostatic target firing rate (enforced through homeostatic synaptic scaling)
Definition: carlsim.cpp:1806
PulseCurve
struct to assign a pulse I-STDP curve
Definition: carlsim_datastructures.h:650
CARLsim::setGroupMonitor
GroupMonitor * setGroupMonitor(int grpId, const std::string &fname)
Sets a group monitor for a group, custom GroupMonitor class.
Definition: carlsim.cpp:1963
PoissonRate
Class for generating Poisson spike trains.
Definition: poisson_rate.h:84
CARLsim::setConnectionMonitor
ConnectionMonitor * setConnectionMonitor(int grpIdPre, int grpIdPost, const std::string &fname)
Sets a connection monitor for a group, custom ConnectionMonitor class.
Definition: carlsim.cpp:1950
linear_algebra.h
CARLsim::getNumNeuronsRegInh
int getNumNeuronsRegInh()
returns the total number of regular (Izhikevich) inhibitory neurons
Definition: carlsim.cpp:2056
CARLsim::getGroupStartNeuronId
int getGroupStartNeuronId(int grpId)
returns the first neuron id of a groupd specified by grpId
Definition: carlsim.cpp:2071
USER
@ USER
User mode, for experiment-oriented simulations.
Definition: carlsim_datastructures.h:92
CARLsim::getConductanceGABAa
std::vector< float > getConductanceGABAa(int grpId)
gets GABAa vector of a group
Definition: carlsim.cpp:2008
CARLsim::setSpikeRate
void setSpikeRate(int grpId, PoissonRate *spikeRate, int refPeriod=1)
Sets a spike rate.
Definition: carlsim.cpp:1983
CARLsim::setWeight
void setWeight(short int connId, int neurIdPre, int neurIdPost, float weight, bool updateWeightRange=false)
Sets the weight value of a specific synapse.
Definition: carlsim.cpp:1988
CARLsim::setSpikeGenerator
void setSpikeGenerator(int grpId, SpikeGenerator *spikeGenFunc)
A SpikeCounter keeps track of the number of spikes per neuron in a group.
Definition: carlsim.cpp:1968
CARLsim::setDefaultISTDPparams
void setDefaultISTDPparams(float betaLTP, float betaLTD, float lambda, float delta, STDPType stdpType)
sets default values for I-STDP params
Definition: carlsim.cpp:2138
CARLsim::getConductanceAMPA
std::vector< float > getConductanceAMPA(int grpId)
gets AMPA vector of a group
Definition: carlsim.cpp:2002
CARLsim::isExcitatoryGroup
bool isExcitatoryGroup(int grpId)
returns
Definition: carlsim.cpp:2105
TimingBasedCurve
A struct to assign a timing-based E-STDP curve.
Definition: carlsim_datastructures.h:614
CARLsim::getLogFpErr
const FILE * getLogFpErr()
returns file pointer to error log
Definition: carlsim.cpp:1918
group_monitor.h
CARLsim::setupNetwork
void setupNetwork()
build the network
Definition: carlsim.cpp:1915
CARLsim::getGroupSTDPInfo
GroupSTDPInfo getGroupSTDPInfo(int grpId)
returns the stdp information of a group specified by grpId
Definition: carlsim.cpp:2080
CARLsim::setISTDP
void setISTDP(int grpId, bool isSet)
Sets default I-STDP mode and parameters.
Definition: carlsim.cpp:1881
RangeDelay
a range struct for synaptic delays
Definition: carlsim_datastructures.h:279
CARLsim::setNeuronParameters
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.
Definition: carlsim.cpp:1816
CARLsim::setIntegrationMethod
void setIntegrationMethod(integrationMethod_t method, int numStepsPerMs)
Definition: carlsim.cpp:1810
CARLsim::setHomeostasis
void setHomeostasis(int grpId, bool isSet, float homeoScale, float avgTimeScale)
Sets custom values for implementation of homeostatic synaptic scaling.
Definition: carlsim.cpp:1800
CARLsim::getDelayRange
RangeDelay getDelayRange(short int connId)
returns the RangeDelay struct for a specific connection ID
Definition: carlsim.cpp:2014
GroupMonitor
Class GroupMonitor.
Definition: group_monitor.h:104
CARLsim::getConductanceNMDA
std::vector< float > getConductanceNMDA(int grpId)
gets NMDA vector of a group
Definition: carlsim.cpp:2005
connection_monitor.h
CARLsim::getDelays
uint8_t * getDelays(int gIDpre, int gIDpost, int &Npre, int &Npost)
gets delays
Definition: carlsim.cpp:2017
CARLsim::setSTDP
void setSTDP(int grpId, bool isSet)
Sets default STDP mode and params.
Definition: carlsim.cpp:1858
CARLsim::getNumSynapticConnections
int getNumSynapticConnections(short int connectionId)
returns the number of connections associated with a connection ID
Definition: carlsim.cpp:2041
ComputingBackend
ComputingBackend
computing backend
Definition: carlsim_datastructures.h:148
CARLsim::getLogFpInf
const FILE * getLogFpInf()
returns file pointer to info log
Definition: carlsim.cpp:1917
CARLsim::isInhibitoryGroup
bool isInhibitoryGroup(int grpId)
returns
Definition: carlsim.cpp:2107
CPU_MODE
@ CPU_MODE
model is run on CPU core(s)
Definition: carlsim_datastructures.h:115
CARLsim::getSpikeMonitor
SpikeMonitor * getSpikeMonitor(int grpId)
Returns the number of spikes per neuron for a certain group.
Definition: carlsim.cpp:2094
neuron_monitor.h
CARLsim::getSimTimeSec
int getSimTimeSec()
returns
Definition: carlsim.cpp:2089
CARLsim
CARLsim User Interface This class provides a user interface to the public sections of CARLsimCore sou...
Definition: carlsim.h:138
CARLsim::getWeightRange
RangeWeight getWeightRange(short int connId)
returns the RangeWeight struct for a specific connection ID
Definition: carlsim.cpp:2097
poisson_rate.h
Point3D
a point in 3D space
Definition: linear_algebra.h:57
ExpCurve
A struct to assign exponential STDP curves.
Definition: carlsim_datastructures.h:571
CARLsim::connect
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...
Definition: carlsim.cpp:1740
CARLsim::isGroupWithHomeostasis
bool isGroupWithHomeostasis(int grpId)
Returns whether a group has homeostasis enabled.
Definition: carlsim.cpp:2103
Grid3D
A struct to arrange neurons on a 3D grid (a primitive cubic Bravais lattice with cubic side length 1)
Definition: carlsim_datastructures.h:490
CARLsim::setESTDP
void setESTDP(int grpId, bool isSet)
Sets default E-STDP mode and parameters.
Definition: carlsim.cpp:1868
CARLsim::getGroupGrid3D
Grid3D getGroupGrid3D(int grpId)
returns the 3D grid struct of a group
Definition: carlsim.cpp:2022
CARLsim::getCARLsimState
CARLsimState getCARLsimState()
Writes population weights from gIDpre to gIDpost to file fname in binary.
Definition: carlsim.cpp:1999
LoggerMode
LoggerMode
Logger modes.
Definition: carlsim_datastructures.h:91
CARLsim::getNumNeuronsGenExc
int getNumNeuronsGenExc()
returns the total number of excitatory spike generator neurons
Definition: carlsim.cpp:2062
SpikeGenerator
Definition: callback.h:64
RangeRmem
Struct defines the minimum and maximum membrane resisatnces of the LIF neuron group.
Definition: carlsim_datastructures.h:380
CARLsim::getGroupNumNeurons
int getGroupNumNeurons(int grpId)
returns the number of neurons of a group specified by grpId
Definition: carlsim.cpp:2077
NeuronMonitor
Definition: neuron_monitor.h:59
SYN_FIXED
#define SYN_FIXED
Definition: carlsim_definitions.h:60
CARLsim::setNeuronMonitor
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.
Definition: carlsim.cpp:1978
CARLsim::CARLsim
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,...
Definition: carlsim.cpp:1735
ConnectionMonitor
Class ConnectionMonitor.
Definition: connection_monitor.h:149
CARLsim::isPoissonGroup
bool isPoissonGroup(int grpId)
returns
Definition: carlsim.cpp:2109
CARLsim::loadSimulation
void loadSimulation(FILE *fid)
Loads a simulation (and network state) from file. The file pointer fid must point to a valid CARLsim ...
Definition: carlsim.cpp:1942
CARLsim::setDefaultSTPparams
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)
Definition: carlsim.cpp:2143
CARLsim::getNumConnections
int getNumConnections()
Returns the number of connections (pairs of pre-post groups) in the network.
Definition: carlsim.cpp:2036
CARLsim::setLogsFpCustom
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.
Definition: carlsim.cpp:1931
CARLsim::setDefaultHomeostasisParams
void setDefaultHomeostasisParams(float homeoScale, float avgTimeScale)
Sets default homeostasis params.
Definition: carlsim.cpp:2118
GroupNeuromodulatorInfo_s
A struct for retrieving neuromodulator information of a group.
Definition: carlsim_datastructures.h:444
CARLsim::getNumNeuronsGen
int getNumNeuronsGen()
returns the total number of spike generator neurons
Definition: carlsim.cpp:2059
CARLsim::getGroupEndNeuronId
int getGroupEndNeuronId(int grpId)
returns the last neuron id of a groupd specified by grpId
Definition: carlsim.cpp:2074
UpdateInterval
UpdateInterval
Update frequency for weights.
Definition: carlsim_datastructures.h:238
CARLsim::setSpikeMonitor
SpikeMonitor * setSpikeMonitor(int grpId, const std::string &fileName)
Sets a Spike Monitor for a groups, prints spikes to binary file.
Definition: carlsim.cpp:1973
carlsim_definitions.h
CARLsim::getSimTime
int getSimTime()
returns
Definition: carlsim.cpp:2087
CARLsim::setNeuromodulator
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,...
Definition: carlsim.cpp:1846
CARLsim::setWeightAndWeightChangeUpdate
void setWeightAndWeightChangeUpdate(UpdateInterval wtANDwtChangeUpdateInterval, bool enableWtChangeDecay, float wtChangeDecay=0.9f)
Sets the weight and weight change update parameters.
Definition: carlsim.cpp:1902
CARLsim::createGroupLIF
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
Definition: carlsim.cpp:1772
CARLsim::isConnectionPlastic
bool isConnectionPlastic(short int connId)
Returns whether a connection is fixed or plastic.
Definition: carlsim.cpp:2100
RadiusRF
A struct to specify the receptive field (RF) radius in 3 dimensions.
Definition: carlsim_datastructures.h:364
ANY
#define ANY
used for create* method to specify any GPU or a specific GPU
Definition: carlsim_definitions.h:57
CARLsim::getGroupId
int getGroupId(std::string grpName)
finds the ID of the group with name grpName
Definition: carlsim.cpp:2024
CARLsim::createGroup
int createGroup(const std::string &grpName, int nNeur, int neurType, int preferredPartition=ANY, ComputingBackend preferredBackend=CPU_CORES)
creates a group of Izhikevich spiking neurons
Definition: carlsim.cpp:1764
CARLsim::getMaxNumCompConnections
int getMaxNumCompConnections()
Returns the maximum number of allowed compartmental connections per group.
Definition: carlsim.cpp:2038
CARLsim::getLogFpLog
const FILE * getLogFpLog()
returns file pointer to log file
Definition: carlsim.cpp:1920
STDPType
STDPType
STDP flavors.
Definition: carlsim_datastructures.h:161
CARLsim::getNumNeuronsGenInh
int getNumNeuronsGenInh()
returns the total number of inhibitory spike generator neurons
Definition: carlsim.cpp:2065
CPU_CORES
@ CPU_CORES
Definition: carlsim_datastructures.h:149