GeNN  3.3.0
GPU enhanced Neuronal Networks (GeNN)
modelSpec.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------
2  Author: Thomas Nowotny
3 
4  Institute: Center for Computational Neuroscience and Robotics
5  University of Sussex
6  Falmer, Brighton BN1 9QJ, UK
7 
8  email to: T.Nowotny@sussex.ac.uk
9 
10  initial version: 2010-02-07
11 
12  This file contains neuron model declarations.
13 
14 --------------------------------------------------------------------------*/
15 
16 //--------------------------------------------------------------------------
23 //--------------------------------------------------------------------------
24 
25 #ifndef _MODELSPEC_H_
26 #define _MODELSPEC_H_
27 
28 #include "neuronGroup.h"
29 #include "synapseGroup.h"
30 #include "currentSource.h"
31 #include "utils.h"
32 
33 #include <map>
34 #include <set>
35 #include <string>
36 #include <vector>
37 #ifdef MPI_ENABLE
38 #include <mpi.h>
39 #endif
40 
41 using namespace std;
42 
43 
44 void initGeNN();
45 extern unsigned int GeNNReady;
46 
47 // connectivity of the network (synapseConnType)
49 {
53 };
54 
55 // conductance type (synapseGType)
57 {
61 };
62 
63 #define NO_DELAY 0
64 
65 #define NOLEARNING 0
66 #define LEARNING 1
67 
68 #define EXITSYN 0
69 #define INHIBSYN 1
70 
71 #define CPU 0
72 #define GPU 1
73 
74 enum FloatType
76 {
77  GENN_FLOAT,
78  GENN_DOUBLE,
80 };
81 
83 enum class TimePrecision
84 {
85  DEFAULT,
86  FLOAT,
87  DOUBLE,
88 };
89 
90 #define AUTODEVICE -1
91 
92 // Wrappers to save typing when declaring VarInitialisers structures
93 template<typename S>
94 inline NewModels::VarInit initVar(const typename S::ParamValues &params)
95 {
96  return NewModels::VarInit(S::getInstance(), params.getValues());
97 }
98 
99 template<typename S>
100 inline typename std::enable_if<std::is_same<typename S::ParamValues, Snippet::ValueBase<0>>::value, NewModels::VarInit>::type initVar()
101 {
102  return NewModels::VarInit(S::getInstance(), {});
103 }
104 
106 {
107  return NewModels::VarInit(InitVarSnippet::Uninitialised::getInstance(), {});
108 }
109 
110 template<typename S>
111 inline InitSparseConnectivitySnippet::Init initConnectivity(const typename S::ParamValues &params)
112 {
113  return InitSparseConnectivitySnippet::Init(S::getInstance(), params.getValues());
114 }
115 
116 template<typename S>
117 inline typename std::enable_if<std::is_same<typename S::ParamValues, Snippet::ValueBase<0>>::value, InitSparseConnectivitySnippet::Init>::type initConnectivity()
118 {
119  return InitSparseConnectivitySnippet::Init(S::getInstance(), {});
120 }
121 
123 {
124  return InitSparseConnectivitySnippet::Init(InitSparseConnectivitySnippet::Uninitialised::getInstance(), {});
125 }
126 
127 /*===============================================================
129 //
130 ================================================================*/
131 
132 class NNmodel
133 {
134 public:
135  // Typedefines
136  //=======================
137  typedef map<string, NeuronGroup>::value_type NeuronGroupValueType;
138  typedef map<string, SynapseGroup>::value_type SynapseGroupValueType;
139  typedef map<string, std::pair<unsigned int, unsigned int>>::value_type SynapseGroupSubsetValueType;
140 
141  NNmodel();
142  ~NNmodel();
143 
144  // PUBLIC MODEL FUNCTIONS
145  //=======================
146  void setName(const std::string&);
147 
148  void setPrecision(FloatType);
149  void setTimePrecision(TimePrecision timePrecision);
150  void setDT(double);
151  void setTiming(bool);
152  void setSeed(unsigned int);
153  void setRNType(const std::string &type);
154 
155 #ifndef CPU_ONLY
156  void setGPUDevice(int);
157 #endif
158  string scalarExpr(const double) const;
160 
161  void setPopulationSums();
162  void finalize();
163 
165  bool zeroCopyInUse() const;
166 
168  unsigned int getNumPreSynapseResetRequiredGroups() const;
169 
171  bool isPreSynapseResetRequired() const{ return getNumPreSynapseResetRequiredGroups() > 0; }
172 
174  bool isHostRNGRequired() const;
175 
177 
178  bool isDeviceRNGRequired() const;
179 
181 
183  bool canRunOnCPU() const;
184 
186  const std::string &getName() const{ return name; }
187 
189  const std::string &getPrecision() const{ return ftype; }
190 
192  std::string getTimePrecision() const;
193 
195  unsigned int getResetKernel() const{ return resetKernel; }
196 
198  double getDT() const { return dt; }
199 
201  unsigned int getSeed() const { return seed; }
202 
204  const std::string &getRNType() const{ return RNtype; }
205 
207  bool isFinalized() const{ return final; }
208 
210  bool isTimingEnabled() const{ return timing; }
211 
213  std::string getGeneratedCodePath(const std::string &path, const std::string &filename) const;
214 
215  // PUBLIC INITIALISATION FUNCTIONS
216  //================================
217  const map<string, string> &getInitKernelParameters() const{ return m_InitKernelParameters; }
218 
220 
221  bool isDeviceInitRequired(int localHostID) const;
222 
224 
225  bool isDeviceSparseInitRequired() const;
226 
227  // PUBLIC NEURON FUNCTIONS
228  //========================
230  const map<string, NeuronGroup> &getLocalNeuronGroups() const{ return m_LocalNeuronGroups; }
231 
233  const map<string, NeuronGroup> &getRemoteNeuronGroups() const{ return m_RemoteNeuronGroups; }
234 
236  const map<string, string> &getNeuronKernelParameters() const{ return neuronKernelParameters; }
237 
239 
241  unsigned int getNeuronGridSize() const;
242 
244  unsigned int getNumLocalNeurons() const;
245 
247  unsigned int getNumRemoteNeurons() const;
248 
250  unsigned int getNumNeurons() const{ return getNumLocalNeurons() + getNumRemoteNeurons(); }
251 
253  const NeuronGroup *findNeuronGroup(const std::string &name) const;
254 
256  NeuronGroup *findNeuronGroup(const std::string &name);
257 
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);
260 
262 
269  template<typename NeuronModel>
270  NeuronGroup *addNeuronPopulation(const string &name, unsigned int size, const NeuronModel *model,
271  const typename NeuronModel::ParamValues &paramValues,
272  const typename NeuronModel::VarValues &varInitialisers,
273  int hostID = 0, int deviceID = 0)
274  {
275  if (!GeNNReady) {
276  gennError("You need to call initGeNN first.");
277  }
278  if (final) {
279  gennError("Trying to add a neuron population to a finalized model.");
280  }
281 
282 #ifdef MPI_ENABLE
283  // Determine the host ID
284  int mpiHostID = 0;
285  MPI_Comm_rank(MPI_COMM_WORLD, &mpiHostID);
286 
287  // Pick map to add group to appropriately
288  auto &groupMap = (hostID == mpiHostID) ? m_LocalNeuronGroups : m_RemoteNeuronGroups;
289 #else
290  // If MPI is disabled always add to local neuron groups and zero host id
291  auto &groupMap = m_LocalNeuronGroups;
292  hostID = 0;
293 #endif
294 
295  // Add neuron group to map
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));
300 
301  if(!result.second)
302  {
303  gennError("Cannot add a neuron population with duplicate name:" + name);
304  return NULL;
305  }
306  else
307  {
308  return &result.first->second;
309  }
310  }
311 
313 
319  template<typename NeuronModel>
320  NeuronGroup *addNeuronPopulation(const string &name, unsigned int size,
321  const typename NeuronModel::ParamValues &paramValues, const typename NeuronModel::VarValues &varInitialisers,
322  int hostID = 0, int deviceID = 0)
323  {
324  return addNeuronPopulation<NeuronModel>(name, size, NeuronModel::getInstance(), paramValues, varInitialisers, hostID, deviceID);
325  }
326 
327  void setNeuronClusterIndex(const string &neuronGroup, int hostID, int deviceID);
328 
329  void activateDirectInput(const string&, unsigned int type);
330  void setConstInp(const string&, double);
331 
332  // PUBLIC SYNAPSE FUNCTIONS
333  //=========================
335  const map<string, SynapseGroup> &getLocalSynapseGroups() const{ return m_LocalSynapseGroups; }
336 
338  const map<string, SynapseGroup> &getRemoteSynapseGroups() const{ return m_RemoteSynapseGroups; }
339 
342  const map<string, std::pair<unsigned int, unsigned int>> &getSynapsePostLearnGroups() const{ return m_SynapsePostLearnGroups; }
343 
346  const map<string, std::pair<unsigned int, unsigned int>> &getSynapseDynamicsGroups() const{ return m_SynapseDynamicsGroups; }
347 
349  const map<string, string> &getSynapseKernelParameters() const{ return synapseKernelParameters; }
350 
352  const map<string, string> &getSimLearnPostKernelParameters() const{ return simLearnPostKernelParameters; }
353 
355  const map<string, string> &getSynapseDynamicsKernelParameters() const{ return synapseDynamicsKernelParameters; }
356 
358 
360  unsigned int getSynapseKernelGridSize() const;
361 
363 
365  unsigned int getSynapsePostLearnGridSize() const;
366 
368 
370  unsigned int getSynapseDynamicsGridSize() const;
371 
373  const SynapseGroup *findSynapseGroup(const std::string &name) const;
374 
376  SynapseGroup *findSynapseGroup(const std::string &name);
377 
379  bool isSynapseGroupDynamicsRequired(const std::string &name) const;
380 
382  bool isSynapseGroupPostLearningRequired(const std::string &name) const;
383 
384  SynapseGroup *addSynapsePopulation(const string &name, unsigned int syntype, SynapseConnType conntype, SynapseGType gtype, const string& src, const string& trg, const double *p);
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 *);
387  SynapseGroup *addSynapsePopulation(const string&, unsigned int, SynapseConnType, SynapseGType, unsigned int, unsigned int, const string&, const string&,
388  const vector<double>&, const vector<double>&, const vector<double>&, const vector<double>&);
389 
391 
407  template<typename WeightUpdateModel, typename PostsynapticModel>
408  SynapseGroup *addSynapsePopulation(const string &name, SynapseMatrixType mtype, unsigned int delaySteps, const string& src, const string& trg,
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,
411  const InitSparseConnectivitySnippet::Init &connectivityInitialiser = uninitialisedConnectivity())
412  {
413  if (!GeNNReady) {
414  gennError("You need to call initGeNN first.");
415  }
416  if (final) {
417  gennError("Trying to add a synapse population to a finalized model.");
418  }
419 
420  // Get source and target neuron groups
421  auto srcNeuronGrp = findNeuronGroup(src);
422  auto trgNeuronGrp = findNeuronGroup(trg);
423 
424 #ifdef MPI_ENABLE
425  // Get host ID of target neuron group
426  const int hostID = trgNeuronGrp->getClusterHostID();
427 
428  // Determine the host ID
429  int mpiHostID = 0;
430  MPI_Comm_rank(MPI_COMM_WORLD, &mpiHostID);
431 
432  // Pick map to add group to appropriately
433  auto &groupMap = (hostID == mpiHostID) ? m_LocalSynapseGroups : m_RemoteSynapseGroups;
434 #else
435  // If MPI is disabled always add to local synapse groups
436  auto &groupMap = m_LocalSynapseGroups;
437 #endif
438 
439  // Add synapse group to map
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));
448 
449  if(!result.second)
450  {
451  gennError("Cannot add a synapse population with duplicate name:" + name);
452  return NULL;
453  }
454  else
455  {
456  return &result.first->second;
457  }
458  }
459 
461 
473  template<typename WeightUpdateModel, typename PostsynapticModel>
474  SynapseGroup *addSynapsePopulation(const string &name, SynapseMatrixType mtype, unsigned int delaySteps, const string& src, const string& trg,
475  const typename WeightUpdateModel::ParamValues &weightParamValues, const typename WeightUpdateModel::VarValues &weightVarInitialisers,
476  const typename PostsynapticModel::ParamValues &postsynapticParamValues, const typename PostsynapticModel::VarValues &postsynapticVarInitialisers,
477  const InitSparseConnectivitySnippet::Init &connectivityInitialiser = uninitialisedConnectivity())
478  {
479  // Create empty pre and postsynaptic weight update variable initialisers
480  typename WeightUpdateModel::PreVarValues weightPreVarInitialisers;
481  typename WeightUpdateModel::PostVarValues weightPostVarInitialisers;
482 
483  return addSynapsePopulation(name, mtype, delaySteps, src, trg,
484  WeightUpdateModel::getInstance(), weightParamValues, weightVarInitialisers, weightPreVarInitialisers, weightPostVarInitialisers,
485  PostsynapticModel::getInstance(), postsynapticParamValues, postsynapticVarInitialisers,
486  connectivityInitialiser);
487  }
488 
490 
504  template<typename WeightUpdateModel, typename PostsynapticModel>
505  SynapseGroup *addSynapsePopulation(const string &name, SynapseMatrixType mtype, unsigned int delaySteps, const string& src, const string& trg,
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,
508  const InitSparseConnectivitySnippet::Init &connectivityInitialiser = uninitialisedConnectivity())
509  {
510  return addSynapsePopulation(name, mtype, delaySteps, src, trg,
511  WeightUpdateModel::getInstance(), weightParamValues, weightVarInitialisers, weightPreVarInitialisers, weightPostVarInitialisers,
512  PostsynapticModel::getInstance(), postsynapticParamValues, postsynapticVarInitialisers,
513  connectivityInitialiser);
514 
515  }
516 
517  void setSynapseG(const string&, double);
518  void setMaxConn(const string&, unsigned int); //< Set maximum connections per neuron for the given group (needed for optimization by sparse connectivity)
519  void setSpanTypeToPre(const string&);
520 
521 
522  // PUBLIC CURRENT SOURCE FUNCTIONS
523  //================================
524 
526  const map<string, CurrentSource> &getLocalCurrentSources() const{ return m_LocalCurrentSources; }
527 
529  const map<string, CurrentSource> &getRemoteCurrentSources() const{ return m_RemoteCurrentSources; }
530 
532  const map<string, string> &getCurrentSourceKernelParameters() const{ return currentSourceKernelParameters; }
533 
535  const CurrentSource *findCurrentSource(const std::string &name) const;
536 
538  CurrentSource *findCurrentSource(const std::string &name);
539 
541 
548  template<typename CurrentSourceModel>
549  CurrentSource *addCurrentSource(const string &currentSourceName, const CurrentSourceModel *model,
550  const string &targetNeuronGroupName,
551  const typename CurrentSourceModel::ParamValues &paramValues,
552  const typename CurrentSourceModel::VarValues &varInitialisers)
553  {
554  if (!GeNNReady) {
555  gennError("You need to call initGeNN first.");
556  }
557  if (final) {
558  gennError("Trying to add a current source to a finalized model.");
559  }
560  auto targetGroup = findNeuronGroup(targetNeuronGroupName);
561 
562 #ifdef MPI_ENABLE
563  // Get host ID of target neuron group
564  const int hostID = targetGroup->getClusterHostID();
565 
566  // Determine the host ID
567  int mpiHostID = 0;
568  MPI_Comm_rank(MPI_COMM_WORLD, &mpiHostID);
569 
570  // Pick map to add group to appropriately
571  auto &groupMap = (hostID == mpiHostID) ? m_LocalCurrentSources : m_RemoteCurrentSources;
572 #else
573  // If MPI is disabled always add to local current sources
574  auto &groupMap = m_LocalCurrentSources;
575 #endif
576 
577  // Add current source to map
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()));
582 
583  if(!result.second)
584  {
585  gennError("Cannot add a current source with duplicate name:" + currentSourceName);
586  return NULL;
587  }
588  else
589  {
590  targetGroup->injectCurrent(&result.first->second);
591  return &result.first->second;
592  }
593  }
594 
596 
602  template<typename CurrentSourceModel>
603  CurrentSource *addCurrentSource(const string &currentSourceName, const string &targetNeuronGroupName,
604  const typename CurrentSourceModel::ParamValues &paramValues,
605  const typename CurrentSourceModel::VarValues &varInitialisers)
606  {
607  return addCurrentSource<CurrentSourceModel>(currentSourceName, CurrentSourceModel::getInstance(),
608  targetNeuronGroupName, paramValues, varInitialisers);
609  }
610 
611 
612 private:
613  //--------------------------------------------------------------------------
614  // Private members
615  //--------------------------------------------------------------------------
617  map<string, NeuronGroup> m_LocalNeuronGroups;
618 
620  map<string, NeuronGroup> m_RemoteNeuronGroups;
621 
623  map<string, SynapseGroup> m_LocalSynapseGroups;
624 
626  map<string, SynapseGroup> m_RemoteSynapseGroups;
627 
629  map<string, CurrentSource> m_LocalCurrentSources;
630 
632  map<string, CurrentSource> m_RemoteCurrentSources;
633 
636  map<string, std::pair<unsigned int, unsigned int>> m_SynapsePostLearnGroups;
637 
640  map<string, std::pair<unsigned int, unsigned int>> m_SynapseDynamicsGroups;
641 
642  // Kernel members
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;
649 
650  // Model members
651  string name;
652  string ftype;
653  TimePrecision m_TimePrecision;
654  string RNtype;
655  double dt;
656  bool final;
657  bool timing;
658  unsigned int seed;
659  unsigned int resetKernel;
660 };
661 
662 #endif
NeuronGroup * addNeuronPopulation(const string &name, unsigned int size, const NeuronModel *model, const typename NeuronModel::ParamValues &paramValues, 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 &params)
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 &currentSourceName, const CurrentSourceModel *model, const string &targetNeuronGroupName, const typename CurrentSourceModel::ParamValues &paramValues, 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 &params)
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 &currentSourceName, const string &targetNeuronGroupName, const typename CurrentSourceModel::ParamValues &paramValues, 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 &paramValues, 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