![]() |
GeNN
4.0.0
GPU enhanced Neuronal Networks (GeNN)
|
#include <backend.h>
Public Member Functions | |
Backend (int localHostID, const Preferences &preferences) | |
virtual void | genNeuronUpdate (CodeStream &os, const ModelSpecInternal &model, NeuronGroupSimHandler simHandler, NeuronGroupHandler wuVarUpdateHandler) const override |
Generate platform-specific function to update the state of all neurons. More... | |
virtual void | genSynapseUpdate (CodeStream &os, const ModelSpecInternal &model, SynapseGroupHandler wumThreshHandler, SynapseGroupHandler wumSimHandler, SynapseGroupHandler wumEventHandler, SynapseGroupHandler postLearnHandler, SynapseGroupHandler synapseDynamicsHandler) const override |
Generate platform-specific function to update the state of all synapses. More... | |
virtual void | genInit (CodeStream &os, const ModelSpecInternal &model, NeuronGroupHandler localNGHandler, NeuronGroupHandler remoteNGHandler, SynapseGroupHandler sgDenseInitHandler, SynapseGroupHandler sgSparseConnectHandler, SynapseGroupHandler sgSparseInitHandler) const override |
virtual void | genDefinitionsPreamble (CodeStream &os) const override |
Definitions is the usercode-facing header file for the generated code. This function generates a 'preamble' to this header file. More... | |
virtual void | genDefinitionsInternalPreamble (CodeStream &os) const override |
Definitions internal is the internal header file for the generated code. This function generates a 'preamble' to this header file. More... | |
virtual void | genRunnerPreamble (CodeStream &os) const override |
virtual void | genAllocateMemPreamble (CodeStream &os, const ModelSpecInternal &model) const override |
virtual void | genStepTimeFinalisePreamble (CodeStream &os, const ModelSpecInternal &model) const override |
After all timestep logic is complete. More... | |
virtual void | genVariableDefinition (CodeStream &definitions, CodeStream &definitionsInternal, const std::string &type, const std::string &name, VarLocation loc) const override |
virtual void | genVariableImplementation (CodeStream &os, const std::string &type, const std::string &name, VarLocation loc) const override |
virtual void | genVariableAllocation (CodeStream &os, const std::string &type, const std::string &name, VarLocation loc, size_t count) const override |
virtual void | genVariableFree (CodeStream &os, const std::string &name, VarLocation loc) const override |
virtual void | genExtraGlobalParamDefinition (CodeStream &definitions, const std::string &type, const std::string &name, VarLocation loc) const override |
virtual void | genExtraGlobalParamImplementation (CodeStream &os, const std::string &type, const std::string &name, VarLocation loc) const override |
virtual void | genExtraGlobalParamAllocation (CodeStream &os, const std::string &type, const std::string &name, VarLocation loc) const override |
virtual void | genExtraGlobalParamPush (CodeStream &os, const std::string &type, const std::string &name) const override |
virtual void | genExtraGlobalParamPull (CodeStream &os, const std::string &type, const std::string &name) const override |
virtual void | genPopVariableInit (CodeStream &os, VarLocation loc, const Substitutions &kernelSubs, Handler handler) const override |
virtual void | genVariableInit (CodeStream &os, VarLocation loc, size_t count, const std::string &indexVarName, const Substitutions &kernelSubs, Handler handler) const override |
virtual void | genSynapseVariableRowInit (CodeStream &os, VarLocation loc, const SynapseGroupInternal &sg, const Substitutions &kernelSubs, Handler handler) const override |
virtual void | genCurrentTrueSpikePush (CodeStream &os, const NeuronGroupInternal &ng) const override |
virtual void | genCurrentTrueSpikePull (CodeStream &os, const NeuronGroupInternal &ng) const override |
virtual void | genCurrentSpikeLikeEventPush (CodeStream &os, const NeuronGroupInternal &ng) const override |
virtual void | genCurrentSpikeLikeEventPull (CodeStream &os, const NeuronGroupInternal &ng) const override |
virtual void | genVariablePush (CodeStream &os, const std::string &type, const std::string &name, bool autoInitialized, size_t count) const override |
virtual void | genVariablePull (CodeStream &os, const std::string &type, const std::string &name, size_t count) const override |
virtual void | genGlobalRNG (CodeStream &definitions, CodeStream &definitionsInternal, CodeStream &runner, CodeStream &allocations, CodeStream &free, const ModelSpecInternal &model) const override |
virtual void | genPopulationRNG (CodeStream &definitions, CodeStream &definitionsInternal, CodeStream &runner, CodeStream &allocations, CodeStream &free, const std::string &name, size_t count) const override |
virtual void | genTimer (CodeStream &definitions, CodeStream &definitionsInternal, CodeStream &runner, CodeStream &allocations, CodeStream &free, CodeStream &stepTimeFinalise, const std::string &name, bool updateInStepTime) const override |
virtual void | genMakefilePreamble (std::ostream &os) const override |
This function can be used to generate a preamble for the GNU makefile used to build. More... | |
virtual void | genMakefileLinkRule (std::ostream &os) const override |
virtual void | genMakefileCompileRule (std::ostream &os) const override |
virtual void | genMSBuildConfigProperties (std::ostream &os) const override |
virtual void | genMSBuildImportProps (std::ostream &os) const override |
virtual void | genMSBuildItemDefinitions (std::ostream &os) const override |
virtual void | genMSBuildCompileModule (const std::string &moduleName, std::ostream &os) const override |
virtual void | genMSBuildImportTarget (std::ostream &os) const override |
virtual std::string | getVarPrefix () const override |
virtual bool | isGlobalRNGRequired (const ModelSpecInternal &model) const override |
Different backends use different RNGs for different things. Does this one require a global RNG for the specified model? More... | |
virtual bool | isSynRemapRequired () const override |
virtual bool | isPostsynapticRemapRequired () const override |
![]() | |
BackendBase (int localHostID) | |
virtual | ~BackendBase () |
void | genVariablePushPull (CodeStream &push, CodeStream &pull, const std::string &type, const std::string &name, bool autoInitialized, size_t count) const |
Helper function to generate matching push and pull functions for a variable. More... | |
void | genArray (CodeStream &definitions, CodeStream &definitionsInternal, CodeStream &runner, CodeStream &allocations, CodeStream &free, const std::string &type, const std::string &name, VarLocation loc, size_t count) const |
Helper function to generate matching definition, declaration, allocation and free code for an array. More... | |
void | genScalar (CodeStream &definitions, CodeStream &definitionsInternal, CodeStream &runner, const std::string &type, const std::string &name, VarLocation loc) const |
Helper function to generate matching definition and declaration code for a scalar variable. More... | |
int | getLocalHostID () const |
Gets ID of local host backend is building code for. More... | |
Additional Inherited Members | |
![]() | |
typedef std::function< void(CodeStream &, Substitutions &)> | Handler |
template<typename T > | |
using | GroupHandler = std::function< void(CodeStream &, const T &, Substitutions &)> |
typedef GroupHandler< NeuronGroupInternal > | NeuronGroupHandler |
Standard callback type which provides a CodeStream to write platform-independent code for the specified NeuronGroup to. More... | |
typedef GroupHandler< SynapseGroupInternal > | SynapseGroupHandler |
Standard callback type which provides a CodeStream to write platform-independent code for the specified SynapseGroup to. More... | |
typedef std::function< void(CodeStream &, const NeuronGroupInternal &, Substitutions &, NeuronGroupHandler, NeuronGroupHandler)> | NeuronGroupSimHandler |
Callback function type for generation neuron group simulation code. More... | |
|
inline |
|
overridevirtual |
Allocate memory is the first function in GeNN generated code called by usercode and it should only ever be called once. Therefore it's a good place for any global initialisation. This function generates a 'preamble' to this function.
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Definitions internal is the internal header file for the generated code. This function generates a 'preamble' to this header file.
This will only be included by the platform-specific compiler used to build this backend so can include platform-specific types or headers
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Definitions is the usercode-facing header file for the generated code. This function generates a 'preamble' to this header file.
This will be included from a standard C++ compiler so shouldn't include any platform-specific types or headers
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
The GNU make build system uses 'pattern rules' (https://www.gnu.org/software/make/manual/html_node/Pattern-Intro.html) to build backend modules into objects. This function should generate a GNU make pattern rule capable of building each module (i.e. compiling .cc file $< into .o file $@).
Implements CodeGenerator::BackendBase.
|
overridevirtual |
The GNU make build system will populate a variable called with a list of objects to link. This function should generate a GNU make rule to build these objects into a shared library.
Implements CodeGenerator::BackendBase.
|
overridevirtual |
This function can be used to generate a preamble for the GNU makefile used to build.
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
In MSBuild, 'properties' are used to configure global project settings e.g. whether the MSBuild project builds a static or dynamic library This function can be used to add additional XML properties to this section.
see https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-properties for more information.
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
In MSBuild, the 'item definitions' are used to override the default properties of 'items' such as <ClCompile>
or <Link>
. This function should generate XML to correctly configure the 'items' required to build the generated code, taking into account etc.
see https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-items#item-definitions for more information.
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Generate platform-specific function to update the state of all neurons.
os | CodeStream to write function to |
model | model to generate code for |
simHandler | callback to write platform-independent code to update an individual NeuronGroup |
wuVarUpdateHandler | callback to write platform-independent code to update pre and postsynaptic weight update model variables when neuron spikes |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
After all timestep logic is complete.
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Generate platform-specific function to update the state of all synapses.
os | CodeStream to write function to |
model | model to generate code for |
wumThreshHandler | callback to write platform-independent code to update an individual NeuronGroup |
wumSimHandler | callback to write platform-independent code to process presynaptic spikes. "id_pre", "id_post" and "id_syn" variables; and either "addToInSynDelay" or "addToInSyn" function will be provided to callback via Substitutions. |
wumEventHandler | callback to write platform-independent code to process presynaptic spike-like events. "id_pre", "id_post" and "id_syn" variables; and either "addToInSynDelay" or "addToInSyn" function will be provided to callback via Substitutions. |
postLearnHandler | callback to write platform-independent code to process postsynaptic spikes. "id_pre", "id_post" and "id_syn" variables will be provided to callback via Substitutions. |
synapseDynamicsHandler | callback to write platform-independent code to update time-driven synapse dynamics. "id_pre", "id_post" and "id_syn" variables; and either "addToInSynDelay" or "addToInSyn" function will be provided to callback via Substitutions. |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
overridevirtual |
Implements CodeGenerator::BackendBase.
|
inlineoverridevirtual |
When backends require separate 'device' and 'host' versions of variables, they are identified with a prefix. This function returns this prefix so it can be used in otherwise platform-independent code.
Reimplemented from CodeGenerator::BackendBase.
|
overridevirtual |
Different backends use different RNGs for different things. Does this one require a global RNG for the specified model?
Implements CodeGenerator::BackendBase.
|
inlineoverridevirtual |
Implements CodeGenerator::BackendBase.
|
inlineoverridevirtual |
Implements CodeGenerator::BackendBase.