187 short int connect(
int gIDpre,
int gIDpost,
const std::string& _type,
float initWt,
float maxWt,
float prob,
188 uint8_t minDelay, uint8_t maxDelay,
RadiusRF radius,
189 float mulSynFast,
float mulSynSlow,
bool synWtType);
243 #define LN_I_CALC_TYPES__REQUIRED_FOR_NETWORK_LEVE 255 void setConductances(
bool isSet,
int tdAMPA,
int trNMDA,
int tdNMDA,
int tdGABAa,
int trGABAb,
int tdGABAb);
257 #ifdef LN_I_CALC_TYPES 262 void setConductances(
int grpId,
bool isSet,
int tdAMPA,
int trNMDA,
int tdNMDA,
int tdGABAa,
int trGABAb,
int tdGABAb);
264 void setNM4weighted(
int grpId,
IcalcType type,
float wDA,
float w5HT,
float wACh,
float wNE,
float wNorm,
float wBase);
274 void setHomeostasis(
int grpId,
bool isSet,
float homeoScale,
float avgTimeScale);
295 void setNeuronParameters(
int grpId,
float izh_a,
float izh_a_sd,
float izh_b,
float izh_b_sd,
296 float izh_c,
float izh_c_sd,
float izh_d,
float izh_d_sd);
310 void setNeuronParametersLIF(
int grpId,
int tau_m,
int tau_ref,
float vTh,
float vReset,
double minRmem,
double maxRmem);
336 void setNeuronParameters(
int grpId,
float izh_C,
float izh_C_sd,
float izh_k,
float izh_k_sd,
337 float izh_vr,
float izh_vr_sd,
float izh_vt,
float izh_vt_sd,
338 float izh_a,
float izh_a_sd,
float izh_b,
float izh_b_sd,
339 float izh_vpeak,
float izh_vpeak_sd,
float izh_c,
float izh_c_sd,
340 float izh_d,
float izh_d_sd);
354 void setNeuromodulator(
int grpId,
float baseDP,
float tauDP,
float base5HT,
float tau5HT,
355 float baseACh,
float tauACh,
float baseNE,
float tauNE);
359 float baseDP,
float tauDP,
float releaseDP,
bool activeDP,
360 float base5HT,
float tau5HT,
float release5HT,
bool active5HT,
361 float baseACh,
float tauACh,
float releaseAch,
bool activeACh,
362 float baseNE,
float tauNE,
float releaseNE,
bool activeNE);
377 void setESTDP(
int preGrpId,
int postGrpId,
bool isSet,
STDPType type,
STDPCurve curve,
float alphaPlus,
float tauPlus,
float alphaMinus,
float tauMinus,
float gamma);
379 #ifdef LN_I_CALC_TYPES 385 void setESTDP(
int preGrpId,
int postGrpId,
bool isSet,
STDPType type,
STDPCurve curve,
float alphaPlus,
float tauPlus,
float alphaMinus,
float tauMinus,
int nm_pka,
float w_pka,
int nm_plc,
float w_plc);
402 void setISTDP(
int preGrpId,
int postGrpId,
bool isSet,
STDPType type,
STDPCurve curve,
float ab1,
float ab2,
float tau1,
float tau2);
424 void setSTP(
int grpId,
bool isSet,
float STP_U,
float STP_tau_u,
float STP_tau_x);
427 #ifdef LN_I_CALC_TYPES 428 void setNM4STP(
int grpId,
float wSTP_U[],
float wSTP_tau_u[],
float wSTP_tau_x[]);
449 int runNetwork(
int _nsec,
int _nmsec,
bool printRunSummary);
457 #ifdef LN_SETUP_NETWORK_MT 459 void setupNetworkMT();
465 void biasWeights(
short int connId,
float bias,
bool updateWeightRange =
false);
480 void scaleWeights(
short int connId,
float scale,
bool updateWeightRange =
false);
529 void setWeight(
short int connId,
int neurIdPre,
int neurIdPost,
float weight,
bool updateWeightRange =
false);
544 #ifdef LN_UPDATE_CURSPIKES 545 void updateCurSpike(std::vector<bool>& firings,
int netId);
548 #ifdef LN_UPDATE_CURSPIKES_MT 549 void updateCurSpikeMT(std::vector<bool>& firings,
int netId);
554 void findWavefrontPath(std::vector<int>& path, std::vector<float>& eligibility,
int netId,
int grpId,
int startNId,
int goalNId);
555 bool updateDelays(
int gGrpIdPre,
int gGrpIdPost, std::vector<std::tuple<int, int, uint8_t>> connDelays);
556 void printEntrails(
char* buffer,
unsigned length,
int gGrpIdPre,
int gGrpIdPost);
608 void setLogsFp(FILE* fpInf = NULL, FILE* fpErr = NULL, FILE* fpDeb = NULL, FILE* fpLog = NULL);
629 uint8_t*
getDelays(
int gGrpIdPre,
int gGrpIdPost,
int& numPreN,
int& numPostN);
716 #ifdef LN_I_CALC_TYPES 717 bool isGroupWith(
int grpId,
IcalcType icalcType) {
return groupConfigMap[grpId].icalcType == icalcType; };
727 void getConductanceConfig(
int grpId,
float &dAMPA,
float &rNMDA,
float &dNMDA,
float &dGABAa,
float &rGABAb,
float &dGABAb) {
728 auto config = groupConfigMap[grpId].conductanceConfig;
729 dAMPA = config.dAMPA;
730 rNMDA = config.rNMDA;
731 dNMDA = config.dNMDA;
732 dGABAa = config.dGABAa;
733 rGABAb = config.rGABAb;
734 dGABAb = config.dGABAb;
738 void getConductanceConfig(
int grpId,
int& tdAMPA,
int& trNMDA,
int& tdNMDA,
int& tdGABAa,
int& trGABAb,
int& tdGABAb) {
747 auto config = groupConfigMap[grpId].conductanceConfig;
748 tdAMPA = round(1.0f / (1.0f - config.dAMPA));
749 trNMDA = abs(config.rNMDA) < 0.000001f ? 0 : round(1.0f / (1.0f - config.rNMDA));
750 tdNMDA = round(1.0f / (1.0f - config.dNMDA));
751 tdGABAa = round(1.0f / (1.0f - config.dGABAa));
752 trGABAb = abs(config.rGABAb) < 0.000001f ? 0 : round(1.0f / (1.0f - config.rGABAb));
753 tdGABAb = round(1.0f / (1.0f - config.dGABAb));
762 #define LN_I_CALC_TYPES__REQUIRED_FOR_NETWORK_LEVEL 781 static void cuda_device_description(
unsigned ,
const char **) {};
798 void allocateManagerRuntimeData();
800 int assignGroup(
int gGrpId,
int availableNeuronId);
801 int assignGroup(std::list<GroupConfigMD>::iterator grpIt,
int localGroupId,
int availableNeuronId);
802 void generateGroupRuntime(
int netId,
int lGrpId);
803 void generatePoissonGroupRuntime(
int netId,
int lGrpId);
804 void generateConnectionRuntime(
int netId);
805 void generateCompConnectionRuntime(
int netId);
810 void generateRuntimeNetworkConfigs();
811 void generateRuntimeGroupConfigs();
812 void generateRuntimeConnectConfigs();
817 void collectGlobalNetworkConfigC();
818 void compileConnectConfig();
819 void compileGroupConfig();
821 void collectGlobalNetworkConfigP();
826 void connectNetwork();
827 inline void connectNeurons(
int netId,
int srcGrp,
int destGrp,
int srcN,
int destN,
short int connId,
int externalNetId);
828 inline void connectNeurons(
int netId,
int _grpSrc,
int _grpDest,
int _nSrc,
int _nDest,
short int _connId,
float initWt,
float maxWt, uint8_t delay,
int externalNetId);
829 void connectFull(
int netId, std::list<ConnectConfig>::iterator connIt,
bool isExternal);
830 void connectOneToOne(
int netId, std::list<ConnectConfig>::iterator connIt,
bool isExternal);
831 void connectRandom(
int netId, std::list<ConnectConfig>::iterator connIt,
bool isExternal);
832 void connectGaussian(
int netId, std::list<ConnectConfig>::iterator connIt,
bool isExternal);
833 void connectUserDefined(
int netId, std::list<ConnectConfig>::iterator connIt,
bool isExternal);
835 #ifdef LN_SETUP_NETWORK_MT 836 void connectNetworkMT();
837 inline void connectNeuronsMT(std::mutex &mtx,
int netId,
int srcGrp,
int destGrp,
int srcN,
int destN,
short int connId,
int externalNetId);
838 void connectRandomMT(
int netId, std::list<ConnectConfig>::iterator connIt,
bool isExternal);
841 void deleteObjects();
843 void findMaxNumSynapsesGroups(
int* _maxNumPostSynGrp,
int* _maxNumPreSynGrp);
844 void findMaxNumSynapsesNeurons(
int _netId,
int& _maxNumPostSynN,
int& _maxNumPreSynN);
845 void findMaxSpikesD1D2(
int netId,
unsigned int& _maxSpikesD1,
unsigned int& _maxSpikesD2);
846 void findNumSynapsesNetwork(
int netId,
int& _numPostSynNet,
int& _numPreSynNet);
847 void findNumN(
int _netId,
int& _numN,
int& _nunNExternal,
int& numNAssigned,
848 int& _numNReg,
int& _numNExcReg,
int& _numNInhReg,
849 int& _numNPois,
int& _numNExcPois,
int& _numNInhPois);
850 void findNumNSpikeGenAndOffset(
int _netId);
852 void generatePostSynapticSpike(
int preNId,
int postNId,
int synId,
int tD,
int netId);
853 void fillSpikeGenBits(
int netId);
854 void userDefinedSpikeGenerator(
int gGrpId);
856 float generateWeight(
int connProp,
float initWt,
float maxWt,
int nid,
int grpId);
859 void verifyNetwork();
865 void verifyHomeostasis();
868 void verifyCompartments();
876 void generateRuntimeSNN();
878 #ifdef LN_SETUP_NETWORK_MT 879 void partitionSNNMT();
902 void printConnectionInfo(
short int connId);
903 void printConnectionInfo(
int netId, std::list<ConnectConfig>::iterator connIt);
904 void printGroupInfo(
int grpId);
905 void printGroupInfo(
int netId, std::list<GroupConfigMD>::iterator grpIt);
906 void printSimSummary();
907 void printStatusConnectionMonitor(
int connId =
ALL);
908 void printStatusGroupMonitor(
int gGrpId =
ALL);
909 void printStatusSpikeMonitor(
int gGrpId =
ALL);
910 void printSikeRoutingInfo();
912 int loadSimulation_internal(
bool onlyPlastic);
914 void resetConductances(
int netId);
915 void resetCurrent(
int netId);
916 void resetFiringInformation();
917 void resetGroupConfigs(
bool deallocate =
false);
918 void resetNeuromodulator(
int netId,
int lGrpId);
919 void resetNeuron(
int netId,
int lGrpId,
int lNId);
920 void resetMonitors(
bool deallocate =
false);
921 void resetConnectionConfigs(
bool deallocate =
false);
922 void deleteManagerRuntimeData();
923 void resetPoissonNeuron(
int netId,
int lGrpId,
int lNId);
924 void resetPropogationBuffer();
925 void resetSynapse(
int netId,
bool changeWeights =
false);
926 void resetTimeTable();
927 void resetFiringTable();
929 void transferSpikes(
void* dest,
int destNetId,
void* src,
int srcNetId,
int size);
932 inline SynInfo SET_CONN_ID(
int nid,
int sid,
int grpId);
934 void setGrpTimeSlice(
int grpId,
int timeSlice);
935 int setRandSeed(
int seed);
940 void generateUserDefinedSpikes();
942 void allocateManagerSpikeTables();
946 float getCompCurrent(
int netid,
int lGrpId,
int lneurId,
float const0 = 0.0f,
float const1 = 0.0f);
949 void allocateSNN(
int netId);
950 void clearExtFiringTable();
951 void convertExtSpikesD1(
int netId,
int startIdx,
int endIdx,
int GtoLOffset);
952 void convertExtSpikesD2(
int netId,
int startIdx,
int endIdx,
int GtoLOffset);
953 void doCurrentUpdate();
954 void doSTPUpdateAndDecayCond();
955 void deleteRuntimeData();
957 void globalStateUpdate();
958 void resetSpikeCnt(
int gGrpId);
959 void shiftSpikeTables();
960 void spikeGeneratorUpdate();
961 void updateTimingTable();
962 void updateWeights();
963 void updateNetworkConfig(
int netId);
966 void fetchConductanceAMPA(
int gGrpId);
967 void fetchConductanceNMDA(
int gGrpId);
968 void fetchConductanceGABAa(
int gGrpId);
969 void fetchConductanceGABAb(
int gGrpId);
970 void fetchNetworkSpikeCount();
971 void fetchNeuronSpikeCount(
int gGrpId);
972 void fetchSTPState(
int gGrpId);
975 void fetchSpikeTables(
int netId);
976 void fetchNeuronStateBuffer(
int netId,
int lGrpId);
977 void fetchGroupState(
int netId,
int lGrpId);
978 void fetchWeightState(
int netId,
int lGrpId);
979 void fetchGrpIdsLookupArray(
int netId);
980 void fetchConnIdsLookupArray(
int netId);
981 void fetchLastSpikeTime(
int netId);
982 void fetchCurSpike(
int netId);
983 void fetchRandNum(
int netId);
984 void fetchPoissonFireRate(
int netId);
985 void fetchSpikeGenBits(
int netId);
986 void fetchPreConnectionInfo(
int netId);
987 void fetchPostConnectionInfo(
int netId);
988 void fetchSynapseState(
int netId);
989 void fetchExtFiringTable(
int netId);
990 void fetchTimeTable(
int netId);
991 void writeBackTimeTable(
int netId);
995 void allocateSNN_GPU(
int netId);
996 void assignPoissonFiringRate_GPU(
int netId);
997 void clearExtFiringTable_GPU(
int netId);
998 void convertExtSpikesD1_GPU(
int netId,
int startIdx,
int endIdx,
int GtoLOffset);
999 void convertExtSpikesD2_GPU(
int netId,
int startIdx,
int endIdx,
int GtoLOffset);
1000 void doCurrentUpdateD1_GPU(
int netId);
1001 void doCurrentUpdateD2_GPU(
int netId);
1002 void doSTPUpdateAndDecayCond_GPU(
int netId);
1003 void deleteRuntimeData_GPU(
int netId);
1004 void findFiring_GPU(
int netId);
1005 void globalStateUpdate_C_GPU(
int netId);
1006 void globalStateUpdate_N_GPU(
int netId);
1007 void globalStateUpdate_G_GPU(
int netId);
1008 void resetSpikeCnt_GPU(
int netId,
int lGrpId);
1009 void shiftSpikeTables_F_GPU(
int netId);
1010 void shiftSpikeTables_T_GPU(
int netId);
1011 void spikeGeneratorUpdate_GPU(
int netId);
1012 void updateTimingTable_GPU(
int netId);
1013 void updateWeights_GPU(
int netId);
1015 void allocateSNN_GPU(
int netId) { assert(
false); }
1016 void assignPoissonFiringRate_GPU(
int netId) { assert(
false); }
1017 void clearExtFiringTable_GPU(
int netId) { assert(
false); }
1018 void convertExtSpikesD1_GPU(
int netId,
int startIdx,
int endIdx,
int GtoLOffset) { assert(
false); }
1019 void convertExtSpikesD2_GPU(
int netId,
int startIdx,
int endIdx,
int GtoLOffset) { assert(
false); }
1020 void doCurrentUpdateD1_GPU(
int netId) { assert(
false); }
1021 void doCurrentUpdateD2_GPU(
int netId) { assert(
false); }
1022 void doSTPUpdateAndDecayCond_GPU(
int netId) { assert(
false); }
1023 void deleteRuntimeData_GPU(
int netId) { assert(
false); }
1024 void findFiring_GPU(
int netId) { assert(
false); }
1025 void globalStateUpdate_C_GPU(
int netId) { assert(
false); }
1026 void globalStateUpdate_N_GPU(
int netId) { assert(
false); }
1027 void globalStateUpdate_G_GPU(
int netId) { assert(
false); }
1028 void resetSpikeCnt_GPU(
int netId,
int lGrpId) { assert(
false); }
1029 void shiftSpikeTables_F_GPU(
int netId) { assert(
false); }
1030 void shiftSpikeTables_T_GPU(
int netId) { assert(
false); }
1031 void spikeGeneratorUpdate_GPU(
int netId) { assert(
false); }
1032 void updateTimingTable_GPU(
int netId) { assert(
false); }
1033 void updateWeights_GPU(
int netId) { assert(
false); }
1038 void allocateGroupId(
int netId);
1039 int allocateStaticLoad(
int netId,
int bufSize);
1040 void checkAndSetGPUDevice(
int netId);
1041 void checkDestSrcPtrs(
RuntimeData* dest,
RuntimeData* src, cudaMemcpyKind kind,
bool allocateMem,
int grpId,
int destOffset);
1042 int configGPUDevice();
1043 void initGPU(
int netId);
1050 void copyAuxiliaryData(
int netId,
int lGrpId,
RuntimeData* dest, cudaMemcpyKind kind,
bool allocateMem);
1051 void copyConductanceAMPA(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src, cudaMemcpyKind kind,
bool allocateMem,
int destOffset);
1052 void copyConductanceNMDA(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src, cudaMemcpyKind kind,
bool allocateMem,
int destOffset);
1053 void copyConductanceGABAa(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src, cudaMemcpyKind kind,
bool allocateMem,
int destOffset);
1054 void copyConductanceGABAb(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src, cudaMemcpyKind kind,
bool allocateMem,
int destOffset);
1055 void copyPreConnectionInfo(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src, cudaMemcpyKind kind,
bool allocateMem);
1056 void copyPostConnectionInfo(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src, cudaMemcpyKind kind,
bool allocateMem);
1057 void copyExternalCurrent(
int netId,
int lGrpId,
RuntimeData* dest, cudaMemcpyKind kind,
bool allocateMem);
1058 void copyNeuronParameters(
int netId,
int lGrpId,
RuntimeData* dest, cudaMemcpyKind kind,
bool allocateMem);
1059 void copyGroupState(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src, cudaMemcpyKind kind,
bool allocateMem);
1060 void copyNeuronState(
int netId,
int lGrpId,
RuntimeData* dest, cudaMemcpyKind kind,
bool allocateMem);
1061 void copyNeuronStateBuffer(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src, cudaMemcpyKind kind,
bool allocateMem);
1062 void copyNeuronSpikeCount(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src, cudaMemcpyKind kind,
bool allocateMem,
int destOffset);
1063 void copySynapseState(
int netId,
RuntimeData* dest,
RuntimeData* src, cudaMemcpyKind kind,
bool allocateMem);
1064 void copySTPState(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src, cudaMemcpyKind kind,
bool allocateMem);
1065 void copyWeightState(
int netId,
int lGrpId, cudaMemcpyKind kind);
1066 void copyNetworkConfig(
int netId, cudaMemcpyKind kind);
1067 void copyGroupConfigs(
int netId);
1068 void copyConnectConfigs(
int netId);
1069 void copyGrpIdsLookupArray(
int netId, cudaMemcpyKind kind);
1070 void copyConnIdsLookupArray(
int netId, cudaMemcpyKind kind);
1071 void copyLastSpikeTime(
int netId, cudaMemcpyKind kind);
1072 void copyCurSpikes(
int netId, cudaMemcpyKind kind);
1073 void copyRandNum(
int netId, cudaMemcpyKind kind);
1074 void copyPoissonFireRate(
int netId, cudaMemcpyKind kind);
1075 void copySpikeGenBits(
int netId, cudaMemcpyKind kind);
1076 void copyNetworkSpikeCount(
int netId, cudaMemcpyKind kind,
1077 unsigned int* spikeCountD1,
unsigned int* spikeCountD2,
1078 unsigned int* spikeCountExtD1,
unsigned int* spikeCountExtD2);
1079 void copySpikeTables(
int netId, cudaMemcpyKind kind);
1080 void copyTimeTable(
int netId, cudaMemcpyKind kind);
1081 void copyExtFiringTable(
int netId, cudaMemcpyKind kind);
1083 #define cudaMemcpyKind int 1084 #define cudaMemcpyHostToHost 0 1085 #define cudaMemcpyHostToDevice 0 1086 #define cudaMemcpyDeviceToHost 0 1087 #define cudaMemcpyDeviceToDevice 0 1088 #define cudaMemcpyDefault 0 1090 void copyAuxiliaryData(
int netId,
int lGrpId,
RuntimeData* dest, cudaMemcpyKind kind,
bool allocateMem) { assert(
false); }
1091 void copyConductanceAMPA(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src, cudaMemcpyKind kind,
bool allocateMem,
int destOffset) { assert(
false); }
1092 void copyConductanceNMDA(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src, cudaMemcpyKind kind,
bool allocateMem,
int destOffset) { assert(
false); }
1093 void copyConductanceGABAa(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src, cudaMemcpyKind kind,
bool allocateMem,
int destOffset) { assert(
false); }
1094 void copyConductanceGABAb(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src, cudaMemcpyKind kind,
bool allocateMem,
int destOffset) { assert(
false); }
1095 void copyPreConnectionInfo(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src, cudaMemcpyKind kind,
bool allocateMem) { assert(
false); }
1096 void copyPostConnectionInfo(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src, cudaMemcpyKind kind,
bool allocateMem) { assert(
false); }
1097 void copyExternalCurrent(
int netId,
int lGrpId,
RuntimeData* dest, cudaMemcpyKind kind,
bool allocateMem) { assert(
false); }
1098 void copyNeuronParameters(
int netId,
int lGrpId,
RuntimeData* dest, cudaMemcpyKind kind,
bool allocateMem) { assert(
false); }
1099 void copyGroupState(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src, cudaMemcpyKind kind,
bool allocateMem) { assert(
false); }
1100 void copyNeuronState(
int netId,
int lGrpId,
RuntimeData* dest, cudaMemcpyKind kind,
bool allocateMem) { assert(
false); }
1101 void copyNeuronStateBuffer(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src, cudaMemcpyKind kind,
bool allocateMem) { assert(
false); }
1102 void copyNeuronSpikeCount(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src, cudaMemcpyKind kind,
bool allocateMem,
int destOffset) { assert(
false); }
1103 void copySynapseState(
int netId,
RuntimeData* dest,
RuntimeData* src, cudaMemcpyKind kind,
bool allocateMem) { assert(
false); }
1104 void copySTPState(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src, cudaMemcpyKind kind,
bool allocateMem) { assert(
false); }
1105 void copyWeightState(
int netId,
int lGrpId, cudaMemcpyKind kind) { assert(
false); }
1106 void copyNetworkConfig(
int netId, cudaMemcpyKind kind) { assert(
false); }
1107 void copyGroupConfigs(
int netId) { assert(
false); }
1108 void copyGrpIdsLookupArray(
int netId, cudaMemcpyKind kind) { assert(
false); }
1109 void copyConnIdsLookupArray(
int netId, cudaMemcpyKind kind) { assert(
false); }
1110 void copyLastSpikeTime(
int netId, cudaMemcpyKind kind) { assert(
false); }
1111 void copyCurSpikes(
int netId, cudaMemcpyKind kind) { assert(
false); }
1112 void copyPoissonFireRate(
int netId, cudaMemcpyKind kind) { assert(
false); }
1113 void copyRandNum(
int netId, cudaMemcpyKind kind) { assert(
false); }
1114 void copySpikeGenBits(
int netId, cudaMemcpyKind kind) { assert(
false); }
1115 void copyNetworkSpikeCount(
int netId, cudaMemcpyKind kind,
1116 unsigned int* spikeCountD1,
unsigned int* spikeCountD2,
1117 unsigned int* spikeCountExtD1,
unsigned int* spikeCountExtD2) { assert(
false); }
1118 void copySpikeTables(
int netId, cudaMemcpyKind kind) { assert(
false); }
1119 void copyTimeTable(
int netId, cudaMemcpyKind kind) { assert(
false); }
1120 void copyExtFiringTable(
int netId, cudaMemcpyKind kind) { assert(
false); }
1126 void allocateSNN_CPU(
int netId);
1129 #ifdef __NO_PTHREADS__ 1130 void assignPoissonFiringRate_CPU(
int netId);
1131 void clearExtFiringTable_CPU(
int netId);
1132 void convertExtSpikesD2_CPU(
int netId,
int startIdx,
int endIdx,
int GtoLOffset);
1133 void convertExtSpikesD1_CPU(
int netId,
int startIdx,
int endIdx,
int GtoLOffset);
1134 void doCurrentUpdateD2_CPU(
int netId);
1135 void doCurrentUpdateD1_CPU(
int netId);
1136 void doSTPUpdateAndDecayCond_CPU(
int netId);
1137 void deleteRuntimeData_CPU(
int netId);
1138 void findFiring_CPU(
int netId);
1139 void globalStateUpdate_CPU(
int netId);
1140 void resetSpikeCnt_CPU(
int netId,
int lGrpId);
1141 void shiftSpikeTables_CPU(
int netId);
1142 void spikeGeneratorUpdate_CPU(
int netId);
1143 void updateTimingTable_CPU(
int netId);
1144 void updateWeights_CPU(
int netId);
1145 #else // for APPLE and Win systems - returns a void* to pthread_create - only differ in the return type compared to the counterparts above 1146 void* assignPoissonFiringRate_CPU(
int netId);
1147 void* clearExtFiringTable_CPU(
int netId);
1148 void* convertExtSpikesD2_CPU(
int netId,
int startIdx,
int endIdx,
int GtoLOffset);
1149 void* convertExtSpikesD1_CPU(
int netId,
int startIdx,
int endIdx,
int GtoLOffset);
1150 void* doCurrentUpdateD2_CPU(
int netId);
1151 void* doCurrentUpdateD1_CPU(
int netId);
1152 void* doSTPUpdateAndDecayCond_CPU(
int netId);
1153 void* deleteRuntimeData_CPU(
int netId);
1154 void* findFiring_CPU(
int netId);
1155 void* globalStateUpdate_CPU(
int netId);
1156 void* resetSpikeCnt_CPU(
int netId,
int lGrpId);
1157 void* shiftSpikeTables_CPU(
int netId);
1158 void* spikeGeneratorUpdate_CPU(
int netId);
1159 void* updateTimingTable_CPU(
int netId);
1160 void* updateWeights_CPU(
int netId);
1163 static void* helperAssignPoissonFiringRate_CPU(
void*);
1164 static void* helperClearExtFiringTable_CPU(
void*);
1165 static void* helperConvertExtSpikesD2_CPU(
void*);
1166 static void* helperConvertExtSpikesD1_CPU(
void*);
1167 static void* helperDoCurrentUpdateD2_CPU(
void*);
1168 static void* helperDoCurrentUpdateD1_CPU(
void*);
1169 static void* helperDoSTPUpdateAndDecayCond_CPU(
void*);
1170 static void* helperDeleteRuntimeData_CPU(
void*);
1171 static void* helperFindFiring_CPU(
void*);
1172 static void* helperGlobalStateUpdate_CPU(
void*);
1173 static void* helperResetSpikeCnt_CPU(
void*);
1174 static void* helperShiftSpikeTables_CPU(
void*);
1175 static void* helperSpikeGeneratorUpdate_CPU(
void*);
1176 static void* helperUpdateTimingTable_CPU(
void*);
1177 static void* helperUpdateWeights_CPU(
void*);
1181 void copyAuxiliaryData(
int netId,
int lGrpId,
RuntimeData* dest,
bool allocateMem);
1182 void copyConductanceAMPA(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src,
bool allocateMem,
int destOffset);
1183 void copyConductanceNMDA(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src,
bool allocateMem,
int destOffset);
1184 void copyConductanceGABAa(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src,
bool allocateMem,
int destOffset);
1185 void copyConductanceGABAb(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src,
bool allocateMem,
int destOffset);
1186 void copyPreConnectionInfo(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src,
bool allocateMem);
1187 void copyPostConnectionInfo(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src,
bool allocateMem);
1188 void copyExternalCurrent(
int netId,
int lGrpId,
RuntimeData* dest,
bool allocateMem);
1189 void copyNeuronParameters(
int netId,
int lGrpId,
RuntimeData* dest,
bool allocateMem);
1191 void copyNeuronStateBuffer(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src,
bool allocateMem);
1192 void copyNeuronState(
int netId,
int lGrpId,
RuntimeData* dest,
bool allocateMem);
1193 void copyNeuronSpikeCount(
int netId,
int lGrpId,
RuntimeData* dest,
RuntimeData* src,
bool allocateMem,
int destOffset);
1196 void copyWeightState(
int netId,
int lGrpId);
1197 void copyNetworkConfig(
int netId);
1198 void copyGrpIdsLookupArray(
int netId);
1199 void copyConnIdsLookupArray(
int netId);
1200 void copyLastSpikeTime(
int netId);
1201 void copyCurSpikes(
int netId);
1202 void copyRandNum(
int netId);
1203 void copyPoissonFireRate(
int netId);
1204 void copySpikeGenBits(
int netId);
1205 void copyNetworkSpikeCount(
int netId,
1206 unsigned int* spikeCountD1,
unsigned int* spikeCountD2,
1207 unsigned int* spikeCountExtD1,
unsigned int* spikeCountExtD2);
1208 void copySpikeTables(
int netId);
1209 void copyTimeTable(
int netId,
bool toManager);
1210 void copyExtFiringTable(
int netId);
1213 void firingUpdateSTP(
int lNId,
int lGrpId,
int netId);
1214 void updateLTP(
int lNId,
int lGrpId,
int netId);
1215 void resetFiredNeuron(
int lNId,
short int lGrpId,
int netId);
1216 bool getPoissonSpike(
int lNId,
int netId);
1217 bool getSpikeGenBit(
unsigned int nIdPos,
int netId);
1220 #ifdef LN_AXON_PLAST 1221 void findWavefrontPath_CPU(std::vector<int>& path, std::vector<float>& eligibility,
int netId,
int grpId,
int startNId,
int goalNId);
1222 bool updateDelays_CPU(
int netId,
int lGrpIdPre,
int lGrpIdPost, std::vector<std::tuple<int, int, uint8_t>> connDelays);
1223 void printEntrails_CPU(
char* buffer,
unsigned length,
int netId,
int lGrpIdPre,
int lGrpIdPost);
1225 bool updateDelays_GPU(
int netId,
int lGrpIdPre,
int lGrpIdPost, std::vector<std::tuple<int, int, uint8_t>> connDelays);
1226 void printEntrails_GPU(
int netId,
int lGrpIdPre,
int lGrpIdPost);
1227 void printEntrails_GPU(
char* buffer,
unsigned length,
int netId,
int lGrpIdPre,
int lGrpIdPost);
1229 bool updateDelays_GPU(
int netId,
int lGrpIdPre,
int lGrpIdPost, std::vector<std::tuple<int, int, uint8_t>> connDelays) { assert(
false); }
1230 void printEntrails_GPU(
int netId,
int lGrpIdPre,
int lGrpIdPost) { assert(
false); }
1231 void printEntrails_GPU(
char* buffer,
unsigned length,
int netId,
int lGrpIdPre,
int lGrpIdPost) { assert(
false); }
1240 const std::string networkName_;
1242 const SimMode preferredSimMode_;
1243 const int randSeed_;
1248 int numAvailableGPUs;
1250 bool simulatorDeleted;
1251 bool spikeRateUpdated;
1254 bool sim_in_testing;
1258 int numCompartmentConnections;
1260 std::map<int, GroupConfig> groupConfigMap;
1261 std::map<int, GroupConfigMD> groupConfigMDMap;
1262 std::map<int, ConnectConfig> connectConfigMap;
1263 std::map<int, compConnectConfig> compConnectConfigMap;
1272 #ifdef LN_FIX_CONNLIST_ 1277 std::list<RoutingTableEntry> spikeRoutingTable;
1285 #define LN_I_CALC_TYPES__REQUIRED_FOR_NETWORK_LEVEL 1286 bool sim_with_conductances;
1287 bool sim_with_NMDA_rise;
1288 bool sim_with_GABAb_rise;
1289 #define LN_I_CALC_TYPES__REQUIRED_FOR_BACKWARD_COMPAT 1299 bool sim_with_compartments;
1300 bool sim_with_fixedwts;
1302 bool sim_with_modulated_stdp;
1303 bool sim_with_homeostasis;
1305 bool sim_with_spikecounters;
1310 int simTimeRunStart;
1312 int simTimeLastRunSummary;
1319 StopWatchInterface* timer;
1321 float cumExecutionTime;
1322 float lastExecutionTime;
1323 float prevExecutionTime;
1324 float executionTime;
1332 int numSpikeMonitor;
1337 int numNeuronMonitor;
1342 long int simTimeLastUpdSpkMon_;
1344 int numSpikeGenGrps;
1347 int numGroupMonitor;
1356 int numConnectionMonitor;
1363 typedef struct ManagerRuntimeDataSize_s {
1364 unsigned int maxMaxSpikeD1;
1365 unsigned int maxMaxSpikeD2;
1368 int maxNumNSpikeGen;
1370 int maxNumNAssigned;
1372 int maxNumConnections;
1373 int maxNumPostSynNet;
1374 int maxNumPreSynNet;
1375 int maxNumNPerGroup;
1378 } ManagerRuntimeDataSize;
1380 ManagerRuntimeDataSize managerRTDSize;
1388 int wtANDwtChangeUpdateInterval_;
1389 int wtANDwtChangeUpdateIntervalCnt_;
1390 float stdpScaleFactor_;
1391 float wtChangeDecay_;
Class for generating Poisson spike trains.
static int cudaDeviceCount()
Get Info of suitable Harware for integration of CARLsim in NeuroInf-IDEs NIIDEs (LN20201017) ...
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.
SNNState
the state of spiking neural network, used with in kernel.
bool isPoissonGroup(int gGrpId)
float * getCurrent()
temporary getter to return pointer to current[]
bool isSimulationWithGABAbRise()
int createGroupLIF(const std::string &grpName, const Grid3D &grid, int neurType, int preferredPartition, ComputingBackend preferredBackend)
Creates a group of LIF spiking neurons.
RangeDelay getDelayRange(short int connId)
returns the RangeDelay struct of a connection
void findWavefrontPath(std::vector< int > &path, std::vector< float > &eligibility, int netId, int grpId, int startNId, int goalNId)
A struct for retrieving STDP related information of a connection.
NeuronMonitor * getNeuronMonitor(int grpId)
Returns pointer to existing NeuronMonitor object, NULL else.
void updateGroupMonitor(int grpId=ALL)
access group status (currently the concentration of neuromodulator)
float * getSTPx()
temporary getter to return pointer to stpx[]
#define ALL
CARLsim common definitions.
void getConductanceConfig(int grpId, float &dAMPA, float &rNMDA, float &dNMDA, float &dGABAa, float &rGABAb, float &dGABAb)
static void cudaDeviceDescription(unsigned ithGPU, const char **desc)
void setNM4weighted(int grpId, IcalcType type, float wDA, float w5HT, float wACh, float wNE, float wNorm, float wBase)
GroupNeuromodulatorInfo getGroupNeuromodulatorInfo(int grpId)
bool isGroupWithCUBA(int grpId)
void setISTDP(int preGrpId, int postGrpId, 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.
UpdateInterval
Update frequency for weights.
bool isGroupWithCOBA(int grpId)
int getNumNeuronsGenExc()
int numSynNet
number of total synaptic connections in the global network
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, NE) for a neuron group.
std::vector< float > getConductanceNMDA(int grpId)
void setNM4STP(int grpId, float wSTP_U[], float wSTP_tau_u[], float wSTP_tau_x[])
bool updateDelays(int gGrpIdPre, int gGrpIdPost, std::vector< std::tuple< int, int, uint8_t >> connDelays)
void startTesting(bool shallUpdateWeights=true)
enters a testing phase, where all weight updates are disabled
NeuronMonitorCore * getNeuronMonitorCore(int grpId)
bool isGroupWithHomeostasis(int grpId)
returns whether group has homeostasis enabled (true) or not (false)
void exitSimulation(int val=1)
deallocates all dynamical structures and exits
std::vector< float > getConductanceGABAb(int grpId)
void scaleWeights(short int connId, float scale, bool updateWeightRange=false)
void printEntrails(char *buffer, unsigned length, int gGrpIdPre, int gGrpIdPost)
LoggerMode getLoggerMode()
int createGroup(const std::string &grpName, const Grid3D &grid, int neurType, int preferredPartition, ComputingBackend preferredBackend)
Creates a group of Izhikevich spiking neurons.
used for relaying callback to ConnectionGenerator
void updateNeuronMonitor(int grpId=ALL)
copy required neuron state values from ??? buffer to ??? buffer
bool isExcitatoryGroup(int gGrpId)
GroupMonitor * setGroupMonitor(int grpId, FILE *fid, int mode=0)
sets up a group monitor registered with a callback to process the spikes.
bool isGroupWith(int grpId, IcalcType icalcType)
The configuration of a connection.
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. ...
short int getConnectId(int grpIdPre, int grpIdPost)
find connection ID based on pre-post group pair, O(N)
bool isSimulationWithHomeostasis()
Circular buffer for delivering spikes.
Grid3D getGroupGrid3D(int grpId)
void setupNetwork()
build the network
A struct to arrange neurons on a 3D grid (a primitive cubic Bravais lattice with cubic side length 1)...
static const unsigned int MAJOR_VERSION
major release version, as in CARLsim X
void getConductanceConfig(int grpId, int &tdAMPA, int &trNMDA, int &tdNMDA, int &tdGABAa, int &trGABAb, int &tdGABAb)
bool isSimulationWithCOBA()
void saveSimulation(FILE *fid, bool saveSynapseInfo=false)
stores the pre and post synaptic neuron ids with the weight and delay
void updateConnectionMonitor(short int connId=ALL)
polls connection weights
used for relaying callback to SpikeGenerator
SpikeMonitor * getSpikeMonitor(int grpId)
Returns pointer to existing SpikeMonitor object, NULL else.
NeuronMonitor * setNeuronMonitor(int gid, FILE *fid)
sets up a neuron monitor registered with a callback to process the neuron state values, there can only be one NeuronMonitor per group
std::string getGroupName(int grpId)
void updateSpikeMonitor(int grpId=ALL)
copy required spikes from firing buffer to spike buffer
const FILE * getLogFpLog()
returns file pointer to log file
int numNPois
number of poisson neurons in the global network
int getNumNeuronsRegInh()
bool isSimulationWithNMDARise()
bool isGroupWithNMDARise(int grpId)
int getNumCompartmentConnections()
SpikeMonitorCore * getSpikeMonitorCore(int grpId)
int numNExcPois
number of excitatory poisson neurons in the global network
bool isSimulationWithPlasticWeights()
bool isSimulationWithCUBA()
std::string getNetworkName()
double getRFDist3D(const RadiusRF &radius, const Point3D &pre, const Point3D &post)
checks whether a point pre lies in the receptive field for point post
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...
void setSpikeRate(int grpId, PoissonRate *spikeRate, int refPeriod)
Sets the Poisson spike rate for a group. For information on how to set up spikeRate, see Section Poisson spike generators in the Tutorial.
IcalcType
input current calculation
int getGroupEndNeuronId(int gGrpId)
void biasWeights(short int connId, float bias, bool updateWeightRange=false)
int getNumSynapticConnections(short int connectionId)
gets number of connections associated with a connection ID
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
The runtime configuration of a connection.
integrationMethod_t
Integration methods.
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.
a range struct for synaptic delays
void setCompartmentParameters(int grpId, float couplingUp, float couplingDown)
Coupling constants for the compartment are set using this method.
void setHomeoBaseFiringRate(int groupId, float baseFiring, float baseFiringSD)
Sets homeostatic target firing rate (enforced through homeostatic synaptic scaling) ...
std::vector< float > getConductanceGABAa(int grpId)
bool isSimulationWithCompartments()
SNN(const std::string &name, SimMode preferredSimMode, LoggerMode loggerMode, int randSeed)
SNN Constructor.
int runNetwork(int _nsec, int _nmsec, bool printRunSummary)
run the simulation for n sec
The runtime configuration of a group.
A struct for retrieving neuromodulator information of a group.
RangeWeight getWeightRange(short int connId)
returns RangeWeight struct of a connection
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)
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...
int numNInhReg
number of regular inhibitory neurons in the global network
int numN
number of neurons in the global network
std::vector< float > getConductanceAMPA(int grpId)
ConnSTDPInfo getConnSTDPInfo(short int connId)
int getGroupStartNeuronId(int gGrpId)
int numNInhPois
number of inhibitory poisson neurons in the global network
int getNeuronId(int gGrpId, Point3D location)
the inverse of getNeuronLocation3D
void setExternalCurrent(int grpId, const std::vector< float > ¤t)
injects current (mA) into the soma of every neuron in the group
const FILE * getLogFpErr()
returns file pointer to error log
a range struct for synaptic weight magnitudes
Contains all of CARLsim's core functionality.
ComputingBackend
computing backend
int numNExcReg
number of regular excitatory neurons in the global network
bool isSimulationWithFixedWeightsOnly()
void setESTDP(int preGrpId, int postGrpId, 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.
bool isGroupWithGABAbRise(int grpId)
IcalcType getIcalcType(int grpId)
void stopTesting()
exits a testing phase, making weight updates possible again
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...
int getNumNeuronsRegExc()
int getNumNeuronsGenInh()
std::vector< std::vector< float > > getWeightMatrix2D(short int connId)
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...
void setSpikeGenerator(int grpId, SpikeGeneratorCore *spikeGenFunc)
sets up a spike generator
bool isPoint3DinRF(const RadiusRF &radius, const Point3D &pre, const Point3D &post)
bool isSimulationWithSTP()
bool isSimulationWithSTDP()
int getGroupId(std::string grpName)
const FILE * getLogFpDeb()
returns file pointer to debug log
GroupMonitor private core implementation.
void setWeightAndWeightChangeUpdate(UpdateInterval wtANDwtChangeUpdateInterval, bool enableWtChangeDecay, float wtChangeDecay)
Sets the weight and weight change update parameters.
runtime network configuration
int numNReg
number of regular (spking) neurons in the global network
bool isInhibitoryGroup(int gGrpId)
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...
bool isConnectionPlastic(short int connId)
returns whether synapses in connection are fixed (false) or plastic (true)
int getGroupNumNeurons(int gGrpId)
void setWeight(short int connId, int neurIdPre, int neurIdPost, float weight, bool updateWeightRange=false)
sets the weight value of a specific synapse
void setConductances(bool isSet, int tdAMPA, int trNMDA, int tdNMDA, int tdGABAa, int trGABAb, int tdGABAb)
Sets custom values for conductance decay () or disables conductances alltogether These will be applie...
float * getSTPu()
temporary getter to return pointer to stpu[]
void setConnectionModulation(int preGrpId, int postGrpId, IcalcType icalcType)
static const unsigned int MINOR_VERSION
minor release version, as in CARLsim 2.X
void loadSimulation(FILE *fid)
bool isDopaminergicGroup(int gGrpId)
ConnectConfig getConnectConfig(short int connectId)
required for homeostasis
A struct to specify the receptive field (RF) radius in 3 dimensions.
const FILE * getLogFpInf()
function writes population weights from gIDpre to gIDpost to file fname in binary.