CARLsim
4.1.0
CARLsim: a GPU-accelerated SNN simulator
|
Go to the documentation of this file.
65 #if CREATE_SPIKEDIR_IF_NOT_EXISTS
66 #if defined(WIN32) || defined(WIN64)
85 loggerMode_ = loggerMode;
86 preferredSimMode_ = prferredSimMode;
93 hasSetHomeoALL_ =
false;
94 hasSetHomeoBaseFiringALL_ =
false;
95 hasSetSTDPALL_ =
false;
96 hasSetSTPALL_ =
false;
97 hasSetConductances_ =
false;
112 for (
int i=0; i<spkGen_.size(); i++) {
113 if (spkGen_[i]!=NULL)
117 for (
int i=0; i<connGen_.size(); i++) {
118 if (connGen_[i]!=NULL)
131 short int connect(
int grpId1,
int grpId2,
const std::string& connType,
const RangeWeight& wt,
float connProb,
132 const RangeDelay& delay,
const RadiusRF& radRF,
bool synWtType,
float mulSynFast,
float mulSynSlow)
135 std::stringstream grpId1str; grpId1str <<
"Group Id " << grpId1;
136 std::stringstream grpId2str; grpId2str <<
"Group Id " << grpId2;
140 " is PoissonGroup, connect");
145 "Connection Probability connProb",
"[0,1]");
151 || connType.compare(
"gaussian")==0 && (radRF.
radX>-1 || radRF.
radY>-1 || radRF.
radZ>-1),
163 if (connType.compare(
"one-to-one")==0 && (radRF.
radX>0 || radRF.
radY>0 || radRF.
radZ>0)) {
164 userWarnings_.push_back(
"RadiusRF>0 will be ignored for connection type \"one-to-one\"");
168 if (fabs(wt.
min)>1e-15) {
169 std::cerr << funcName <<
": " << wt <<
". Non-zero minimum weights are not yet supported.\n" << std::endl;
176 grpId1str.str() +
" and " + grpId2str.str());
180 grpId1str.str() +
" and " + grpId2str.str());
183 connSyn_[grpId1].push_back(grpId2);
186 radRF, mulSynFast, mulSynSlow, synWtType);
192 std::stringstream grpId1str; grpId1str <<
". Group Id " << grpId1;
193 std::stringstream grpId2str; grpId2str <<
". Group Id " << grpId2;
197 " is PoissonGroup, connect");
206 grpId1str.str() +
" and " + grpId2str.str());
209 grpId1str.str() +
" and " + grpId2str.str());
212 connSyn_[grpId1].push_back(grpId2);
217 connGen_.push_back(CGC);
218 return snn_->
connect(grpId1, grpId2, CGC, 1.0f, 1.0f, synWtType);
226 std::stringstream grpId1str; grpId1str <<
". Group Id " << grpId1;
227 std::stringstream grpId2str; grpId2str <<
". Group Id " << grpId2;
231 " is PoissonGroup, connect");
236 funcName,
"CONFIG.");
242 grpId1str.str() +
" and " + grpId2str.str());
245 grpId1str.str() +
" and " + grpId2str.str());
248 connSyn_[grpId1].push_back(grpId2);
252 connGen_.push_back(CGC);
253 return snn_->
connect(grpId1, grpId2, CGC, mulSynFast, mulSynSlow, synWtType);
257 std::stringstream funcName; funcName <<
"connectCompartments(" << grpIdLower <<
"," << grpIdUpper <<
")";
260 std::stringstream grpIdLowerStr; grpIdLowerStr <<
"Group Id " << grpIdLower;
261 std::stringstream grpIdUpperStr; grpIdUpperStr <<
"Group Id " << grpIdUpper;
263 grpIdLowerStr.str(),
"[0,getNumGroups()]");
265 grpIdUpperStr.str(),
"[0,getNumGroups()]");
267 grpIdLowerStr.str() +
" and " + grpIdUpperStr.str());
271 grpIdLowerStr.str() +
" is PoissonGroup, connectCompartments");
273 grpIdUpperStr.str() +
" is PoissonGroup, connectCompartments");
278 grpIdUpperStr.str());
283 grpIdUpperStr.str());
288 grpIdLowerStr.str() +
" and " + grpIdUpperStr.str());
291 grpIdLowerStr.str() +
" and " + grpIdUpperStr.str());
294 UserErrors::assertTrue(std::find(connComp_[grpIdLower].begin(), connComp_[grpIdLower].end(), grpIdUpper) ==
296 grpIdLowerStr.str() +
" and " + grpIdUpperStr.str());
297 UserErrors::assertTrue(std::find(connComp_[grpIdUpper].begin(), connComp_[grpIdUpper].end(), grpIdLower) ==
299 grpIdLowerStr.str() +
" and " + grpIdUpperStr.str());
303 funcName.str(),
"Number of compartmental connections for group " + grpIdLowerStr.str(),
304 "[0,getMaxNumCompConnections()");
306 funcName.str(),
"Number of compartmental connections for group " + grpIdUpperStr.str(),
307 "[0,getMaxNumCompConnections()");
310 connComp_[grpIdLower].push_back(grpIdUpper);
311 connComp_[grpIdUpper].push_back(grpIdLower);
318 return createGroup(grpName,
Grid3D(nNeur,1,1), neurType, preferredPartition, preferredBackend);
323 return createGroupLIF(grpName,
Grid3D(nNeur,1,1), neurType, preferredPartition, preferredBackend);
328 std::string funcName =
"createGroup(\""+grpName+
"\")";
330 funcName,
"CONFIG.");
338 userWarnings_.push_back(
"Make sure to call setSTP on group "+grpName);
340 userWarnings_.push_back(
"Make sure to call setSTDP on group "+grpName);
342 userWarnings_.push_back(
"Make sure to call setHomeostasis on group "+grpName);
343 if (hasSetHomeoBaseFiringALL_)
344 userWarnings_.push_back(
"Make sure to call setHomeoBaseFiringRate on group "+grpName);
346 int grpId = snn_->
createGroup(grpName.c_str(), grid, neurType, preferredPartition, preferredBackend);
347 grpIds_.push_back(grpId);
349 int partitionOffset = 0;
354 int prefPartition = preferredPartition + partitionOffset;
355 groupPrefNetIds_.insert(std::pair<int, int>(grpId, prefPartition));
358 connSyn_.resize(grpIds_.size());
359 connComp_.resize(grpIds_.size());
366 std::string funcName =
"createGroupLIF(\""+grpName+
"\")";
368 funcName,
"CONFIG.");
376 userWarnings_.push_back(
"Make sure to call setSTP on group "+grpName);
378 userWarnings_.push_back(
"Make sure to call setSTDP on group "+grpName);
380 userWarnings_.push_back(
"Make sure to call setHomeostasis on group "+grpName);
381 if (hasSetHomeoBaseFiringALL_)
382 userWarnings_.push_back(
"Make sure to call setHomeoBaseFiringRate on group "+grpName);
384 int grpId = snn_->
createGroupLIF(grpName.c_str(), grid, neurType, preferredPartition, preferredBackend);
385 grpIds_.push_back(grpId);
387 int partitionOffset = 0;
392 int prefPartition = preferredPartition + partitionOffset;
393 groupPrefNetIds_.insert(std::pair<int, int>(grpId, prefPartition));
396 connSyn_.resize(grpIds_.size());
397 connComp_.resize(grpIds_.size());
409 std::string funcName =
"createSpikeGeneratorGroup(\""+grpName+
"\")";
411 funcName,
"CONFIG.");
417 grpIds_.push_back(grpId);
420 connSyn_.resize(grpIds_.size());
421 connComp_.resize(grpIds_.size());
427 std::string funcName =
"setCompartmentParameters(\"" +
getGroupName(grpId) +
"\")";
437 std::stringstream funcName; funcName <<
"setConductances(" << isSet <<
")";
439 funcName.str(),
"CONFIG.");
440 hasSetConductances_ =
true;
443 snn_->
setConductances(
true,def_tdAMPA_,0,def_tdNMDA_,def_tdGABAa_,0,def_tdGABAb_);
451 std::stringstream funcName; funcName <<
"setConductances(" << isSet <<
"," << tdAMPA <<
"," << tdNMDA <<
","
452 << tdGABAa <<
"," << tdGABAb <<
")";
458 funcName.str(),
"CONFIG.");
459 hasSetConductances_ =
true;
469 void setConductances(
bool isSet,
int tdAMPA,
int trNMDA,
int tdNMDA,
int tdGABAa,
int trGABAb,
472 std::stringstream funcName; funcName <<
"setConductances(" << isSet <<
"," << tdAMPA <<
"," << trNMDA <<
"," <<
473 tdNMDA <<
"," << tdGABAa <<
"," << trGABAb <<
"," << tdGABAb <<
")";
482 "trGABAb and tdGABAb");
484 funcName.str(),
"CONFIG.");
485 hasSetConductances_ =
true;
488 snn_->
setConductances(
true,tdAMPA,trNMDA,tdNMDA,tdGABAa,trGABAb,tdGABAb);
496 std::string funcName =
"setHomeostasis(\""+
getGroupName(grpId)+
"\")";
500 funcName,
"CONFIG.");
502 hasSetHomeoALL_ = grpId==
ALL;
505 snn_->
setHomeostasis(grpId,
true,def_homeo_scale_,def_homeo_avgTimeScale_);
506 if (grpId!=
ALL && hasSetHomeoBaseFiringALL_)
507 userWarnings_.push_back(
"Make sure to call setHomeoBaseFiringRate on group "
515 void setHomeostasis(
int grpId,
bool isSet,
float homeoScale,
float avgTimeScale) {
516 std::string funcName =
"setHomeostasis(\""+
getGroupName(grpId)+
"\")";
522 hasSetHomeoALL_ = grpId==
ALL;
526 if (grpId!=
ALL && hasSetHomeoBaseFiringALL_)
527 userWarnings_.push_back(
"Make sure to call setHomeoBaseFiringRate on group "
536 std::string funcName =
"setHomeoBaseFiringRate(\""+
getGroupName(grpId)+
"\")";
539 funcName,
" Must call setHomeostasis first.");
543 hasSetHomeoBaseFiringALL_ = grpId==
ALL;
550 std::string funcName =
"setIntegrationMethod()";
554 "numStepsPerMs",
"[1, 100]");
563 float izh_c,
float izh_c_sd,
float izh_d,
float izh_d_sd)
565 std::string funcName =
"setNeuronParameters(\""+
getGroupName(grpId)+
"\")";
571 snn_->
setNeuronParameters(grpId, izh_a, izh_a_sd, izh_b, izh_b_sd, izh_c, izh_c_sd, izh_d, izh_d_sd);
576 std::string funcName =
"setNeuronParameters(\""+
getGroupName(grpId)+
"\")";
579 funcName,
"CONFIG.");
586 float izh_a,
float izh_b,
float izh_vpeak,
float izh_c,
float izh_d)
588 std::string funcName =
"setNeuronParameters(\"" +
getGroupName(grpId) +
"\")";
595 izh_a, 0.0f, izh_b, 0.0f, izh_vpeak, 0.0f, izh_c, 0.0f, izh_d, 0.0f);
600 float izh_vr,
float izh_vr_sd,
float izh_vt,
float izh_vt_sd,
601 float izh_a,
float izh_a_sd,
float izh_b,
float izh_b_sd,
602 float izh_vpeak,
float izh_vpeak_sd,
float izh_c,
float izh_c_sd,
603 float izh_d,
float izh_d_sd)
605 std::string funcName =
"setNeuronParameters(\"" +
getGroupName(grpId) +
"\")";
611 snn_->
setNeuronParameters(grpId, izh_C, izh_C_sd, izh_k, izh_k_sd, izh_vr, izh_vr_sd, izh_vt, izh_vt_sd,
612 izh_a, izh_a_sd, izh_b, izh_b_sd, izh_vpeak, izh_vpeak_sd, izh_c, izh_c_sd, izh_d, izh_d_sd);
618 std::string funcName =
"setNeuronParametersLIF(\"" +
getGroupName(grpId) +
"\")";
635 void setNeuromodulator(
int grpId,
float baseDP,
float tauDP,
float base5HT,
float tau5HT,
float baseACh,
636 float tauACh,
float baseNE,
float tauNE)
638 std::string funcName =
"setNeuromodulator(\""+
getGroupName(grpId)+
"\")";
648 funcName,
"CONFIG.");
650 snn_->
setNeuromodulator(grpId, baseDP, tauDP, base5HT, tau5HT, baseACh, tauACh, baseNE, tauNE);
654 std::string funcName =
"setNeuromodulator(\""+
getGroupName(grpId)+
"\")";
660 funcName,
"CONFIG.");
662 snn_->
setNeuromodulator(grpId, 1.0f, tauDP, 1.0f, tau5HT, 1.0f, tauACh, 1.0f, tauNE);
671 void setSTDP(
int grpId,
bool isSet,
STDPType type,
float alphaPlus,
float tauPlus,
float alphaMinus,
674 setESTDP(grpId, isSet, type,
ExpCurve(alphaPlus, tauPlus, alphaMinus, tauMinus));
679 std::string funcName =
"setESTDP(\""+
getGroupName(grpId)+
"\")";
683 funcName,
"CONFIG.");
685 hasSetSTDPALL_ = grpId==
ALL;
688 snn_->
setESTDP(grpId,
true, def_STDP_type_,
EXP_CURVE, def_STDP_alphaLTP_, def_STDP_tauLTP_,
689 def_STDP_alphaLTD_, def_STDP_tauLTD_, 0.0f);
702 funcName,
"CONFIG.");
704 hasSetSTDPALL_ = grpId==
ALL;
721 funcName,
"CONFIG.");
723 hasSetSTDPALL_ = grpId==
ALL;
735 std::string funcName =
"setISTDP(\""+
getGroupName(grpId)+
"\")";
739 funcName,
"CONFIG.");
741 hasSetSTDPALL_ = grpId==
ALL;
744 snn_->
setISTDP(grpId,
true, def_STDP_type_,
PULSE_CURVE, def_STDP_betaLTP_, def_STDP_betaLTD_,
745 def_STDP_lambda_, def_STDP_delta_);
758 funcName,
"CONFIG.");
760 hasSetSTDPALL_ = grpId==
ALL;
777 funcName,
"CONFIG.");
779 hasSetSTDPALL_ = grpId==
ALL;
790 std::string funcName =
"setSTP(\""+
getGroupName(grpId)+
"\")";
792 funcName,
"CONFIG.");
794 hasSetSTPALL_ = grpId==
ALL;
801 snn_->
setSTP(grpId,
true,def_STP_U_exc_,def_STP_tau_u_exc_,def_STP_tau_x_exc_);
803 snn_->
setSTP(grpId,
true,def_STP_U_inh_,def_STP_tau_u_inh_,def_STP_tau_x_inh_);
808 snn_->
setSTP(grpId,
false,0.0f,0.0f,0.0f);
813 void setSTP(
int grpId,
bool isSet,
float STP_U,
float STP_tau_u,
float STP_tau_x) {
814 std::string funcName =
"setSTP(\""+
getGroupName(grpId)+
"\")";
816 funcName,
"CONFIG.");
818 hasSetSTPALL_ = grpId==
ALL;
824 snn_->
setSTP(grpId,
true,STP_U,STP_tau_u,STP_tau_x);
826 snn_->
setSTP(grpId,
false,0.0f,0.0f,0.0f);
833 std::string funcName =
"setWeightAndWeightChangeUpdate()";
837 funcName,
"CONFIG.");
847 std::string funcName =
"runNetwork()";
854 if (!hasSetConductances_) {
855 userWarnings_.push_back(
"setConductances has not been called. Setting simulation mode to CUBA.");
859 handleUserWarnings();
864 return snn_->
runNetwork(nSec, nMsec, printRunSummary);
869 std::string funcName =
"setupNetwork()";
871 funcName,
"CONFIG.");
886 FILE* fpSave = fopen(fileName.c_str(),
"wb");
887 std::string funcName =
"saveSimulation()";
898 std::string funcName =
"setLogFile("+fileName+
")";
902 std::string fileNameNonConst = fileName;
903 std::transform(fileNameNonConst.begin(), fileNameNonConst.end(), fileNameNonConst.begin(), ::tolower);
904 if (fileNameNonConst==
"null") {
905 #if defined(WIN32) || defined(WIN64)
906 fpLog = fopen(
"nul",
"w");
908 fpLog = fopen(
"/dev/null",
"w");
911 fpLog = fopen(fileName.c_str(),
"w");
916 snn_->
setLogsFp(NULL, NULL, NULL, fpLog);
923 snn_->
setLogsFp(fpInf,fpErr,fpDeb,fpLog);
930 void biasWeights(
short int connId,
float bias,
bool updateWeightRange) {
931 std::stringstream funcName; funcName <<
"biasWeights(" << connId <<
"," << bias <<
"," << updateWeightRange <<
936 "connId",
"[0,getNumConnections()]");
938 snn_->
biasWeights(connId, bias, updateWeightRange);
942 std::string funcName =
"startTesting()";
949 std::string funcName =
"stopTesting()";
957 std::string funcName =
"loadSimulation()";
959 funcName,
"CONFIG.");
965 void scaleWeights(
short int connId,
float scale,
bool updateWeightRange) {
966 std::stringstream funcName; funcName <<
"scaleWeights(" << connId <<
"," << scale <<
"," << updateWeightRange
971 "connId",
"[0,getNumConnections()]");
980 +
"\",\"" + fname +
"\")";
989 std::string fileName = fname;
990 std::transform(fileName.begin(), fileName.end(), fileName.begin(), ::tolower);
991 if (fileName ==
"null") {
996 if (fileName ==
"default") {
1002 fid = fopen(fileName.c_str(),
"wb");
1006 std::string fileError =
" Double-check file permissions and make sure directory exists.";
1016 std::string funcName =
"setExternalCurrent(\""+
getGroupName(grpId)+
"\")";
1019 "current.size()",
"number of neurons in the group.");
1028 std::string funcName =
"setExternalCurrent(\""+
getGroupName(grpId)+
"\")";
1040 std::string funcName =
"setGroupMonitor(\""+
getGroupName(grpId)+
"\",\""+fname+
"\")";
1047 std::string fileName = fname;
1048 std::transform(fileName.begin(), fileName.end(), fileName.begin(), ::tolower);
1049 if (fileName ==
"null") {
1054 if (fileName ==
"default") {
1055 fileName =
"results/grp_" + snn_->
getGroupName(grpId) +
".dat";
1060 fid = fopen(fileName.c_str(),
"wb");
1064 std::string fileError =
" Double-check file permissions and make sure directory exists.";
1075 std::string funcName =
"setSpikeGenerator(\""+
getGroupName(grpId)+
"\")";
1080 funcName,
"CONFIG.");
1084 spkGen_.push_back(SGC);
1090 std::string funcName =
"setSpikeMonitor(\""+
getGroupName(grpId)+
"\",\""+fileName+
"\")";
1097 std::string fileNameLower = fileName;
1098 std::transform(fileNameLower.begin(), fileNameLower.end(), fileNameLower.begin(), ::tolower);
1099 if (fileNameLower ==
"null") {
1104 if (fileNameLower ==
"default") {
1105 std::string fileNameDefault =
"results/spk_" + snn_->
getGroupName(grpId) +
".dat";
1106 fid = fopen(fileNameDefault.c_str(),
"wb");
1108 std::string fileError =
" Make sure results/ exists.";
1112 fid = fopen(fileName.c_str(),
"wb");
1114 std::string fileError =
" Double-check file permissions and make sure directory exists.";
1126 std::string funcName =
"setNeuronMonitor(\"" +
getGroupName(grpId) +
"\",\"" + fileName +
"\")";
1133 std::string fileNameLower = fileName;
1134 std::transform(fileNameLower.begin(), fileNameLower.end(), fileNameLower.begin(), ::tolower);
1135 if (fileNameLower ==
"null") {
1141 if (fileNameLower ==
"default") {
1142 std::string fileNameDefault =
"results/n_" + snn_->
getGroupName(grpId) +
".dat";
1143 fid = fopen(fileNameDefault.c_str(),
"wb");
1145 std::string fileError =
" Make sure results/ exists.";
1150 fid = fopen(fileName.c_str(),
"wb");
1152 std::string fileError =
" Double-check file permissions and make sure directory exists.";
1164 std::string funcName =
"setSpikeRate()";
1169 funcName,
"PoissonRate length and the number of neurons in the group");
1177 void setWeight(
short int connId,
int neurIdPre,
int neurIdPost,
float weight,
bool updateWeightRange) {
1178 std::stringstream funcName; funcName <<
"setWeight(" << connId <<
"," << neurIdPre <<
"," << neurIdPost <<
","
1179 << updateWeightRange <<
")";
1183 funcName.str(),
"connectionId",
"[0,getNumConnections()]");
1186 snn_->
setWeight(connId, neurIdPre, neurIdPost, weight, updateWeightRange);
1195 std::string funcName =
"getConductanceAMPA()";
1197 funcName, funcName,
"RUN.");
1200 "[0,getNumGroups()]");
1206 std::string funcName =
"getConductanceNMDA()";
1208 funcName, funcName,
"RUN.");
1211 "[0,getNumGroups()]");
1217 std::string funcName =
"getConductanceGABAa()";
1219 funcName, funcName,
"RUN.");
1222 "[0,getNumGroups()]");
1228 std::string funcName =
"getConductanceGABAb()";
1230 funcName, funcName,
"RUN.");
1233 "[0,getNumGroups()]");
1239 std::stringstream funcName; funcName <<
"getDelayRange(" << connId <<
")";
1241 "connId",
"[0,getNumConnections()]");
1247 uint8_t*
getDelays(
int gIDpre,
int gIDpost,
int& Npre,
int& Npost) {
1248 std::string funcName =
"getDelays()";
1252 "[0,getNumGroups()]");
1254 "[0,getNumGroups()]");
1256 return snn_->
getDelays(gIDpre,gIDpost,Npre,Npost);
1260 std::stringstream funcName; funcName <<
"getGroupGrid3D(" << grpId <<
")";
1263 "grpId",
"[0,getNumGroups()]");
1273 std::stringstream funcName; funcName <<
"getGroupName(" << grpId <<
")";
1275 "grpId",
"[0,getNumGroups()] or must be ALL.");
1281 std::stringstream funcName; funcName <<
"getGroupStartNeuronId(" << grpId <<
")";
1285 "[0,getNumGroups()]");
1291 std::stringstream funcName; funcName <<
"getGroupEndNeuronId(" << grpId <<
")";
1295 "[0,getNumGroups()]");
1301 std::stringstream funcName; funcName <<
"getGroupNumNeurons(" << grpId <<
")";
1303 "[0,getNumGroups()]");
1309 std::stringstream funcName; funcName <<
"getNeuronLocation3D(" << neurId <<
")";
1314 "neurId",
"[0,getNumNeurons()]");
1320 std::stringstream funcName; funcName <<
"getNeuronLocation3D(" << grpId <<
"," << relNeurId <<
")";
1323 "grpId",
"[0,getNumGroups()]");
1325 funcName.str(),
"relNeurId",
"[0,getGroupNumNeurons()]");
1343 std::stringstream funcName; funcName <<
"getNumConnections(" << connectionId <<
")";
1348 funcName.str(),
"connectionId",
"[0,getNumSynapticConnections()]");
1353 std::string funcName =
"getNumSynapses()";
1361 std::stringstream funcName; funcName <<
"getGroupSTDPInfo(" << grpId <<
")";
1363 "grpId",
"[0,getNumGroups()]");
1369 std::stringstream funcName; funcName <<
"getGroupNeuromodulatorInfo(" << grpId <<
")";
1371 "grpId",
"[0,getNumGroups()]");
1381 std::stringstream funcName; funcName <<
"getSpikeMonitor(" << grpId <<
")";
1383 "grpId",
"[0,getNumGroups()]");
1389 std::stringstream funcName; funcName <<
"getWeightRange(" << connId <<
")";
1391 "connId",
"[0,getNumConnections()]");
1397 std::stringstream funcName; funcName <<
"isConnectionPlastic(" << connId <<
")";
1399 "connId",
"[0,getNumConnections()]");
1405 std::stringstream funcName; funcName <<
"isGroupWithHomeostasis(" << grpId <<
")";
1407 "connId",
"[0,getNumGroups()]");
1413 std::stringstream funcName; funcName <<
"isExcitatoryGroup(" << grpId <<
")";
1415 "connId",
"[0,getNumGroups()]");
1421 std::stringstream funcName; funcName <<
"isInhibitoryGroup(" << grpId <<
")";
1423 "connId",
"[0,getNumGroups()]");
1429 std::stringstream funcName; funcName <<
"isPoissonGroup(" << grpId <<
")";
1431 "connId",
"[0,getNumGroups()]");
1443 std::stringstream funcName; funcName <<
"setDefaultConductanceTimeConstants(" << tdAMPA <<
"," << trNMDA <<
1444 "," << tdNMDA <<
"," << tdGABAa <<
"," << trGABAb <<
"," << tdGABAb <<
")";
1453 "trGABAb and tdGABAb");
1457 def_tdAMPA_ = tdAMPA;
1458 def_trNMDA_ = trNMDA;
1459 def_tdNMDA_ = tdNMDA;
1460 def_tdGABAa_ = tdGABAa;
1461 def_trGABAb_ = trGABAb;
1462 def_tdGABAb_ = tdGABAb;
1466 std::string funcName =
"setDefaultHomeostasisparams()";
1468 funcName,
"CONFIG.");
1469 assert(avgTimeScale>0);
1471 def_homeo_scale_ = homeoScale;
1472 def_homeo_avgTimeScale_ = avgTimeScale;
1476 std::string funcName =
"setDefaultSaveOptions()";
1478 funcName,
"CONFIG.");
1480 def_save_fileName_ = fileName;
1481 def_save_synapseInfo_ = saveSynapseInfo;
1485 FILE* fpTry = fopen(def_save_fileName_.c_str(),
"wb");
1497 std::string funcName =
"setDefaultESTDPparams()";
1513 def_STDP_alphaLTP_ = alphaPlus;
1514 def_STDP_tauLTP_ = tauPlus;
1515 def_STDP_alphaLTD_ = alphaMinus;
1516 def_STDP_tauLTD_ = tauMinus;
1521 std::string funcName =
"setDefaultISTDPparams()";
1539 def_STDP_betaLTP_ = betaLTP;
1540 def_STDP_betaLTD_ = betaLTD;
1541 def_STDP_lambda_ = lambda;
1542 def_STDP_delta_ = delta;
1547 std::string funcName =
"setDefaultSTPparams()";
1552 assert(STP_tau_u>0.0f);
1553 assert(STP_tau_x>0.0f);
1557 def_STP_U_exc_ = STP_U;
1558 def_STP_tau_u_exc_ = STP_tau_u;
1559 def_STP_tau_x_exc_ = STP_tau_x;
1562 def_STP_U_inh_ = STP_U;
1563 def_STP_tau_u_inh_ = STP_tau_u;
1564 def_STP_tau_x_inh_ = STP_tau_x;
1578 void CARLsimInit() {
1579 bool gpuAllocationResult =
false;
1580 std::string funcName =
"CARLsimInit()";
1585 snn_ =
new SNN(netName_, preferredSimMode_, loggerMode_, randSeed_);
1616 bool existsGrpId(
int grpId) {
1617 return std::find(grpIds_.begin(), grpIds_.end(), grpId)!=grpIds_.end();
1621 void handleUserWarnings() {
1622 if (userWarnings_.size()) {
1623 for (
int i=0; i<userWarnings_.size(); i++) {
1627 fprintf(stdout,
"Ignore warnings and continue? Y/n ");
1628 char ignoreWarn = std::cin.get();
1629 if (std::cin.fail() || ignoreWarn!=
'y' && ignoreWarn!=
'Y') {
1630 fprintf(stdout,
"Exiting...\n");
1641 #if defined(WIN32) || defined(WIN64)
1642 static HANDLE gpuAllocationLock;
1644 static pthread_mutex_t gpuAllocationLock;
1652 std::string netName_;
1660 std::vector<std::vector<int> > connSyn_;
1663 std::vector<std::vector<int> > connComp_;
1665 std::map<int, int> groupPrefNetIds_;
1667 unsigned int numConnections_;
1668 std::vector<std::string> userWarnings_;
1670 std::vector<int> grpIds_;
1671 std::vector<SpikeGeneratorCore*> spkGen_;
1672 std::vector<ConnectionGeneratorCore*> connGen_;
1674 bool hasSetHomeoALL_;
1675 bool hasSetHomeoBaseFiringALL_;
1676 bool hasSetSTDPALL_;
1678 bool hasSetConductances_;
1690 float def_STDP_alphaLTP_;
1691 float def_STDP_tauLTP_;
1692 float def_STDP_alphaLTD_;
1693 float def_STDP_tauLTD_;
1694 float def_STDP_betaLTP_;
1695 float def_STDP_betaLTD_;
1696 float def_STDP_lambda_;
1697 float def_STDP_delta_;
1700 float def_STP_U_exc_;
1701 float def_STP_tau_u_exc_;
1702 float def_STP_tau_x_exc_;
1703 float def_STP_U_inh_;
1704 float def_STP_tau_u_inh_;
1705 float def_STP_tau_x_inh_;
1708 float def_homeo_scale_;
1709 float def_homeo_avgTimeScale_;
1712 std::string def_save_fileName_;
1713 bool def_save_synapseInfo_;
1727 #if defined(WIN32) || defined(WIN64)
1728 HANDLE CARLsim::Impl::gpuAllocationLock = CreateMutex(NULL, FALSE, NULL);
1730 pthread_mutex_t CARLsim::Impl::gpuAllocationLock = PTHREAD_MUTEX_INITIALIZER;
1735 _impl( new
Impl(this, netName, preferredSimMode, loggerMode, randSeed) ) {}
1740 const RangeDelay& delay,
const RadiusRF& radRF,
bool synWtType,
float mulSynFast,
float mulSynSlow) {
1741 return _impl->
connect(grpId1, grpId2, connType, wt, connProb, delay, radRF, synWtType, mulSynFast, mulSynSlow);
1747 return _impl->
connect(grpId1, grpId2, conn, synWtType);
1752 return _impl->
connect(grpId1, grpId2, conn, mulSynFast, mulSynSlow, synWtType);
1761 return _impl->
createGroup(grpName, grid, neurType, preferredPartition, preferredBackend);
1764 return _impl->
createGroup(grpName, nNeur, neurType, preferredPartition, preferredBackend);
1769 return _impl->
createGroupLIF(grpName, grid, neurType, preferredPartition, preferredBackend);
1772 return _impl->
createGroupLIF(grpName, nNeur, neurType, preferredPartition, preferredBackend);
1795 _impl->
setConductances(isSet, tdAMPA, trNMDA, tdNMDA, tdGABAa, trGABAb, tdGABAb);
1816 float izh_c_sd,
float izh_d,
float izh_d_sd)
1818 _impl->
setNeuronParameters(grpId, izh_a, izh_a_sd, izh_b, izh_b_sd, izh_c, izh_c_sd, izh_d, izh_d_sd);
1825 float izh_a,
float izh_b,
float izh_vpeak,
float izh_c,
float izh_d)
1827 _impl->
setNeuronParameters(grpId, izh_C, izh_k, izh_vr, izh_vt, izh_a, izh_b, izh_vpeak, izh_c, izh_d);
1831 float izh_vr,
float izh_vr_sd,
float izh_vt,
float izh_vt_sd,
1832 float izh_a,
float izh_a_sd,
float izh_b,
float izh_b_sd,
1833 float izh_vpeak,
float izh_vpeak_sd,
float izh_c,
float izh_c_sd,
1834 float izh_d,
float izh_d_sd)
1836 _impl->
setNeuronParameters(grpId, izh_C, izh_C_sd, izh_k, izh_k_sd, izh_vr, izh_vr_sd, izh_vt, izh_vt_sd,
1837 izh_a, izh_a_sd, izh_b, izh_b_sd, izh_vpeak, izh_vpeak_sd, izh_c, izh_c_sd, izh_d, izh_d_sd);
1846 float tauACh,
float baseNE,
float tauNE)
1848 _impl->
setNeuromodulator(grpId, baseDP, tauDP, base5HT, tau5HT, baseACh, tauACh, baseNE, tauNE);
1863 _impl->
setSTDP(grpId, isSet, type, alphaPlus, tauPlus, alphaMinus, tauMinus);
1871 _impl->
setESTDP(grpId, isSet, type, curve);
1876 _impl->
setESTDP(grpId, isSet, type, curve);
1884 _impl->
setISTDP(grpId, isSet, type, curve);
1889 _impl->
setISTDP(grpId, isSet, type, curve);
1893 void CARLsim::setSTP(
int grpId,
bool isSet,
float STP_U,
float STP_tau_u,
float STP_tau_x) {
1894 _impl->
setSTP(grpId, isSet, STP_U, STP_tau_u, STP_tau_x);
1902 float wtChangeDecay)
1910 return _impl->
runNetwork(nSec, nMsec, printRunSummary);
1937 _impl->
biasWeights(connId, bias, updateWeightRange);
1987 void CARLsim::setWeight(
short int connId,
int neurIdPre,
int neurIdPost,
float weight,
bool updateWeightRange) {
1988 _impl->
setWeight(connId, neurIdPre, neurIdPost, weight, updateWeightRange);
2017 return _impl->
getDelays(gIDpre, gIDpost, Npre, Npost);
void setExternalCurrent(int grpId, const std::vector< float > ¤t)
Sets the amount of current (mA) to inject into a group.
int getNumNeuronsRegInh()
int getNumNeuronsRegExc()
int getNumNeuronsRegExc()
returns the total number of regular (Izhikevich) excitatory neurons
void setDefaultConductanceTimeConstants(int tdAMPA, int trNMDA, int tdNMDA, int tdGABAa, int trGABAb, int tdGABAb)
SpikeMonitor * getSpikeMonitor(int grpId)
ConnectionMonitor * setConnectionMonitor(int grpIdPre, int grpIdPost, const std::string &fname)
void setExternalCurrent(int grpId, const std::vector< float > ¤t)
@ CANNOT_BE_LARGER
parameter cannot have larger vaule than some vaule
int createSpikeGeneratorGroup(const std::string &grpName, int nNeur, int neurType, int preferredPartition=ANY, ComputingBackend preferredBackend=CPU_CORES)
creates a spike generator group
int getGroupNumNeurons(int gGrpId)
void setNeuromodulator(int grpId, float tauDP, float tau5HT, float tauACh, float tauNE)
GroupMonitor * setGroupMonitor(int grpId, FILE *fid)
sets up a group monitor registered with a callback to process the spikes.
int getGroupStartNeuronId(int gGrpId)
void setConductances(bool isSet, int tdAMPA, int trNMDA, int tdNMDA, int tdGABAa, int trGABAb, int tdGABAb)
Sets custom values for conductance decay (\tau_decay) or disables conductances alltogether These will...
@ RUN_STATE
run state, where the model is stepped
void stopTesting()
Exits a testing phase, making weight changes possible again.
integrationMethod_t
Integration methods.
bool isInhibitoryGroup(int grpId)
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)
@ CANNOT_BE_SET_TO
parameter cannot be set to
void setDefaultSTDPparams(float alphaPlus, float tauPlus, float alphaMinus, float tauMinus, STDPType stdpType)
void loadSimulation(FILE *fid)
@ CANNOT_BE_IDENTICAL
parameters cannot be identical
int getGroupEndNeuronId(int grpId)
int getGroupStartNeuronId(int grpId)
void setDefaultHomeostasisParams(float homeoScale, float avgTimeScale)
void setNeuronParametersLIF(int grpId, int tau_m, int tau_ref, float vTh, float vReset, double minRmem, double maxRmem)
Sets neuron parameters for a group of LIF spiking neurons.
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 biasWeights(short int connId, float bias, bool updateWeightRange=false)
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
bool isConnectionPlastic(short int connId)
short int connect(int gIDpre, int gIDpost, const std::string &_type, float initWt, float maxWt, float prob, uint8_t minDelay, uint8_t maxDelay, RadiusRF radius, float mulSynFast, float mulSynSlow, bool synWtType)
make from each neuron in grpId1 to 'numPostSynapses' neurons in grpId2
int getNumNeuronsRegExc()
Point3D getNeuronLocation3D(int neurId)
returns the 3D location a neuron codes for
void saveSimulation(FILE *fid, bool saveSynapseInfo=false)
stores the pre and post synaptic neuron ids with the weight and delay
int createGroupLIF(const std::string &grpName, int nNeur, int neurType, int preferredPartition=ANY, ComputingBackend preferredBackend=CPU_CORES)
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 getNumNeuronsGenExc()
void setDefaultISTDPparams(float betaLTP, float betaLTD, float lambda, float delta, STDPType stdpType)
void setHomeoBaseFiringRate(int grpId, float baseFiring, float baseFiringSD)
std::vector< float > getConductanceGABAa(int grpId)
GroupSTDPInfo getGroupSTDPInfo(int grpId)
@ MUST_BE_IDENTICAL
parameters must be identical
int getNumNeuronsReg()
returns the total number of regular (Izhikevich) neurons
void setSpikeGenerator(int grpId, SpikeGeneratorCore *spikeGenFunc)
sets up a spike generator
void saveSimulation(const std::string &fileName, bool saveSynapseInfo)
void loadSimulation(FILE *fid)
STDPCurve stdpCurve
the type of STDP curve
void setHomeostasis(int grpId, bool isSet)
int runNetwork(int nSec, int nMsec, bool printRunSummary)
void setLogFile(const std::string &fileName)
@ EXP_CURVE
standard exponential curve
int runNetwork(int _nsec, int _nmsec, bool printRunSummary)
run the simulation for n sec
void setWeightAndWeightChangeUpdate(UpdateInterval wtANDwtChangeUpdateInterval, bool enableWtChangeDecay, float wtChangeDecay)
Sets the weight and weight change update parameters.
int getSimTimeMsec()
returns
std::vector< float > getConductanceAMPA(int grpId)
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 ...
@ CAN_ONLY_BE_CALLED_IN_STATE
function can only be called in certain state
used for relaying callback to SpikeGenerator
int getNumNeurons()
returns the total number of allocated neurons in the network
@ MUST_BE_POSITIVE
parameter must have positive value
bool isConnectionPlastic(short int connId)
returns whether synapses in connection are fixed (false) or plastic (true)
void setDefaultESTDPparams(float alphaPlus, float tauPlus, float alphaMinus, float tauMinus, STDPType stdpType)
sets default values for E-STDP params
CARLsimState
CARLsim states.
void setLogsFpCustom(FILE *fpInf, FILE *fpErr, FILE *fpDeb, FILE *fpLog)
std::vector< float > getConductanceGABAb(int grpId)
std::vector< float > getConductanceNMDA(int grpId)
void setExternalCurrent(int grpId, const std::vector< float > ¤t)
injects current (mA) into the soma of every neuron in the group
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.
NeuronMonitor * setNeuronMonitor(int grpId, const std::string &fileName)
void setCompartmentParameters(int grpId, float couplingUp, float couplingDown)
Sets coupling constants G_u and G_d for the compartment.
void setDefaultSaveOptions(std::string fileName, bool saveSynapseInfo)
void setDefaultESTDPparams(float alphaPlus, float tauPlus, float alphaMinus, float tauMinus, STDPType stdpType)
void setSpikeGenerator(int grpId, SpikeGenerator *spikeGenFunc)
void setLogsFp(FILE *fpInf=NULL, FILE *fpErr=NULL, FILE *fpDeb=NULL, FILE *fpLog=NULL)
Sets the file pointers for all log files file pointer NULL means don't change it.
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
used for relaying callback to ConnectionGenerator
void setHomeoBaseFiringRate(int grpId, float baseFiring, float baseFiringSD=0.0f)
Sets the homeostatic target firing rate (enforced through homeostatic synaptic scaling)
GroupSTDPInfo getGroupSTDPInfo(int grpId)
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.
const FILE * getLogFpInf()
void setNeuronParameters(int grpId, float izh_C, float izh_C_sd, float izh_k, float izh_k_sd, float izh_vr, float izh_vr_sd, float izh_vt, float izh_vt_sd, float izh_a, float izh_a_sd, float izh_b, float izh_b_sd, float izh_vpeak, float izh_vpeak_sd, float izh_c, float izh_c_sd, float izh_d, float izh_d_sd)
short int connectCompartments(int grpIdLower, int grpIdUpper)
std::vector< float > getConductanceNMDA(int grpId)
void setCompartmentParameters(int grpId, float couplingUp, float couplingDown)
Coupling constants for the compartment are set using this method.
void setConductances(bool isSet, int tdAMPA, int tdNMDA, int tdGABAa, int tdGABAb)
#define EXCITATORY_NEURON
ConnectionMonitor * setConnectionMonitor(int grpIdPre, int grpIdPost, const std::string &fname)
Sets a connection monitor for a group, custom ConnectionMonitor class.
void setISTDP(int grpId, bool isSet, STDPType type, ExpCurve curve)
RangeDelay getDelayRange(short int connId)
void setDefaultSTPparams(int neurType, float STP_U, float STP_tau_u, float STP_tau_x)
void startTesting(bool shallUpdateWeights=true)
enters a testing phase, where all weight updates are disabled
#define MAX_NUM_CUDA_DEVICES
@ MUST_BE_IN_RANGE
parameter must be in some range
int getNumNeuronsGenInh()
int getGroupId(std::string grpName)
RangeWeight getWeightRange(short int connId)
bool isPoissonGroup(int grpId)
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
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 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)
@ CANNOT_BE_NULL
parameter cannot have NULL value
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.
SpikeMonitor * setSpikeMonitor(int gid, FILE *fid)
sets up a spike monitor registered with a callback to process the spikes, there can only be one Spike...
@ PULSE_CURVE
symmetric pulse curve
float tauPlus
the time constant of the exponential curve at pre-post side
float delta
the range of inhibitory LTD
void setSpikeRate(int grpId, PoissonRate *spikeRate, int refPeriod)
void startTesting(bool updateWeights)
@ FILE_CANNOT_OPEN
could not open file
void setDefaultISTDPparams(float betaLTP, float betaLTD, float lambda, float delta, STDPType stdpType)
sets default values for I-STDP params
GroupNeuromodulatorInfo getGroupNeuromodulatorInfo(int grpId)
int getMaxNumCompConnections()
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
@ CANNOT_BE_CONN_TWICE
cannot be connected twice
void setupNetwork()
build the network
GroupSTDPInfo getGroupSTDPInfo(int grpId)
returns the stdp information of a group specified by grpId
void biasWeights(short int connId, float bias, bool updateWeightRange)
int getNumNeuronsRegInh()
static const char * stdpType_string[]
#define CARLSIM_WARN(where, what)
int createGroup(const std::string &grpName, const Grid3D &grid, int neurType, int preferredPartition, ComputingBackend preferredBackend)
Creates a group of Izhikevich spiking neurons.
float alphaMinus
the amplitude of the exponential curve at post-pre side
void setISTDP(int grpId, bool isSet)
Sets default I-STDP mode and parameters.
GroupNeuromodulatorInfo getGroupNeuromodulatorInfo(int grpId)
a range struct for synaptic delays
int getGroupEndNeuronId(int gGrpId)
STDPCurve stdpCurve
the type of STDP curve
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.
int getNumNeurons()
Returns the number of neurons for which to generate Poisson spike trains.
@ WRONG_NEURON_TYPE
function cannot be applied to neuron type
float tauPlus
the time constant of the exponential curve at pre-post side
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.
void setCompartmentParameters(int grpId, float couplingUp, float couplingDown)
void setupNetwork()
build the network
float betaLTD
the amplitude of inhibitory LTD
void stopTesting()
exits a testing phase, making weight updates possible again
RangeDelay getDelayRange(short int connId)
returns the RangeDelay struct for a specific connection ID
short int connect(int grpId1, int grpId2, ConnectionGenerator *conn, bool synWtType)
std::vector< float > getConductanceNMDA(int grpId)
gets NMDA vector of a group
int createGroup(const std::string &grpName, const Grid3D &grid, int neurType, int preferredPartition, ComputingBackend preferredBackend)
float alphaMinus
the amplitude of the exponential curve at post-pre side
NeuronMonitor * setNeuronMonitor(int gid, FILE *fid)
sets up a neuron monitor registered with a callback to process the neuron state values,...
bool isPoissonGroup(int gGrpId)
#define ALL
CARLsim common definitions.
const FILE * getLogFpLog()
uint8_t * getDelays(int gIDpre, int gIDpost, int &Npre, int &Npost)
gets delays
int createSpikeGeneratorGroup(const std::string &grpName, int nNeur, int neurType, int preferredPartition, ComputingBackend preferredBackend)
int getGroupId(std::string grpName)
void setSTDP(int grpId, bool isSet)
Sets default STDP mode and params.
int createGroupLIF(const std::string &grpName, const Grid3D &grid, int neurType, int preferredPartition, ComputingBackend preferredBackend)
short int connect(int grpId1, int grpId2, ConnectionGenerator *conn, float mulSynFast, float mulSynSlow, bool synWtType)
int getNumSynapticConnections(short int connectionId)
returns the number of connections associated with a connection ID
float tauMinus
the time constant of the exponential curve at post-pre side
ComputingBackend
computing backend
const FILE * getLogFpInf()
returns file pointer to info log
SpikeMonitor * getSpikeMonitor(int grpId)
Returns pointer to existing SpikeMonitor object, NULL else.
void setExternalCurrent(int grpId, float current)
bool isInhibitoryGroup(int grpId)
returns
int createSpikeGeneratorGroup(const std::string &grpName, const Grid3D &grid, int neurType, int preferredPartition, ComputingBackend preferredBackend)
Creates a spike generator group (dummy-neurons, not Izhikevich spiking neurons)
std::vector< float > getConductanceAMPA(int grpId)
void setWeight(short int connId, int neurIdPre, int neurIdPost, float weight, bool updateWeightRange=false)
sets the weight value of a specific synapse
#define MAX_NUM_COMP_CONN
float gamma
the turn-over point
SpikeMonitor * getSpikeMonitor(int grpId)
Returns the number of spikes per neuron for a certain group.
const FILE * getLogFpDeb()
int getGroupNumNeurons(int grpId)
Point3D getNeuronLocation3D(int neurId)
void setIntegrationMethod(integrationMethod_t method, int numStepsPerMs)
Sets the integration method and the number of integration steps per 1ms simulation time step.
void scaleWeights(short int connId, float scale, bool updateWeightRange=false)
const FILE * getLogFpErr()
returns file pointer to error log
const FILE * getLogFpErr()
void setISTDP(int grpId, bool isSet)
Impl(CARLsim *sim, const std::string &netName, SimMode prferredSimMode, LoggerMode loggerMode, int randSeed)
int getSimTimeSec()
returns
CARLsim User Interface This class provides a user interface to the public sections of CARLsimCore sou...
short int connect(int grpId1, int grpId2, const std::string &connType, const RangeWeight &wt, float connProb, const RangeDelay &delay, const RadiusRF &radRF, bool synWtType, float mulSynFast, float mulSynSlow)
RangeWeight getWeightRange(short int connId)
returns the RangeWeight struct for a specific connection ID
void setHomeostasis(int grpId, bool isSet, float homeoScale, float avgTimeScale)
A struct to assign exponential STDP curves.
float lambda
the range of inhibitory LTP
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...
@ CANNOT_BE_UNKNOWN
parameter cannot be of type UNKNOWN
int getNumNeuronsGenInh()
Grid3D getGroupGrid3D(int grpId)
@ DA_MOD
dopamine-modulated STDP, nearest-neighbor
const FILE * getLogFpInf()
function writes population weights from gIDpre to gIDpost to file fname in binary.
bool isGroupWithHomeostasis(int grpId)
Returns whether a group has homeostasis enabled.
void setNeuronParameters(int grpId, float izh_C, float izh_k, float izh_vr, float izh_vt, float izh_a, float izh_b, float izh_vpeak, float izh_c, float izh_d)
A struct to arrange neurons on a 3D grid (a primitive cubic Bravais lattice with cubic side length 1)
@ CUSTOM
Custom mode, the user can set the location of all the file pointers.
float betaLTP
the amplitude of inhibitory LTP
short int connectCompartments(int grpIdLower, int grpIdUpper)
void setHomeostasis(int grpId, bool isSet, float homeoScale, float avgTimeScale)
Sets the homeostasis parameters. g is the grpID, enable=true(false) enables(disables) homeostasis,...
GroupMonitor * setGroupMonitor(int grpId, const std::string &fname)
void setSpikeRate(int grpId, PoissonRate *spikeRate, int refPeriod)
Sets the Poisson spike rate for a group. For information on how to set up spikeRate,...
void setESTDP(int grpId, bool isSet, STDPType type, STDPCurve curve, float alphaPlus, float tauPlus, float alphaMinus, float tauMinus, float gamma)
Set the spike-timing-dependent plasticity (STDP) for a neuron group.
float alphaPlus
the amplitude of the exponential curve at pre-post side
uint8_t * getDelays(int gIDpre, int gIDpost, int &Npre, int &Npost)
void setESTDP(int grpId, bool isSet)
Sets default E-STDP mode and parameters.
@ SETUP_STATE
setup state, where the neural network is prepared for execution and monitors are set
void setESTDP(int grpId, bool isSet, STDPType type, ExpCurve curve)
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 getNumSynapticConnections(short int connectionId)
int getNumNeuronsGenExc()
returns the total number of excitatory spike generator neurons
int createSpikeGeneratorGroup(const std::string &grpName, const Grid3D &grid, int neurType, int preferredPartition, ComputingBackend preferredBackend)
int getNumSynapticConnections(short int connectionId)
gets number of connections associated with a connection ID
void setIntegrationMethod(integrationMethod_t method, int numStepsPerMs)
SpikeMonitor * setSpikeMonitor(int grpId, const std::string &fileName)
STDPCurve stdpCurve
the type of STDP curve
void setConductances(bool isSet)
Struct defines the minimum and maximum membrane resisatnces of the LIF neuron group.
@ CONFIG_STATE
configuration state, where the neural network is configured
@ STANDARD
standard STDP of Bi & Poo (2001), nearest-neighbor
const FILE * getLogFpDeb()
returns file pointer to debug log
int getGroupNumNeurons(int grpId)
returns the number of neurons of a group specified by grpId
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 the Izhikevich parameters a, b, c, and d of a neuron group.
int createGroupLIF(const std::string &grpName, const Grid3D &grid, int neurType, int preferredPartition, ComputingBackend preferredBackend)
Creates a group of LIF spiking neurons.
Point3D getNeuronLocation3D(int neurId)
void setHomeoBaseFiringRate(int groupId, float baseFiring, float baseFiringSD)
Sets homeostatic target firing rate (enforced through homeostatic synaptic scaling)
bool isInhibitoryGroup(int gGrpId)
std::string getGroupName(int 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 isGroupWithHomeostasis(int grpId)
returns whether group has homeostasis enabled (true) or not (false)
void setSTDP(int grpId, bool isSet)
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)
std::vector< float > getConductanceGABAa(int grpId)
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.
Contains all of CARLsim's core functionality.
std::vector< float > getConductanceGABAb(int grpId)
RangeWeight getWeightRange(short int connId)
returns RangeWeight struct of a connection
@ MUST_BE_SET_TO
parameter must be set to
void scaleWeights(short int connId, float scale, bool updateWeightRange)
void setISTDP(int grpId, bool isSet, STDPType type, PulseCurve curve)
void setNeuromodulator(int grpId, float baseDP, float tauDP, float base5HT, float tau5HT, float baseACh, float tauACh, float baseNE, float tauNE)
void setSTDP(int grpId, bool isSet, STDPType type, float alphaPlus, float tauPlus, float alphaMinus, float tauMinus)
void setNeuronParametersLIF(int grpId, int tau_m, int tau_ref, float vTh, float vReset, const RangeRmem &rMem)
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
static void assertTrue(bool statement, errorType errorIfAssertionFails, std::string errorFunc, std::string errorMsgPrefix="", std::string errorMsgSuffix="")
simple wrapper for assert statement
UpdateInterval
Update frequency for weights.
bool isExcitatoryGroup(int gGrpId)
std::string getGroupName(int grpId)
@ CANNOT_BE_NEGATIVE
parameter cannot have negative value (opposite to "must be", but includes zero)
void setESTDP(int grpId, bool isSet, STDPType type, TimingBasedCurve curve)
@ UNKNOWN_CURVE
unknown curve type
uint8_t * getDelays(int gGrpIdPre, int gGrpIdPost, int &numPreN, int &numPostN)
Returns the delay information for all synaptic connections between a pre-synaptic and a post-synaptic...
SpikeMonitor * setSpikeMonitor(int grpId, const std::string &fileName)
Sets a Spike Monitor for a groups, prints spikes to binary file.
@ CANNOT_BE_CONN_SYN_AND_COMP
cannot be both synaptically and compartmentally connected
void setSTP(int grpId, bool isSet, float STP_U, float STP_tau_u, float STP_tau_x)
@ ALL_NOT_ALLOWED
keyword ALL is not allowed for this variable
void setISTDP(int grpId, bool isSet, STDPType type, STDPCurve curve, float ab1, float ab2, float tau1, float tau2)
Set the inhibitory spike-timing-dependent plasticity (STDP) with anti-hebbian curve for a neuron grou...
ConnectionMonitor * setConnectionMonitor(int grpIdPre, int grpIdPost, FILE *fid)
sets up a network monitor registered with a callback to process the spikes.
void setSTP(int grpId, bool isSet)
int getNumNeuronsGenExc()
float alphaPlus
the amplitude of the exponential curve at pre-post side
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,...
Grid3D getGroupGrid3D(int grpId)
void setWeightAndWeightChangeUpdate(UpdateInterval wtANDwtChangeUpdateInterval, bool enableWtChangeDecay, float wtChangeDecay=0.9f)
Sets the weight and weight change update parameters.
bool isGroupWithHomeostasis(int grpId)
bool isExcitatoryGroup(int grpId)
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) CARLsim implements the short...
#define INHIBITORY_NEURON
CARLsimState getCARLsimState()
Point3D getNeuronLocation3D(int grpId, int relNeurId)
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.
int createGroup(const std::string &grpName, int nNeur, int neurType, int preferredPartition, ComputingBackend preferredBackend)
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
RangeDelay getDelayRange(short int connId)
returns the RangeDelay struct of a connection
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.
void setConductances(bool isSet, int tdAMPA, int trNMDA, int tdNMDA, int tdGABAa, int trGABAb, int tdGABAb)
void setWeightAndWeightChangeUpdate(UpdateInterval wtANDwtChangeUpdateInterval, bool enableWtChangeDecay, float wtChangeDecay)
void setNeuronParameters(int grpId, float izh_a, float izh_b, float izh_c, float izh_d)
const FILE * getLogFpLog()
returns file pointer to log file
void setESTDP(int grpId, bool isSet)
void setWeight(short int connId, int neurIdPre, int neurIdPost, float weight, bool updateWeightRange)
int getNumNeuronsGenInh()
returns the total number of inhibitory spike generator neurons
float tauMinus
the time constant of the exponential curve at post-pre side
const FILE * getLogFpLog()
returns file pointer to log file