CARLsim4
CARLsim4 copied to clipboard
Assertion error when calling sim.setWeight on 2 different neuron groups
I am trying to use sim.setWeight to apply a normal distribution to the synaptic weights between 2 neuron groups. However, when I call sim.setWeight I get the following assertion error:
carlsim/kernel/src/snn_manager.cpp:1337: void SNN::setWeight(short int, int, int, float, bool): Assertion `managerRuntimeData.connIdsPreIdx[pos_ij] == connId' failed.
It seems like the wrong connection ID is being retrieved, however I cannot seem to figure out what the variable pos_ij is and therefore can't figure out why the error is occurring (I tried printing pos_ij from snn_manager.cpp but nothing would print).
I believe I am giving the setWeight method the correct inputs (connection ID and 0-indexed neuron numbers), so I am thinking this may be a bug. Also, when calling setWeight on a connection from one neuron group to itself there is no problem, only when it is called on 2 separate neuron groups.
In another case, again when trying to modify synapses between 2 different groups, there is no assertion error but I get: [WARNING carlsim/kernel/src/snn_manager.cpp:1372] setWeight(0,159,39,0.050000,false): Synapse does not exist, not updated.
Even though I've set the connection probability to be 1.0 between the 2 groups (so the synapse should definitely exist)
Here is a text file version of the project file I am having trouble with. The problem occurs first during the setWeight call on line 312
I think the following 2 lines (lines 1327-28 of snn_manager.cpp) might be the problem:
int neurIdPreReal = groupConfigs[netId][lGrpId].lStartN + neurIdPre; int neurIdPostReal = groupConfigs[netId][lGrpId].lStartN + neurIdPost;
Here, if I'm not mistaken, the first line is trying to find the real neuronID (not 0-indexed) of the presynaptic neuron. However it is using the lGrpID (what is this variable by the way?) found on line 1300 of snn_manager.cpp:
int lGrpId = groupConfigMDMap[connectConfigMap[connId].grpDest].lGrpId;
which is using .grpDest. Therefore I think this function is only looking for pre/post-synaptic neurons in the same group. Can you please confirm? Thanks!
You are correct!! The bug has been fixed by d08722aeb367644e5f9721b60f7c5b12c0a9084a . Thanks for report the bug.
Thanks! I am still using an extremely inelegant and slow method for creating normally distributed connection weights (without using any topology). Is there a better way to do this already (or in an upcoming update)? It would be really nice if it was part of the sim.connect method. E.g. Have something like: sim.connect(g1, g2, "random", WeightDistribution("normal",meanW, Wstd), conn_prob, RangeDelay(1,1), RadiusRF(-1), SYN_FIXED);
where WeightDistribution would be an object that holds the type of distribution (uniform, normal, exponential, etc.) and the relevant parameters (mean and/or standard deviation). Is something like this possible?
I just got a new computer with 4 GPUs. I tried running the same simulation I had problems with above but assigned 2 groups to 3 different GPUs (So groups 1 & 2 on GPU 0, 3-4 on GPU 1, 5-6 on GPU2). This caused that same assertion error to be thrown when calling setWeight on a connection where the pre/post groups were assigned to different GPUs:
void SNN::setWeight(short int, int, int, float, bool): Assertion `managerRuntimeData.connIdsPreIdx[pos_ij] == connId' failed.
I'm not sure if this is a bug or by design.
We don't have plan to implement weight distribution currently. It can be done by ConnectionGenerator, which is a callback function that allow users to define the connections. You may want to look into it.
Thanks! I am still using an extremely inelegant and slow method for creating normally distributed connection weights (without using any topology). Is there a better way to do this already (or in an upcoming update)? It would be really nice if it was part of the sim.connect method. E.g. Have something like: sim.connect(g1, g2, "random", WeightDistribution("normal",meanW, Wstd), conn_prob, RangeDelay(1,1), RadiusRF(-1), SYN_FIXED);
where WeightDistribution would be an object that holds the type of distribution (uniform, normal, exponential, etc.) and the relevant parameters (mean and/or standard deviation). Is something like this possible?