CARLsim
5.0.0
CARLsim: a GPU-accelerated SNN simulator
|
Go to the documentation of this file.
66 #if CREATE_SPIKEDIR_IF_NOT_EXISTS
67 #if defined(WIN32) || defined(WIN64)
86 loggerMode_ = loggerMode;
87 preferredSimMode_ = prferredSimMode;
94 hasSetHomeoALL_ =
false;
95 hasSetHomeoBaseFiringALL_ =
false;
96 hasSetSTDPALL_ =
false;
97 hasSetSTPALL_ =
false;
98 hasSetConductances_ =
false;
113 for (
int i=0; i<spkGen_.size(); i++) {
114 if (spkGen_[i]!=NULL)
118 for (
int i=0; i<connGen_.size(); i++) {
119 if (connGen_[i]!=NULL)
132 short int connect(
int grpId1,
int grpId2,
const std::string& connType,
const RangeWeight& wt,
float connProb,
133 const RangeDelay& delay,
const RadiusRF& radRF,
bool synWtType,
float mulSynFast,
float mulSynSlow)
136 std::stringstream grpId1str; grpId1str <<
"Group Id " << grpId1;
137 std::stringstream grpId2str; grpId2str <<
"Group Id " << grpId2;
141 " is PoissonGroup, connect");
146 "Connection Probability connProb",
"[0,1]");
152 || connType.compare(
"gaussian")==0 && (radRF.
radX>-1 || radRF.
radY>-1 || radRF.
radZ>-1),
164 if (connType.compare(
"one-to-one")==0 && (radRF.
radX>0 || radRF.
radY>0 || radRF.
radZ>0)) {
165 userWarnings_.push_back(
"RadiusRF>0 will be ignored for connection type \"one-to-one\"");
169 if (fabs(wt.
min)>1e-15) {
170 std::cerr << funcName <<
": " << wt <<
". Non-zero minimum weights are not yet supported.\n" << std::endl;
177 grpId1str.str() +
" and " + grpId2str.str());
181 grpId1str.str() +
" and " + grpId2str.str());
184 connSyn_[grpId1].push_back(grpId2);
187 radRF, mulSynFast, mulSynSlow, synWtType);
193 std::stringstream grpId1str; grpId1str <<
". Group Id " << grpId1;
194 std::stringstream grpId2str; grpId2str <<
". Group Id " << grpId2;
198 " is PoissonGroup, connect");
207 grpId1str.str() +
" and " + grpId2str.str());
210 grpId1str.str() +
" and " + grpId2str.str());
213 connSyn_[grpId1].push_back(grpId2);
218 connGen_.push_back(CGC);
219 return snn_->
connect(grpId1, grpId2, CGC, 1.0f, 1.0f, synWtType);
227 std::stringstream grpId1str; grpId1str <<
". Group Id " << grpId1;
228 std::stringstream grpId2str; grpId2str <<
". Group Id " << grpId2;
232 " is PoissonGroup, connect");
237 funcName,
"CONFIG.");
243 grpId1str.str() +
" and " + grpId2str.str());
246 grpId1str.str() +
" and " + grpId2str.str());
249 connSyn_[grpId1].push_back(grpId2);
253 connGen_.push_back(CGC);
254 return snn_->
connect(grpId1, grpId2, CGC, mulSynFast, mulSynSlow, synWtType);
258 std::stringstream funcName; funcName <<
"connectCompartments(" << grpIdLower <<
"," << grpIdUpper <<
")";
261 std::stringstream grpIdLowerStr; grpIdLowerStr <<
"Group Id " << grpIdLower;
262 std::stringstream grpIdUpperStr; grpIdUpperStr <<
"Group Id " << grpIdUpper;
264 grpIdLowerStr.str(),
"[0,getNumGroups()]");
266 grpIdUpperStr.str(),
"[0,getNumGroups()]");
268 grpIdLowerStr.str() +
" and " + grpIdUpperStr.str());
272 grpIdLowerStr.str() +
" is PoissonGroup, connectCompartments");
274 grpIdUpperStr.str() +
" is PoissonGroup, connectCompartments");
279 grpIdUpperStr.str());
284 grpIdUpperStr.str());
289 grpIdLowerStr.str() +
" and " + grpIdUpperStr.str());
292 grpIdLowerStr.str() +
" and " + grpIdUpperStr.str());
295 UserErrors::assertTrue(std::find(connComp_[grpIdLower].begin(), connComp_[grpIdLower].end(), grpIdUpper) ==
297 grpIdLowerStr.str() +
" and " + grpIdUpperStr.str());
298 UserErrors::assertTrue(std::find(connComp_[grpIdUpper].begin(), connComp_[grpIdUpper].end(), grpIdLower) ==
300 grpIdLowerStr.str() +
" and " + grpIdUpperStr.str());
304 funcName.str(),
"Number of compartmental connections for group " + grpIdLowerStr.str(),
305 "[0,getMaxNumCompConnections()");
307 funcName.str(),
"Number of compartmental connections for group " + grpIdUpperStr.str(),
308 "[0,getMaxNumCompConnections()");
311 connComp_[grpIdLower].push_back(grpIdUpper);
312 connComp_[grpIdUpper].push_back(grpIdLower);
319 return createGroup(grpName,
Grid3D(nNeur,1,1), neurType, preferredPartition, preferredBackend);
324 return createGroupLIF(grpName,
Grid3D(nNeur,1,1), neurType, preferredPartition, preferredBackend);
329 std::string funcName =
"createGroup(\""+grpName+
"\")";
331 funcName,
"CONFIG.");
339 userWarnings_.push_back(
"Make sure to call setSTP on group "+grpName);
341 userWarnings_.push_back(
"Make sure to call setSTDP on group "+grpName);
343 userWarnings_.push_back(
"Make sure to call setHomeostasis on group "+grpName);
344 if (hasSetHomeoBaseFiringALL_)
345 userWarnings_.push_back(
"Make sure to call setHomeoBaseFiringRate on group "+grpName);
347 int grpId = snn_->
createGroup(grpName.c_str(), grid, neurType, preferredPartition, preferredBackend);
348 grpIds_.push_back(grpId);
350 int partitionOffset = 0;
355 int prefPartition = preferredPartition + partitionOffset;
356 groupPrefNetIds_.insert(std::pair<int, int>(grpId, prefPartition));
359 connSyn_.resize(grpIds_.size());
360 connComp_.resize(grpIds_.size());
367 std::string funcName =
"createGroupLIF(\""+grpName+
"\")";
369 funcName,
"CONFIG.");
377 userWarnings_.push_back(
"Make sure to call setSTP on group "+grpName);
379 userWarnings_.push_back(
"Make sure to call setSTDP on group "+grpName);
381 userWarnings_.push_back(
"Make sure to call setHomeostasis on group "+grpName);
382 if (hasSetHomeoBaseFiringALL_)
383 userWarnings_.push_back(
"Make sure to call setHomeoBaseFiringRate on group "+grpName);
385 int grpId = snn_->
createGroupLIF(grpName.c_str(), grid, neurType, preferredPartition, preferredBackend);
386 grpIds_.push_back(grpId);
388 int partitionOffset = 0;
393 int prefPartition = preferredPartition + partitionOffset;
394 groupPrefNetIds_.insert(std::pair<int, int>(grpId, prefPartition));
397 connSyn_.resize(grpIds_.size());
398 connComp_.resize(grpIds_.size());
410 std::string funcName =
"createSpikeGeneratorGroup(\""+grpName+
"\")";
412 funcName,
"CONFIG.");
418 grpIds_.push_back(grpId);
421 connSyn_.resize(grpIds_.size());
422 connComp_.resize(grpIds_.size());
428 std::string funcName =
"setCompartmentParameters(\"" +
getGroupName(grpId) +
"\")";
438 std::stringstream funcName; funcName <<
"setConductances(" << isSet <<
")";
440 funcName.str(),
"CONFIG.");
441 hasSetConductances_ =
true;
444 snn_->
setConductances(
true,def_tdAMPA_,0,def_tdNMDA_,def_tdGABAa_,0,def_tdGABAb_);
452 std::stringstream funcName; funcName <<
"setConductances(" << isSet <<
"," << tdAMPA <<
"," << tdNMDA <<
","
453 << tdGABAa <<
"," << tdGABAb <<
")";
459 funcName.str(),
"CONFIG.");
460 hasSetConductances_ =
true;
470 void setConductances(
bool isSet,
int tdAMPA,
int trNMDA,
int tdNMDA,
int tdGABAa,
int trGABAb,
473 std::stringstream funcName; funcName <<
"setConductances(" << isSet <<
"," << tdAMPA <<
"," << trNMDA <<
"," <<
474 tdNMDA <<
"," << tdGABAa <<
"," << trGABAb <<
"," << tdGABAb <<
")";
483 "trGABAb and tdGABAb");
485 funcName.str(),
"CONFIG.");
486 hasSetConductances_ =
true;
489 snn_->
setConductances(
true,tdAMPA,trNMDA,tdNMDA,tdGABAa,trGABAb,tdGABAb);
497 std::string funcName =
"setHomeostasis(\""+
getGroupName(grpId)+
"\")";
501 funcName,
"CONFIG.");
503 hasSetHomeoALL_ = grpId==
ALL;
506 snn_->
setHomeostasis(grpId,
true,def_homeo_scale_,def_homeo_avgTimeScale_);
507 if (grpId!=
ALL && hasSetHomeoBaseFiringALL_)
508 userWarnings_.push_back(
"Make sure to call setHomeoBaseFiringRate on group "
516 void setHomeostasis(
int grpId,
bool isSet,
float homeoScale,
float avgTimeScale) {
517 std::string funcName =
"setHomeostasis(\""+
getGroupName(grpId)+
"\")";
523 hasSetHomeoALL_ = grpId==
ALL;
527 if (grpId!=
ALL && hasSetHomeoBaseFiringALL_)
528 userWarnings_.push_back(
"Make sure to call setHomeoBaseFiringRate on group "
537 std::string funcName =
"setHomeoBaseFiringRate(\""+
getGroupName(grpId)+
"\")";
540 funcName,
" Must call setHomeostasis first.");
544 hasSetHomeoBaseFiringALL_ = grpId==
ALL;
551 std::string funcName =
"setIntegrationMethod()";
555 "numStepsPerMs",
"[1, 100]");
564 float izh_c,
float izh_c_sd,
float izh_d,
float izh_d_sd)
566 std::string funcName =
"setNeuronParameters(\""+
getGroupName(grpId)+
"\")";
572 snn_->
setNeuronParameters(grpId, izh_a, izh_a_sd, izh_b, izh_b_sd, izh_c, izh_c_sd, izh_d, izh_d_sd);
577 std::string funcName =
"setNeuronParameters(\""+
getGroupName(grpId)+
"\")";
580 funcName,
"CONFIG.");
587 float izh_a,
float izh_b,
float izh_vpeak,
float izh_c,
float izh_d)
589 std::string funcName =
"setNeuronParameters(\"" +
getGroupName(grpId) +
"\")";
596 izh_a, 0.0f, izh_b, 0.0f, izh_vpeak, 0.0f, izh_c, 0.0f, izh_d, 0.0f);
601 float izh_vr,
float izh_vr_sd,
float izh_vt,
float izh_vt_sd,
602 float izh_a,
float izh_a_sd,
float izh_b,
float izh_b_sd,
603 float izh_vpeak,
float izh_vpeak_sd,
float izh_c,
float izh_c_sd,
604 float izh_d,
float izh_d_sd)
606 std::string funcName =
"setNeuronParameters(\"" +
getGroupName(grpId) +
"\")";
612 snn_->
setNeuronParameters(grpId, izh_C, izh_C_sd, izh_k, izh_k_sd, izh_vr, izh_vr_sd, izh_vt, izh_vt_sd,
613 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);
619 std::string funcName =
"setNeuronParametersLIF(\"" +
getGroupName(grpId) +
"\")";
636 void setNeuromodulator(
int grpId,
float baseDP,
float tauDP,
float base5HT,
float tau5HT,
float baseACh,
637 float tauACh,
float baseNE,
float tauNE)
639 std::string funcName =
"setNeuromodulator(\""+
getGroupName(grpId)+
"\")";
649 funcName,
"CONFIG.");
651 snn_->
setNeuromodulator(grpId, baseDP, tauDP, base5HT, tau5HT, baseACh, tauACh, baseNE, tauNE);
655 std::string funcName =
"setNeuromodulator(\""+
getGroupName(grpId)+
"\")";
661 funcName,
"CONFIG.");
663 snn_->
setNeuromodulator(grpId, 1.0f, tauDP, 1.0f, tau5HT, 1.0f, tauACh, 1.0f, tauNE);
672 void setSTDP(
int grpId,
bool isSet,
STDPType type,
float alphaPlus,
float tauPlus,
float alphaMinus,
675 setESTDP(grpId, isSet, type,
ExpCurve(alphaPlus, tauPlus, alphaMinus, tauMinus));
680 std::string funcName =
"setESTDP(\""+
getGroupName(grpId)+
"\")";
684 funcName,
"CONFIG.");
686 hasSetSTDPALL_ = grpId==
ALL;
689 snn_->
setESTDP(grpId,
true, def_STDP_type_,
EXP_CURVE, def_STDP_alphaLTP_, def_STDP_tauLTP_,
690 def_STDP_alphaLTD_, def_STDP_tauLTD_, 0.0f);
703 funcName,
"CONFIG.");
705 hasSetSTDPALL_ = grpId==
ALL;
722 funcName,
"CONFIG.");
724 hasSetSTDPALL_ = grpId==
ALL;
736 std::string funcName =
"setISTDP(\""+
getGroupName(grpId)+
"\")";
740 funcName,
"CONFIG.");
742 hasSetSTDPALL_ = grpId==
ALL;
745 snn_->
setISTDP(grpId,
true, def_STDP_type_,
PULSE_CURVE, def_STDP_betaLTP_, def_STDP_betaLTD_,
746 def_STDP_lambda_, def_STDP_delta_);
759 funcName,
"CONFIG.");
761 hasSetSTDPALL_ = grpId==
ALL;
778 funcName,
"CONFIG.");
780 hasSetSTDPALL_ = grpId==
ALL;
791 std::string funcName =
"setSTP(\""+
getGroupName(grpId)+
"\")";
793 funcName,
"CONFIG.");
795 hasSetSTPALL_ = grpId==
ALL;
802 snn_->
setSTP(grpId,
true,def_STP_U_exc_,def_STP_tau_u_exc_,def_STP_tau_x_exc_);
804 snn_->
setSTP(grpId,
true,def_STP_U_inh_,def_STP_tau_u_inh_,def_STP_tau_x_inh_);
809 snn_->
setSTP(grpId,
false,0.0f,0.0f,0.0f);
814 void setSTP(
int grpId,
bool isSet,
float STP_U,
float STP_tau_u,
float STP_tau_x) {
815 std::string funcName =
"setSTP(\""+
getGroupName(grpId)+
"\")";
817 funcName,
"CONFIG.");
819 hasSetSTPALL_ = grpId==
ALL;
825 snn_->
setSTP(grpId,
true,STP_U,STP_tau_u,STP_tau_x);
827 snn_->
setSTP(grpId,
false,0.0f,0.0f,0.0f);
834 std::string funcName =
"setWeightAndWeightChangeUpdate()";
838 funcName,
"CONFIG.");
848 std::string funcName =
"runNetwork()";
855 if (!hasSetConductances_) {
856 userWarnings_.push_back(
"setConductances has not been called. Setting simulation mode to CUBA.");
860 handleUserWarnings();
865 return snn_->
runNetwork(nSec, nMsec, printRunSummary);
870 std::string funcName =
"setupNetwork()";
872 funcName,
"CONFIG.");
887 FILE* fpSave = fopen(fileName.c_str(),
"wb");
888 std::string funcName =
"saveSimulation()";
899 std::string funcName =
"setLogFile("+fileName+
")";
903 std::string fileNameNonConst = fileName;
904 std::transform(fileNameNonConst.begin(), fileNameNonConst.end(), fileNameNonConst.begin(), ::tolower);
905 if (fileNameNonConst==
"null") {
906 #if defined(WIN32) || defined(WIN64)
907 fpLog = fopen(
"nul",
"w");
909 fpLog = fopen(
"/dev/null",
"w");
912 fpLog = fopen(fileName.c_str(),
"w");
917 snn_->
setLogsFp(NULL, NULL, NULL, fpLog);
924 snn_->
setLogsFp(fpInf,fpErr,fpDeb,fpLog);
931 void biasWeights(
short int connId,
float bias,
bool updateWeightRange) {
932 std::stringstream funcName; funcName <<
"biasWeights(" << connId <<
"," << bias <<
"," << updateWeightRange <<
937 "connId",
"[0,getNumConnections()]");
939 snn_->
biasWeights(connId, bias, updateWeightRange);
943 std::string funcName =
"startTesting()";
950 std::string funcName =
"stopTesting()";
958 std::string funcName =
"loadSimulation()";
960 funcName,
"CONFIG.");
966 void scaleWeights(
short int connId,
float scale,
bool updateWeightRange) {
967 std::stringstream funcName; funcName <<
"scaleWeights(" << connId <<
"," << scale <<
"," << updateWeightRange
972 "connId",
"[0,getNumConnections()]");
981 +
"\",\"" + fname +
"\")";
990 std::string fileName = fname;
991 std::transform(fileName.begin(), fileName.end(), fileName.begin(), ::tolower);
992 if (fileName ==
"null") {
997 if (fileName ==
"default") {
1003 fid = fopen(fileName.c_str(),
"wb");
1007 std::string fileError =
" Double-check file permissions and make sure directory exists.";
1017 std::string funcName =
"setExternalCurrent(\""+
getGroupName(grpId)+
"\")";
1020 "current.size()",
"number of neurons in the group.");
1029 std::string funcName =
"setExternalCurrent(\""+
getGroupName(grpId)+
"\")";
1041 std::string funcName =
"setGroupMonitor(\""+
getGroupName(grpId)+
"\",\""+fname+
"\")";
1048 std::string fileName = fname;
1049 std::transform(fileName.begin(), fileName.end(), fileName.begin(), ::tolower);
1050 if (fileName ==
"null") {
1055 if (fileName ==
"default") {
1056 fileName =
"results/grp_" + snn_->
getGroupName(grpId) +
".dat";
1061 fid = fopen(fileName.c_str(),
"wb");
1065 std::string fileError =
" Double-check file permissions and make sure directory exists.";
1076 std::string funcName =
"setSpikeGenerator(\""+
getGroupName(grpId)+
"\")";
1081 funcName,
"CONFIG.");
1085 spkGen_.push_back(SGC);
1091 std::string funcName =
"setSpikeMonitor(\""+
getGroupName(grpId)+
"\",\""+fileName+
"\")";
1098 std::string fileNameLower = fileName;
1099 std::transform(fileNameLower.begin(), fileNameLower.end(), fileNameLower.begin(), ::tolower);
1100 if (fileNameLower ==
"null") {
1105 if (fileNameLower ==
"default") {
1106 std::string fileNameDefault =
"results/spk_" + snn_->
getGroupName(grpId) +
".dat";
1107 fid = fopen(fileNameDefault.c_str(),
"wb");
1109 std::string fileError =
" Make sure results/ exists.";
1113 fid = fopen(fileName.c_str(),
"wb");
1115 std::string fileError =
" Double-check file permissions and make sure directory exists.";
1127 std::string funcName =
"setNeuronMonitor(\"" +
getGroupName(grpId) +
"\",\"" + fileName +
"\")";
1134 std::string fileNameLower = fileName;
1135 std::transform(fileNameLower.begin(), fileNameLower.end(), fileNameLower.begin(), ::tolower);
1136 if (fileNameLower ==
"null") {
1142 if (fileNameLower ==
"default") {
1143 std::string fileNameDefault =
"results/n_" + snn_->
getGroupName(grpId) +
".dat";
1144 fid = fopen(fileNameDefault.c_str(),
"wb");
1146 std::string fileError =
" Make sure results/ exists.";
1151 fid = fopen(fileName.c_str(),
"wb");
1153 std::string fileError =
" Double-check file permissions and make sure directory exists.";
1165 std::string funcName =
"setSpikeRate()";
1170 funcName,
"PoissonRate length and the number of neurons in the group");
1178 void setWeight(
short int connId,
int neurIdPre,
int neurIdPost,
float weight,
bool updateWeightRange) {
1179 std::stringstream funcName; funcName <<
"setWeight(" << connId <<
"," << neurIdPre <<
"," << neurIdPost <<
","
1180 << updateWeightRange <<
")";
1184 funcName.str(),
"connectionId",
"[0,getNumConnections()]");
1187 snn_->
setWeight(connId, neurIdPre, neurIdPost, weight, updateWeightRange);
1196 std::string funcName =
"getConductanceAMPA()";
1198 funcName, funcName,
"RUN.");
1201 "[0,getNumGroups()]");
1207 std::string funcName =
"getConductanceNMDA()";
1209 funcName, funcName,
"RUN.");
1212 "[0,getNumGroups()]");
1218 std::string funcName =
"getConductanceGABAa()";
1220 funcName, funcName,
"RUN.");
1223 "[0,getNumGroups()]");
1229 std::string funcName =
"getConductanceGABAb()";
1231 funcName, funcName,
"RUN.");
1234 "[0,getNumGroups()]");
1240 std::stringstream funcName; funcName <<
"getDelayRange(" << connId <<
")";
1242 "connId",
"[0,getNumConnections()]");
1248 uint8_t*
getDelays(
int gIDpre,
int gIDpost,
int& Npre,
int& Npost) {
1249 std::string funcName =
"getDelays()";
1253 "[0,getNumGroups()]");
1255 "[0,getNumGroups()]");
1257 return snn_->
getDelays(gIDpre,gIDpost,Npre,Npost);
1261 std::stringstream funcName; funcName <<
"getGroupGrid3D(" << grpId <<
")";
1264 "grpId",
"[0,getNumGroups()]");
1274 std::stringstream funcName; funcName <<
"getGroupName(" << grpId <<
")";
1276 "grpId",
"[0,getNumGroups()] or must be ALL.");
1282 std::stringstream funcName; funcName <<
"getGroupStartNeuronId(" << grpId <<
")";
1286 "[0,getNumGroups()]");
1292 std::stringstream funcName; funcName <<
"getGroupEndNeuronId(" << grpId <<
")";
1296 "[0,getNumGroups()]");
1302 std::stringstream funcName; funcName <<
"getGroupNumNeurons(" << grpId <<
")";
1304 "[0,getNumGroups()]");
1310 std::stringstream funcName; funcName <<
"getNeuronLocation3D(" << neurId <<
")";
1315 "neurId",
"[0,getNumNeurons()]");
1321 std::stringstream funcName; funcName <<
"getNeuronLocation3D(" << grpId <<
"," << relNeurId <<
")";
1324 "grpId",
"[0,getNumGroups()]");
1326 funcName.str(),
"relNeurId",
"[0,getGroupNumNeurons()]");
1344 std::stringstream funcName; funcName <<
"getNumConnections(" << connectionId <<
")";
1349 funcName.str(),
"connectionId",
"[0,getNumSynapticConnections()]");
1354 std::string funcName =
"getNumSynapses()";
1362 std::stringstream funcName; funcName <<
"getGroupSTDPInfo(" << grpId <<
")";
1364 "grpId",
"[0,getNumGroups()]");
1370 std::stringstream funcName; funcName <<
"getGroupNeuromodulatorInfo(" << grpId <<
")";
1372 "grpId",
"[0,getNumGroups()]");
1382 std::stringstream funcName; funcName <<
"getSpikeMonitor(" << grpId <<
")";
1384 "grpId",
"[0,getNumGroups()]");
1390 std::stringstream funcName; funcName <<
"getWeightRange(" << connId <<
")";
1392 "connId",
"[0,getNumConnections()]");
1398 std::stringstream funcName; funcName <<
"isConnectionPlastic(" << connId <<
")";
1400 "connId",
"[0,getNumConnections()]");
1406 std::stringstream funcName; funcName <<
"isGroupWithHomeostasis(" << grpId <<
")";
1408 "connId",
"[0,getNumGroups()]");
1414 std::stringstream funcName; funcName <<
"isExcitatoryGroup(" << grpId <<
")";
1416 "connId",
"[0,getNumGroups()]");
1422 std::stringstream funcName; funcName <<
"isInhibitoryGroup(" << grpId <<
")";
1424 "connId",
"[0,getNumGroups()]");
1430 std::stringstream funcName; funcName <<
"isPoissonGroup(" << grpId <<
")";
1432 "connId",
"[0,getNumGroups()]");
1444 std::stringstream funcName; funcName <<
"setDefaultConductanceTimeConstants(" << tdAMPA <<
"," << trNMDA <<
1445 "," << tdNMDA <<
"," << tdGABAa <<
"," << trGABAb <<
"," << tdGABAb <<
")";
1454 "trGABAb and tdGABAb");
1458 def_tdAMPA_ = tdAMPA;
1459 def_trNMDA_ = trNMDA;
1460 def_tdNMDA_ = tdNMDA;
1461 def_tdGABAa_ = tdGABAa;
1462 def_trGABAb_ = trGABAb;
1463 def_tdGABAb_ = tdGABAb;
1467 std::string funcName =
"setDefaultHomeostasisparams()";
1469 funcName,
"CONFIG.");
1470 assert(avgTimeScale>0);
1472 def_homeo_scale_ = homeoScale;
1473 def_homeo_avgTimeScale_ = avgTimeScale;
1477 std::string funcName =
"setDefaultSaveOptions()";
1479 funcName,
"CONFIG.");
1481 def_save_fileName_ = fileName;
1482 def_save_synapseInfo_ = saveSynapseInfo;
1486 FILE* fpTry = fopen(def_save_fileName_.c_str(),
"wb");
1498 std::string funcName =
"setDefaultESTDPparams()";
1514 def_STDP_alphaLTP_ = alphaPlus;
1515 def_STDP_tauLTP_ = tauPlus;
1516 def_STDP_alphaLTD_ = alphaMinus;
1517 def_STDP_tauLTD_ = tauMinus;
1522 std::string funcName =
"setDefaultISTDPparams()";
1540 def_STDP_betaLTP_ = betaLTP;
1541 def_STDP_betaLTD_ = betaLTD;
1542 def_STDP_lambda_ = lambda;
1543 def_STDP_delta_ = delta;
1548 std::string funcName =
"setDefaultSTPparams()";
1553 assert(STP_tau_u>0.0f);
1554 assert(STP_tau_x>0.0f);
1558 def_STP_U_exc_ = STP_U;
1559 def_STP_tau_u_exc_ = STP_tau_u;
1560 def_STP_tau_x_exc_ = STP_tau_x;
1563 def_STP_U_inh_ = STP_U;
1564 def_STP_tau_u_inh_ = STP_tau_u;
1565 def_STP_tau_x_inh_ = STP_tau_x;
1579 void CARLsimInit() {
1580 bool gpuAllocationResult =
false;
1581 std::string funcName =
"CARLsimInit()";
1586 snn_ =
new SNN(netName_, preferredSimMode_, loggerMode_, randSeed_);
1617 bool existsGrpId(
int grpId) {
1618 return std::find(grpIds_.begin(), grpIds_.end(), grpId)!=grpIds_.end();
1622 void handleUserWarnings() {
1623 if (userWarnings_.size()) {
1624 for (
int i=0; i<userWarnings_.size(); i++) {
1628 fprintf(stdout,
"Ignore warnings and continue? Y/n ");
1629 char ignoreWarn = std::cin.get();
1630 if (std::cin.fail() || ignoreWarn!=
'y' && ignoreWarn!=
'Y') {
1631 fprintf(stdout,
"Exiting...\n");
1642 #if defined(WIN32) || defined(WIN64)
1643 static HANDLE gpuAllocationLock;
1645 static pthread_mutex_t gpuAllocationLock;
1653 std::string netName_;
1661 std::vector<std::vector<int> > connSyn_;
1664 std::vector<std::vector<int> > connComp_;
1666 std::map<int, int> groupPrefNetIds_;
1668 unsigned int numConnections_;
1669 std::vector<std::string> userWarnings_;
1671 std::vector<int> grpIds_;
1672 std::vector<SpikeGeneratorCore*> spkGen_;
1673 std::vector<ConnectionGeneratorCore*> connGen_;
1675 bool hasSetHomeoALL_;
1676 bool hasSetHomeoBaseFiringALL_;
1677 bool hasSetSTDPALL_;
1679 bool hasSetConductances_;
1691 float def_STDP_alphaLTP_;
1692 float def_STDP_tauLTP_;
1693 float def_STDP_alphaLTD_;
1694 float def_STDP_tauLTD_;
1695 float def_STDP_betaLTP_;
1696 float def_STDP_betaLTD_;
1697 float def_STDP_lambda_;
1698 float def_STDP_delta_;
1701 float def_STP_U_exc_;
1702 float def_STP_tau_u_exc_;
1703 float def_STP_tau_x_exc_;
1704 float def_STP_U_inh_;
1705 float def_STP_tau_u_inh_;
1706 float def_STP_tau_x_inh_;
1709 float def_homeo_scale_;
1710 float def_homeo_avgTimeScale_;
1713 std::string def_save_fileName_;
1714 bool def_save_synapseInfo_;
1728 #if defined(WIN32) || defined(WIN64)
1729 HANDLE CARLsim::Impl::gpuAllocationLock = CreateMutex(NULL, FALSE, NULL);
1731 pthread_mutex_t CARLsim::Impl::gpuAllocationLock = PTHREAD_MUTEX_INITIALIZER;
1736 _impl( new
Impl(this, netName, preferredSimMode, loggerMode, randSeed) ) {}
1741 const RangeDelay& delay,
const RadiusRF& radRF,
bool synWtType,
float mulSynFast,
float mulSynSlow) {
1742 return _impl->
connect(grpId1, grpId2, connType, wt, connProb, delay, radRF, synWtType, mulSynFast, mulSynSlow);
1748 return _impl->
connect(grpId1, grpId2, conn, synWtType);
1753 return _impl->
connect(grpId1, grpId2, conn, mulSynFast, mulSynSlow, synWtType);
1762 return _impl->
createGroup(grpName, grid, neurType, preferredPartition, preferredBackend);
1765 return _impl->
createGroup(grpName, nNeur, neurType, preferredPartition, preferredBackend);
1770 return _impl->
createGroupLIF(grpName, grid, neurType, preferredPartition, preferredBackend);
1773 return _impl->
createGroupLIF(grpName, nNeur, neurType, preferredPartition, preferredBackend);
1796 _impl->
setConductances(isSet, tdAMPA, trNMDA, tdNMDA, tdGABAa, trGABAb, tdGABAb);
1817 float izh_c_sd,
float izh_d,
float izh_d_sd)
1819 _impl->
setNeuronParameters(grpId, izh_a, izh_a_sd, izh_b, izh_b_sd, izh_c, izh_c_sd, izh_d, izh_d_sd);
1826 float izh_a,
float izh_b,
float izh_vpeak,
float izh_c,
float izh_d)
1828 _impl->
setNeuronParameters(grpId, izh_C, izh_k, izh_vr, izh_vt, izh_a, izh_b, izh_vpeak, izh_c, izh_d);
1832 float izh_vr,
float izh_vr_sd,
float izh_vt,
float izh_vt_sd,
1833 float izh_a,
float izh_a_sd,
float izh_b,
float izh_b_sd,
1834 float izh_vpeak,
float izh_vpeak_sd,
float izh_c,
float izh_c_sd,
1835 float izh_d,
float izh_d_sd)
1837 _impl->
setNeuronParameters(grpId, izh_C, izh_C_sd, izh_k, izh_k_sd, izh_vr, izh_vr_sd, izh_vt, izh_vt_sd,
1838 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);
1847 float tauACh,
float baseNE,
float tauNE)
1849 _impl->
setNeuromodulator(grpId, baseDP, tauDP, base5HT, tau5HT, baseACh, tauACh, baseNE, tauNE);
1864 _impl->
setSTDP(grpId, isSet, type, alphaPlus, tauPlus, alphaMinus, tauMinus);
1872 _impl->
setESTDP(grpId, isSet, type, curve);
1877 _impl->
setESTDP(grpId, isSet, type, curve);
1885 _impl->
setISTDP(grpId, isSet, type, curve);
1890 _impl->
setISTDP(grpId, isSet, type, curve);
1894 void CARLsim::setSTP(
int grpId,
bool isSet,
float STP_U,
float STP_tau_u,
float STP_tau_x) {
1895 _impl->
setSTP(grpId, isSet, STP_U, STP_tau_u, STP_tau_x);
1903 float wtChangeDecay)
1911 return _impl->
runNetwork(nSec, nMsec, printRunSummary);
1938 _impl->
biasWeights(connId, bias, updateWeightRange);
1988 void CARLsim::setWeight(
short int connId,
int neurIdPre,
int neurIdPost,
float weight,
bool updateWeightRange) {
1989 _impl->
setWeight(connId, neurIdPre, neurIdPost, weight, updateWeightRange);
2018 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