Closed sebjameswml closed 9 years ago
Hi Seb, the dataType should be passed in and then checked against the dataType received from the input. Seems that the uninitialised dataType always ends up as 0 (though this isn't something that can or should be relied on!). I'll get on and fix this. There is nothing in the component to receive the dataType certainly.
Ok, no problem. I just initialized the value to analog and it works now On Jun 12, 2014 1:41 PM, "ajc158" notifications@github.com wrote:
Hi Seb, the dataType should be passed in and then checked against the dataType received from the input. Seems that the uninitialised dataType always ends up as 0 (though this isn't something that can or should be relied on!). I'll get on and fix this.
— Reply to this email directly or view it on GitHub https://github.com/SpineML/SpineML_2_BRAHMS/issues/7#issuecomment-45885990 .
Oh, another thing Alex, what is the "size" for an external input? It seems to initialise to 1.
Oh, now I found it - it's 1 sizeof(double).
This is confusing - the size in the SpineCreator code (this is the number that ends up in experiment.xml) seems to be referring to "number of doubles"
However, in the client code in SpineML_2_BRAHMS, size seems to be "number of bytes":
bool spineMLNetworkClient::sendData(char * ptr, int size)
{
// send data
int sent_bytes = 0;
while (sent_bytes < size)
sent_bytes += send(sockfd,ptr+sent_bytes,size, MSG_DONTWAIT);
Any comments @ajc158 ?
Yep, the conversion is done in the externalInput and externalOutput component.cpp - I think this was so that the .cpp file was not simulator specific - different simulators may use different precision - all you know is the number of values you are sending... Maybe this should be standardised and the simulator should use the client interface to tell the external program what data type it requires, or convert to that data type from a standard communication data type...
Reading that again I don't think it makes sense! This needs standardising
I think there's a bit of a mixture of "size means bytes" in some cases (such as spineMLNetworkClient::recvData) but also "size means number of doubles" in other cases, such as when spineMLNetworkClient::createClient(string hostname, int port, int size, dataTypes datatype, int targetOrSource) is called from the component.cpp code with size=1, which came in from the experiment.xml file and the definition of the externalInput therein.
The size of the externalInput is written by SpineCreator based on the size of the population etc.. you are inputing to. I cannot be set by the user because there is no reason that the user would need to set it...
how do you mean "based on the size of the population". Is it not just the size of the number which you are transmitting into the externalInput for each timestep?
Each timestep you will transmit 'size' values - in the example of a neural population size N this would be one current input for each of the N neurons in that population at each timestep...
Spikes would have to be handled differently
Ok. That sounds ok. And the values are ALWAYS doubles, right?
Yep, I have no intention of supporting anything else for the forseeable (other precisions/types wouldn't be very useful in most cases anyway).
Commit 44e42b886 initialises the dataType to ANALOG.
Closing as I think the commit above addresses this ok.
See the component event method. The dataType member attribute is used uninitialized in a couple of locations.
It's not clear how we decide what dataType should be (whether analog, event or impulse). Is there anything in the XML that tells us this (ping @ajc158 )?
Here's an example ExternalInput node from an experiment.xml file:
Does anything in there get translated into the SystemML node?