Cypress  1.0
C++ Spiking Neural Network Simulation Framework
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cypress::Slurm Class Reference

#include <slurm.hpp>

Inheritance diagram for cypress::Slurm:
Inheritance graph
[legend]
Collaboration diagram for cypress::Slurm:
Collaboration graph
[legend]

Public Member Functions

 Slurm (const std::string &simulator, const Json &setup=Json())
 
 ~Slurm () override
 
void set_flags (size_t num)
 
void set_base_filename (const std::string &filename)
 
const std::string & get_base_filename () const
 
std::unordered_set< const NeuronType * > supported_neuron_types () const override
 
std::string name () const override
 
void run (NetworkBase &network, Real duration=0.0) const
 

Static Public Member Functions

static std::vector< bool > inhom_rec_single (const PopulationBase &pop, size_t index)
 returns a vector encoding recording flags for a single recording signal and inhomogeneous record flags More...
 
static Json inhom_rec_to_json (const PopulationBase &pop)
 returns a json encoding all records for a single population. Json[<signal>] will return a vector of bool flags encoding, wheter <signal> will be recorded for that specific neuron More...
 
static Json connector_to_json (const ConnectionDescriptor &conn)
 Converts the information of a ConnectionDescriptor to a JSON object. List connectors and dynamic connection strategies that cannot be reproduced by a new simulation will be expanded to list connections. More...
 
static Json pop_to_json (const PopulationBase &pop)
 Creates a Json containing information about a population. More...
 
static void hom_rec_to_json (const PopulationBase &pop, Json &json)
 Takes a Json object created by pop_to_json and adds information about record flags, assumes record flags are homogeneous. More...
 
static Json pop_vec_to_json (const std::vector< PopulationBase > &pops)
 Creates an array of populations in return json, which contains all information of all populations, including record flags and parameters. More...
 
static Json recs_to_json (const PopulationBase &pop)
 Converts all recorded data of a population to json. More...
 
static void read_recordings_from_json (const Json &pop_data, NetworkBase &netw)
 Reads recorded signal from a json object, puts data into network object. More...
 
static void create_pop_from_json (const Json &pop_json, Network &netw)
 Uses data in JSon to create populations and set record flags. More...
 
static std::shared_ptr< SynapseBaseget_synapse (const std::string &name, const std::vector< Real > &parameters)
 Create the synapse for a connection dependent on the name. More...
 
static void create_conn_from_json (const Json &con_json, Network &netw)
 Uses the information in JSON to create a single Connection. More...
 
static NetworkBase network_from_json (std::string path)
 Uses the data in a JSON object to create a full network. More...
 
static void learned_weights_from_json (const Json &json, NetworkBase netw)
 

Protected Member Functions

Json output_json (NetworkBase &network, Real duration) const
 
void read_json (Json &result, NetworkBase &network) const
 

Protected Attributes

std::string m_simulator
 
Json m_setup
 
bool m_save_json = false
 
bool m_no_output = false
 
std::string m_path
 
std::string m_json_path
 

Constructor & Destructor Documentation

cypress::Slurm::Slurm ( const std::string &  simulator,
const Json setup = Json() 
)

Constructor of the Slurm backend. Throws an exception if the given PyNN backend does not exist.

Parameters
simulatoris the name of the simulator backend to be used by PyNN. Use the static backends method to list available backends.
setupcontains additional setup information that should be passed to the backend.
cypress::Slurm::~Slurm ( )
override

Destructor of the Slurm class.

Member Function Documentation

static Json cypress::ToJson::connector_to_json ( const ConnectionDescriptor conn)
staticinherited

Converts the information of a ConnectionDescriptor to a JSON object. List connectors and dynamic connection strategies that cannot be reproduced by a new simulation will be expanded to list connections.

Parameters
connsource connections description
Returns
cypress::Json json object containing above information
static void cypress::ToJson::create_conn_from_json ( const Json con_json,
Network netw 
)
staticinherited

Uses the information in JSON to create a single Connection.

Parameters
con_jsonJSON object containing the Connection data
netwtarget network of the connection
static void cypress::ToJson::create_pop_from_json ( const Json pop_json,
Network netw 
)
staticinherited

Uses data in JSon to create populations and set record flags.

