146 void setName(
const std::string&);
151 void setTiming(
bool);
152 void setSeed(
unsigned int);
153 void setRNType(
const std::string &
type);
156 void setGPUDevice(
int);
158 string scalarExpr(
const double)
const;
161 void setPopulationSums();
165 bool zeroCopyInUse()
const;
168 unsigned int getNumPreSynapseResetRequiredGroups()
const;
174 bool isHostRNGRequired()
const;
178 bool isDeviceRNGRequired()
const;
183 bool canRunOnCPU()
const;
192 std::string getTimePrecision()
const;
213 std::string getGeneratedCodePath(
const std::string &path,
const std::string &filename)
const;
221 bool isDeviceInitRequired(
int localHostID)
const;
225 bool isDeviceSparseInitRequired()
const;
241 unsigned int getNeuronGridSize()
const;
244 unsigned int getNumLocalNeurons()
const;
247 unsigned int getNumRemoteNeurons()
const;
250 unsigned int getNumNeurons()
const{
return getNumLocalNeurons() + getNumRemoteNeurons(); }
256 NeuronGroup *findNeuronGroup(
const std::string &name);
258 NeuronGroup *addNeuronPopulation(
const string&,
unsigned int,
unsigned int,
const double *,
const double *,
int hostID = 0,
int deviceID = 0);
259 NeuronGroup *addNeuronPopulation(
const string&,
unsigned int,
unsigned int,
const vector<double>&,
const vector<double>&,
int hostID = 0,
int deviceID = 0);
269 template<
typename NeuronModel>
271 const typename NeuronModel::ParamValues ¶mValues,
272 const typename NeuronModel::VarValues &varInitialisers,
273 int hostID = 0,
int deviceID = 0)
276 gennError(
"You need to call initGeNN first.");
279 gennError(
"Trying to add a neuron population to a finalized model.");
285 MPI_Comm_rank(MPI_COMM_WORLD, &mpiHostID);
288 auto &groupMap = (hostID == mpiHostID) ? m_LocalNeuronGroups : m_RemoteNeuronGroups;
291 auto &groupMap = m_LocalNeuronGroups;
296 auto result = groupMap.emplace(std::piecewise_construct,
297 std::forward_as_tuple(name),
298 std::forward_as_tuple(name, size, model,
299 paramValues.getValues(), varInitialisers.getInitialisers(), hostID, deviceID));
303 gennError(
"Cannot add a neuron population with duplicate name:" + name);
308 return &result.first->second;
319 template<
typename NeuronModel>
321 const typename NeuronModel::ParamValues ¶mValues,
const typename NeuronModel::VarValues &varInitialisers,
322 int hostID = 0,
int deviceID = 0)
324 return addNeuronPopulation<NeuronModel>(
name, size, NeuronModel::getInstance(), paramValues, varInitialisers, hostID, deviceID);
327 void setNeuronClusterIndex(
const string &neuronGroup,
int hostID,
int deviceID);
329 void activateDirectInput(
const string&,
unsigned int type);
330 void setConstInp(
const string&,
double);
360 unsigned int getSynapseKernelGridSize()
const;
365 unsigned int getSynapsePostLearnGridSize()
const;
370 unsigned int getSynapseDynamicsGridSize()
const;
373 const SynapseGroup *findSynapseGroup(
const std::string &name)
const;
376 SynapseGroup *findSynapseGroup(
const std::string &name);
379 bool isSynapseGroupDynamicsRequired(
const std::string &name)
const;
382 bool isSynapseGroupPostLearningRequired(
const std::string &name)
const;
385 SynapseGroup *addSynapsePopulation(
const string&,
unsigned int,
SynapseConnType,
SynapseGType,
unsigned int,
unsigned int,
const string&,
const string&,
const double *,
const double *,
const double *);
386 SynapseGroup *addSynapsePopulation(
const string&,
unsigned int,
SynapseConnType,
SynapseGType,
unsigned int,
unsigned int,
const string&,
const string&,
const double *,
const double *,
const double *,
const double *);
388 const vector<double>&,
const vector<double>&,
const vector<double>&,
const vector<double>&);
407 template<
typename WeightUpdateModel,
typename PostsynapticModel>
409 const WeightUpdateModel *wum,
const typename WeightUpdateModel::ParamValues &weightParamValues,
const typename WeightUpdateModel::VarValues &weightVarInitialisers,
const typename WeightUpdateModel::PreVarValues &weightPreVarInitialisers,
const typename WeightUpdateModel::PostVarValues &weightPostVarInitialisers,
410 const PostsynapticModel *psm,
const typename PostsynapticModel::ParamValues &postsynapticParamValues,
const typename PostsynapticModel::VarValues &postsynapticVarInitialisers,
414 gennError(
"You need to call initGeNN first.");
417 gennError(
"Trying to add a synapse population to a finalized model.");
421 auto srcNeuronGrp = findNeuronGroup(src);
422 auto trgNeuronGrp = findNeuronGroup(trg);
426 const int hostID = trgNeuronGrp->getClusterHostID();
430 MPI_Comm_rank(MPI_COMM_WORLD, &mpiHostID);
433 auto &groupMap = (hostID == mpiHostID) ? m_LocalSynapseGroups : m_RemoteSynapseGroups;
436 auto &groupMap = m_LocalSynapseGroups;
440 auto result = groupMap.emplace(
441 std::piecewise_construct,
442 std::forward_as_tuple(name),
443 std::forward_as_tuple(name, mtype, delaySteps,
444 wum, weightParamValues.getValues(), weightVarInitialisers.getInitialisers(), weightPreVarInitialisers.getInitialisers(), weightPostVarInitialisers.getInitialisers(),
445 psm, postsynapticParamValues.getValues(), postsynapticVarInitialisers.getInitialisers(),
446 srcNeuronGrp, trgNeuronGrp,
447 connectivityInitialiser));
451 gennError(
"Cannot add a synapse population with duplicate name:" + name);
456 return &result.first->second;
473 template<
typename WeightUpdateModel,
typename PostsynapticModel>
475 const typename WeightUpdateModel::ParamValues &weightParamValues,
const typename WeightUpdateModel::VarValues &weightVarInitialisers,
476 const typename PostsynapticModel::ParamValues &postsynapticParamValues,
const typename PostsynapticModel::VarValues &postsynapticVarInitialisers,
480 typename WeightUpdateModel::PreVarValues weightPreVarInitialisers;
481 typename WeightUpdateModel::PostVarValues weightPostVarInitialisers;
483 return addSynapsePopulation(name, mtype, delaySteps, src, trg,
484 WeightUpdateModel::getInstance(), weightParamValues, weightVarInitialisers, weightPreVarInitialisers, weightPostVarInitialisers,
485 PostsynapticModel::getInstance(), postsynapticParamValues, postsynapticVarInitialisers,
486 connectivityInitialiser);
504 template<
typename WeightUpdateModel,
typename PostsynapticModel>
506 const typename WeightUpdateModel::ParamValues &weightParamValues,
const typename WeightUpdateModel::VarValues &weightVarInitialisers,
const typename WeightUpdateModel::PreVarValues &weightPreVarInitialisers,
const typename WeightUpdateModel::PostVarValues &weightPostVarInitialisers,
507 const typename PostsynapticModel::ParamValues &postsynapticParamValues,
const typename PostsynapticModel::VarValues &postsynapticVarInitialisers,
510 return addSynapsePopulation(name, mtype, delaySteps, src, trg,
511 WeightUpdateModel::getInstance(), weightParamValues, weightVarInitialisers, weightPreVarInitialisers, weightPostVarInitialisers,
512 PostsynapticModel::getInstance(), postsynapticParamValues, postsynapticVarInitialisers,
513 connectivityInitialiser);
517 void setSynapseG(
const string&,
double);
518 void setMaxConn(
const string&,
unsigned int);
519 void setSpanTypeToPre(
const string&);
535 const CurrentSource *findCurrentSource(
const std::string &name)
const;
548 template<
typename CurrentSourceModel>
550 const string &targetNeuronGroupName,
551 const typename CurrentSourceModel::ParamValues ¶mValues,
552 const typename CurrentSourceModel::VarValues &varInitialisers)
555 gennError(
"You need to call initGeNN first.");
558 gennError(
"Trying to add a current source to a finalized model.");
560 auto targetGroup = findNeuronGroup(targetNeuronGroupName);
564 const int hostID = targetGroup->getClusterHostID();
568 MPI_Comm_rank(MPI_COMM_WORLD, &mpiHostID);
571 auto &groupMap = (hostID == mpiHostID) ? m_LocalCurrentSources : m_RemoteCurrentSources;
574 auto &groupMap = m_LocalCurrentSources;
578 auto result = groupMap.emplace(std::piecewise_construct,
579 std::forward_as_tuple(currentSourceName),
580 std::forward_as_tuple(currentSourceName, model,
581 paramValues.getValues(), varInitialisers.getInitialisers()));
585 gennError(
"Cannot add a current source with duplicate name:" + currentSourceName);
590 targetGroup->injectCurrent(&result.first->second);
591 return &result.first->second;
602 template<
typename CurrentSourceModel>
604 const typename CurrentSourceModel::ParamValues ¶mValues,
605 const typename CurrentSourceModel::VarValues &varInitialisers)
607 return addCurrentSource<CurrentSourceModel>(currentSourceName, CurrentSourceModel::getInstance(),
608 targetNeuronGroupName, paramValues, varInitialisers);
617 map<string, NeuronGroup> m_LocalNeuronGroups;
620 map<string, NeuronGroup> m_RemoteNeuronGroups;
623 map<string, SynapseGroup> m_LocalSynapseGroups;
626 map<string, SynapseGroup> m_RemoteSynapseGroups;
629 map<string, CurrentSource> m_LocalCurrentSources;
632 map<string, CurrentSource> m_RemoteCurrentSources;
636 map<string, std::pair<unsigned int, unsigned int>> m_SynapsePostLearnGroups;
640 map<string, std::pair<unsigned int, unsigned int>> m_SynapseDynamicsGroups;
643 map<string, string> m_InitKernelParameters;
644 map<string, string> neuronKernelParameters;
645 map<string, string> synapseKernelParameters;
646 map<string, string> simLearnPostKernelParameters;
647 map<string, string> synapseDynamicsKernelParameters;
648 map<string, string> currentSourceKernelParameters;
659 unsigned int resetKernel;
NeuronGroup * addNeuronPopulation(const string &name, unsigned int size, const NeuronModel *model, const typename NeuronModel::ParamValues ¶mValues, const typename NeuronModel::VarValues &varInitialisers, int hostID=0, int deviceID=0)
Adds a new neuron group to the model using a neuron model managed by the user.
Definition: modelSpec.h:270
Definition: modelSpec.h:58
Definition: neuronGroup.h:19
map< string, NeuronGroup >::value_type NeuronGroupValueType
Definition: modelSpec.h:137
const map< string, NeuronGroup > & getLocalNeuronGroups() const
Get std::map containing local named NeuronGroup objects in model.
Definition: modelSpec.h:230
const map< string, SynapseGroup > & getRemoteSynapseGroups() const
Get std::map containing remote named SynapseGroup objects in model.
Definition: modelSpec.h:338
SynapseGroup * addSynapsePopulation(const string &name, SynapseMatrixType mtype, unsigned int delaySteps, const string &src, const string &trg, const typename WeightUpdateModel::ParamValues &weightParamValues, const typename WeightUpdateModel::VarValues &weightVarInitialisers, const typename PostsynapticModel::ParamValues &postsynapticParamValues, const typename PostsynapticModel::VarValues &postsynapticVarInitialisers, const InitSparseConnectivitySnippet::Init &connectivityInitialiser=uninitialisedConnectivity())
Adds a synapse population to the model using singleton weight update and postsynaptic models created ...
Definition: modelSpec.h:474
Time uses default model precision.
Definition: modelSpec.h:50
Definition: modelSpec.h:132
TimePrecision
Definition: modelSpec.h:83
map< string, std::pair< unsigned int, unsigned int > >::value_type SynapseGroupSubsetValueType
Definition: modelSpec.h:139
NewModels::VarInit initVar(const typename S::ParamValues ¶ms)
Definition: modelSpec.h:94
Definition: modelSpec.h:59
Definition: initSparseConnectivitySnippet.h:60
const map< string, string > & getCurrentSourceKernelParameters() const
Gets std::map containing names and types of each parameter that should be passed through to the curre...
Definition: modelSpec.h:532
const std::string & getPrecision() const
Gets the floating point numerical precision.
Definition: modelSpec.h:189
Definition: newModels.h:36
bool isFinalized() const
Is the model specification finalized.
Definition: modelSpec.h:207
Time uses single precision - not suitable for long simulations.
const map< string, string > & getSynapseDynamicsKernelParameters() const
Gets std::map containing names and types of each parameter that should be passed through to the synap...
Definition: modelSpec.h:355
SynapseGroup * addSynapsePopulation(const string &name, SynapseMatrixType mtype, unsigned int delaySteps, const string &src, const string &trg, const typename WeightUpdateModel::ParamValues &weightParamValues, const typename WeightUpdateModel::VarValues &weightVarInitialisers, const typename WeightUpdateModel::PreVarValues &weightPreVarInitialisers, const typename WeightUpdateModel::PostVarValues &weightPostVarInitialisers, const typename PostsynapticModel::ParamValues &postsynapticParamValues, const typename PostsynapticModel::VarValues &postsynapticVarInitialisers, const InitSparseConnectivitySnippet::Init &connectivityInitialiser=uninitialisedConnectivity())
Adds a synapse population to the model using singleton weight update and postsynaptic models created ...
Definition: modelSpec.h:505
type
Definition: generate_swig_interfaces.py:680
name
Definition: setup.py:112
Definition: modelSpec.h:60
bool isTimingEnabled() const
Are timers and timing commands enabled.
Definition: modelSpec.h:210
const map< string, std::pair< unsigned int, unsigned int > > & getSynapseDynamicsGroups() const
Definition: modelSpec.h:346
This file contains standard utility functions provide within the NVIDIA CUDA software development too...
double getDT() const
Gets the model integration step size.
Definition: modelSpec.h:198
CurrentSource * addCurrentSource(const string ¤tSourceName, const CurrentSourceModel *model, const string &targetNeuronGroupName, const typename CurrentSourceModel::ParamValues ¶mValues, const typename CurrentSourceModel::VarValues &varInitialisers)
Adds a new current source to the model using a current source model managed by the user...
Definition: modelSpec.h:549
const map< string, std::pair< unsigned int, unsigned int > > & getSynapsePostLearnGroups() const
Definition: modelSpec.h:342
const map< string, SynapseGroup > & getLocalSynapseGroups() const
Get std::map containing local named SynapseGroup objects in model.
Definition: modelSpec.h:335
bool isPreSynapseResetRequired() const
Is there reset logic to be run before the synapse kernel i.e. for dendritic delays.
Definition: modelSpec.h:171
const map< string, string > & getInitKernelParameters() const
Definition: modelSpec.h:217
Definition: synapseGroup.h:19
InitSparseConnectivitySnippet::Init initConnectivity(const typename S::ParamValues ¶ms)
Definition: modelSpec.h:111
const map< string, CurrentSource > & getRemoteCurrentSources() const
Get std::map containing remote named CurrentSource objects in model.
Definition: modelSpec.h:529
void gennError(const string &error)
Function called upon the detection of an error. Outputs an error message and then exits...
Definition: utils.h:111
NewModels::VarInit uninitialisedVar()
Definition: modelSpec.h:105
const std::string & getName() const
Gets the name of the neuronal network model.
Definition: modelSpec.h:186
const map< string, string > & getSynapseKernelParameters() const
Gets std::map containing names and types of each parameter that should be passed through to the synap...
Definition: modelSpec.h:349
const map< string, string > & getNeuronKernelParameters() const
Gets std::map containing names and types of each parameter that should be passed through to the neuro...
Definition: modelSpec.h:236
SynapseGType
Definition: modelSpec.h:56
map< string, SynapseGroup >::value_type SynapseGroupValueType
Definition: modelSpec.h:138
SynapseGroup * addSynapsePopulation(const string &name, SynapseMatrixType mtype, unsigned int delaySteps, const string &src, const string &trg, const WeightUpdateModel *wum, const typename WeightUpdateModel::ParamValues &weightParamValues, const typename WeightUpdateModel::VarValues &weightVarInitialisers, const typename WeightUpdateModel::PreVarValues &weightPreVarInitialisers, const typename WeightUpdateModel::PostVarValues &weightPostVarInitialisers, const PostsynapticModel *psm, const typename PostsynapticModel::ParamValues &postsynapticParamValues, const typename PostsynapticModel::VarValues &postsynapticVarInitialisers, const InitSparseConnectivitySnippet::Init &connectivityInitialiser=uninitialisedConnectivity())
Adds a synapse population to the model using weight update and postsynaptic models managed by the use...
Definition: modelSpec.h:408
CurrentSource * addCurrentSource(const string ¤tSourceName, const string &targetNeuronGroupName, const typename CurrentSourceModel::ParamValues ¶mValues, const typename CurrentSourceModel::VarValues &varInitialisers)
Adds a new current source to the model using a singleton current source model created using standard ...
Definition: modelSpec.h:603
unsigned int getNumNeurons() const
How many neurons make up the entire model.
Definition: modelSpec.h:250
const map< string, NeuronGroup > & getRemoteNeuronGroups() const
Get std::map containing remote named NeuronGroup objects in model.
Definition: modelSpec.h:233
SynapseConnType
Definition: modelSpec.h:48
SynapseMatrixType
Definition: synapseMatrixType.h:25
Time uses double precision - may reduce performance.
unsigned int getSeed() const
Get the random seed.
Definition: modelSpec.h:201
const map< string, string > & getSimLearnPostKernelParameters() const
Gets std::map containing names and types of each parameter that should be passed through to the posts...
Definition: modelSpec.h:352
unsigned int getResetKernel() const
Which kernel should contain the reset logic? Specified in terms of GENN_FLAGS.
Definition: modelSpec.h:195
NeuronGroup * addNeuronPopulation(const string &name, unsigned int size, const typename NeuronModel::ParamValues ¶mValues, const typename NeuronModel::VarValues &varInitialisers, int hostID=0, int deviceID=0)
Adds a new neuron group to the model using a singleton neuron model created using standard DECLARE_MO...
Definition: modelSpec.h:320
FloatType
Definition: modelSpec.h:75
void initGeNN()
Method for GeNN initialisation (by preparing standard models)
Definition: src/modelSpec.cc:40
const map< string, CurrentSource > & getLocalCurrentSources() const
Get std::map containing local named CurrentSource objects in model.
Definition: modelSpec.h:526
Definition: modelSpec.h:79
const std::string & getRNType() const
Gets the underlying type for random number generation (default: uint64_t)
Definition: modelSpec.h:204
VarInit
Definition: variableMode.h:18
InitSparseConnectivitySnippet::Init uninitialisedConnectivity()
Definition: modelSpec.h:122
Definition: currentSource.h:17
unsigned int GeNNReady
Definition: src/modelSpec.cc:36