Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code that fixes CSTP conductance decay bug #19

Merged
merged 7 commits into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ endif()
option(CARLSIM_LN_GPU_STDP "Enables GPU accelerated functions for STDP" ON) # feature GPU device functions (experimental) )

option(CARLSIM_JK_CA3_SNN "J. Koppsick extensions for Neuron-Type Specific CA3 SNN" ON) # feature ported on basis of CARLsim4 branch
option(CARLSIM_CSTP_DOUBLES "Use doubles instead of floats for computing CSTP conductance decay" ON)

set(CARLSIM_CUDA_GENCODE "-gencode arch=compute_86,code=sm_86" CACHE STRING "CUDA target architecture and device, e.g. _80 for Ampere/A100, _86 for Ampere/RTX3090" )

Expand Down Expand Up @@ -264,7 +265,13 @@ if(CARLSIM_SHARED)
target_compile_definitions(carlsim-cuda PUBLIC JK_CA3_SNN)
endif()
endif()


if(CARLSIM_CSTP_DOUBLES)
target_compile_definitions(carlsim PUBLIC CSTP_DOUBLES)
if(NOT CARLSIM_NO_CUDA)
target_compile_definitions(carlsim-cuda PUBLIC CSTP_DOUBLES)
endif()
endif()

# Includes

Expand Down
4 changes: 2 additions & 2 deletions carlsim/interface/src/carlsim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ class CARLsim::Impl {
UserErrors::assertTrue(!isPoissonGroup(grpId), UserErrors::WRONG_NEURON_TYPE, funcName, funcName);
UserErrors::assertTrue(carlsimState_ == CONFIG_STATE, UserErrors::CAN_ONLY_BE_CALLED_IN_STATE, funcName, funcName, "CONFIG.");
UserErrors::assertTrue(izh_C > 0, UserErrors::CANNOT_BE_NEGATIVE, funcName, "izh_C");
UserErrors::assertTrue(izh_ref >= 1, UserErrors::CANNOT_BE_NEGATIVE, funcName, "izh_ref");
UserErrors::assertTrue(izh_ref >= 0, UserErrors::CANNOT_BE_NEGATIVE, funcName, "izh_ref");

// set standard deviations of Izzy params to zero
snn_->setNeuronParameters(grpId, izh_C, 0.0f, izh_k, 0.0f, izh_vr, 0.0f, izh_vt, 0.0f,
Expand All @@ -752,7 +752,7 @@ class CARLsim::Impl {
UserErrors::assertTrue(!isPoissonGroup(grpId), UserErrors::WRONG_NEURON_TYPE, funcName, funcName);
UserErrors::assertTrue(carlsimState_ == CONFIG_STATE, UserErrors::CAN_ONLY_BE_CALLED_IN_STATE, funcName, funcName, "CONFIG.");
UserErrors::assertTrue(izh_C > 0, UserErrors::CANNOT_BE_NEGATIVE, funcName, "izh_C");
UserErrors::assertTrue(izh_ref >= 1, UserErrors::CANNOT_BE_NEGATIVE, funcName, "izh_ref");
UserErrors::assertTrue(izh_ref >= 0, UserErrors::CANNOT_BE_NEGATIVE, funcName, "izh_ref");

// wrapper identical to core func
snn_->setNeuronParameters(grpId, izh_C, izh_C_sd, izh_k, izh_k_sd, izh_vr, izh_vr_sd, izh_vt, izh_vt_sd,
Expand Down
4 changes: 3 additions & 1 deletion carlsim/kernel/inc/snn.h
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ class SNN {
void doCurrentUpdateD2_GPU(int netId) { assert(false); }
void doSTPUpdateAndDecayCond_GPU(int netId) { assert(false); }
void deleteRuntimeData_GPU(int netId) { assert(false); } //!< deallocates all used data structures in snn_gpu.cu
void findFiring_GPU(int netId) { assert(false); }
void findFiring_GPU(int netId) { assert(false); }
void globalStateUpdate_C_GPU(int netId) { assert(false); }
void globalStateUpdate_N_GPU(int netId) { assert(false); }
void globalStateUpdate_G_GPU(int netId) { assert(false); }
Expand Down Expand Up @@ -1166,6 +1166,7 @@ class SNN {
void convertExtSpikesD1_CPU(int netId, int startIdx, int endIdx, int GtoLOffset);
void doCurrentUpdateD2_CPU(int netId);
void doCurrentUpdateD1_CPU(int netId);
void test1(int netId);
void doSTPUpdateAndDecayCond_CPU(int netId);
void deleteRuntimeData_CPU(int netId);
void findFiring_CPU(int netId);
Expand All @@ -1182,6 +1183,7 @@ class SNN {
void* convertExtSpikesD1_CPU(int netId, int startIdx, int endIdx, int GtoLOffset);
void* doCurrentUpdateD2_CPU(int netId);
void* doCurrentUpdateD1_CPU(int netId);
void test1(int netId);
void* doSTPUpdateAndDecayCond_CPU(int netId);
void* deleteRuntimeData_CPU(int netId);
void* findFiring_CPU(int netId);
Expand Down
23 changes: 23 additions & 0 deletions carlsim/kernel/inc/snn_datastructures.h
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,25 @@ typedef struct RuntimeData_s {
float* gGABAb_r;
float* gGABAb_d;

#ifdef JK_CA3_SNN
// NS addition
#ifdef CSTP_DOUBLES
double* AMPA_syn_g;
double* NMDA_d_syn_g;
double* NMDA_r_syn_g;
double* GABAa_syn_g;
double* GABAb_d_syn_g;
double* GABAb_r_syn_g;
#else
float* AMPA_syn_g;
float* NMDA_d_syn_g;
float* NMDA_r_syn_g;
float* GABAa_syn_g;
float* GABAb_d_syn_g;
float* GABAb_r_syn_g;
#endif
#endif

int* I_set; //!< an array of bits indicating which synapse got a spike

MemType memType;
Expand Down Expand Up @@ -930,6 +949,10 @@ typedef struct NetworkConfigRT_s {
// configurations for runtime data sizes
unsigned int I_setLength; //!< used for GPU only
size_t I_setPitch; //!< used for GPU only
#if JK_CA3_SNN
unsigned int syn_gLength; //!< used for GPU only
size_t syn_gPitch; //!< used for GPU only
#endif
size_t STP_Pitch; //!< numN rounded upwards to the nearest 256 boundary, used for GPU only
int numPostSynNet; //!< the total number of post-connections in a network
int numPreSynNet; //!< the total number of pre-connections in a network
Expand Down
2 changes: 1 addition & 1 deletion carlsim/kernel/inc/snn_definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,4 @@
#define GET_INITWTS_RAMPUP(a) (((a) >> CONNECTION_INITWTS_RAMPUP) & 1)
#define GET_INITWTS_RAMPDOWN(a) (((a) >> CONNECTION_INITWTS_RAMPDOWN) & 1)

#endif
#endif
Loading