Parameters
pop_jsoncontains population data
netwnetwork object in which the population will be created
const std::string& cypress::Slurm::get_base_filename ( ) const
inline
static std::shared_ptr<SynapseBase> cypress::ToJson::get_synapse ( const std::string &  name,
const std::vector< Real > &  parameters 
)
staticinherited

Create the synapse for a connection dependent on the name.

Parameters
namename of the synapse model
parametersSynapse Parameters, should be in the right order
Returns
std::shared_ptr< cypress::SynapseBase > pointer to synapse object
static void cypress::ToJson::hom_rec_to_json ( const PopulationBase pop,
Json json 
)
staticinherited

Takes a Json object created by pop_to_json and adds information about record flags, assumes record flags are homogeneous.

Parameters
popsource population object
jsontarget json created by ToJson::pop_to_json
static std::vector<bool> cypress::ToJson::inhom_rec_single ( const PopulationBase pop,
size_t  index 
)
staticinherited

returns a vector encoding recording flags for a single recording signal and inhomogeneous record flags

Parameters
popSource Population
indexRecording signal index
Returns
std::vector< bool > vector encoding record flags
static Json cypress::ToJson::inhom_rec_to_json ( const PopulationBase pop)
staticinherited

returns a json encoding all records for a single population. Json[<signal>] will return a vector of bool flags encoding, wheter <signal> will be recorded for that specific neuron

Parameters
popsource population object
Returns
cypress::Json json object containing above information
static void cypress::ToJson::learned_weights_from_json ( const Json json,
NetworkBase  netw 
)
staticinherited
std::string cypress::ToJson::name ( ) const
overridevirtualinherited

Returns the canonical name of the backend.

Implements cypress::Backend.

static NetworkBase cypress::ToJson::network_from_json ( std::string  path)
staticinherited

Uses the data in a JSON object to create a full network.

Parameters
pathpath of the JSON file
Returns
cypress::NetworkBase the newly constructed network
Json cypress::ToJson::output_json ( NetworkBase network,
Real  duration 
) const
protectedinherited
static Json cypress::ToJson::pop_to_json ( const PopulationBase pop)
staticinherited

Creates a Json containing information about a population.

Parameters
popsource population
Returns
cypress::Json target JSon
static Json cypress::ToJson::pop_vec_to_json ( const std::vector< PopulationBase > &  pops)
staticinherited

Creates an array of populations in return json, which contains all information of all populations, including record flags and parameters.

Parameters
popsvector of population objects, typically netw.populations()
Returns
cypress::Json Json object containing all information
void cypress::ToJson::read_json ( Json result,
NetworkBase network 
) const
protectedinherited
static void cypress::ToJson::read_recordings_from_json ( const Json pop_data,
NetworkBase netw 
)
staticinherited

Reads recorded signal from a json object, puts data into network object.

Parameters
pop_datasource simulation data, should be on level of a single recording
netwtarget network
static Json cypress::ToJson::recs_to_json ( const PopulationBase pop)
staticinherited

Converts all recorded data of a population to json.

Parameters
popsource population for recorded data
Returns
cypress::Json target Json containing recorded data
void cypress::Backend::run ( NetworkBase network,
Real  duration = 0.0 
) const
inherited

Simulates the given spiking neural network for the given duration.

Parameters
networkis the network that should be simulated. The simulation result will be written to the network instance.
durationis the duration for which the network should be simulated.
void cypress::Slurm::set_base_filename ( const std::string &  filename)
inline
void cypress::Slurm::set_flags ( size_t  num)
std::unordered_set<const NeuronType *> cypress::ToJson::supported_neuron_types ( ) const
overridevirtualinherited

Returns a set of neuron types which are supported by this backend. Trying to execute a network with other neurons than the ones specified in the result of this function will result in an exception.

Returns
a set of neuron types supported by this particular backend instance.

Implements cypress::Backend.

Member Data Documentation

std::string cypress::ToJson::m_json_path
protectedinherited
bool cypress::ToJson::m_no_output = false
protectedinherited
std::string cypress::ToJson::m_path
protectedinherited
bool cypress::ToJson::m_save_json = false
protectedinherited
Json cypress::ToJson::m_setup
protectedinherited
std::string cypress::ToJson::m_simulator
protectedinherited

The documentation for this class was generated from the following file: