Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
3b006a7
add meanfield model to spynnaker
Jul 28, 2021
d02cfb3
fixed the check for early spikes
Christian-B Oct 4, 2021
f4fbe32
Merge pull request #1113 from SpiNNakerManchester/correct_spikearray_…
rowleya Oct 4, 2021
2dd48ee
remove extract_iobuf_during_run flag
Christian-B Oct 5, 2021
0d27ce6
Merge pull request #1114 from SpiNNakerManchester/extract_iobuf_durin…
rowleya Oct 5, 2021
53e62fc
Fix a whole bunch of minor warnings in the documentation build
dkfellows Oct 5, 2021
134bb4e
Merge pull request #1115 from SpiNNakerManchester/doc-fix
rowleya Oct 5, 2021
f59c23d
allow for mutliple send_sync
Christian-B Oct 5, 2021
31b95ed
Merge pull request #1116 from SpiNNakerManchester/send_sync_repeat
rowleya Oct 5, 2021
d422d95
Trying to fix a crash...
dkfellows Oct 5, 2021
40dc454
Merge pull request #1117 from SpiNNakerManchester/doc-fix
dkfellows Oct 5, 2021
36a7f86
modified: meanfield/models/meanfield_model_impl.c
Oct 14, 2021
2fa237f
modified: meanfield/models/meanfield_model_impl.c
Oct 14, 2021
d21e701
modified: meanfield/models/meanfield_model_impl.c
Oct 14, 2021
14f0c87
modified: meanfield/models/meanfield_model_impl.c
Oct 15, 2021
ded939e
remove config-> in the thre_func in order to make a code more clear
Oct 15, 2021
2d023c8
modified: meanfield/models/meanfield_model_impl.c
Oct 15, 2021
9b2d577
clean and remove sqrtk indicated when with coms, just to try without …
Oct 15, 2021
e41ac1d
remove FAKEs (where no divisions) to clean a little bits,
Oct 18, 2021
07d3170
remove FAKEs (where no divisions) to clean a little bits,
Oct 18, 2021
8cdb775
add Vi
Oct 18, 2021
d608f1c
modified: meanfield/models/meanfield_model_impl.h
Oct 18, 2021
d89ccb2
modified: meanfield/models/meanfield_model_impl.c
Oct 19, 2021
dcf8d35
modified: meanfield/implementations/meanfield_impl_standard.h
Oct 19, 2021
be1be0c
modified: ../../src/meanfield/implementations/meanfield_impl_stand…
Oct 21, 2021
565bcd5
modified: ../../src/meanfield/models/meanfield_model_impl.c
Oct 21, 2021
a1b4baf
modified: ../../src/meanfield/implementations/meanfield_impl_stand…
Oct 21, 2021
3fd336b
modified: src/meanfield/implementations/meanfield_impl_standard.h
Oct 22, 2021
09e51a1
modified: ../../src/meanfield/models/meanfield_model_impl.c
Oct 22, 2021
4e39dd7
new file: Vthre_params.h
Oct 25, 2021
b21502a
modified: ../meanfield_build.mk
Oct 26, 2021
e7ab542
modified: ../meanfield_build.mk
Oct 26, 2021
886ead1
modified: ../../../src/meanfield/models/meanfield_model.h
Oct 26, 2021
fd29318
modified: ../../../src/meanfield/models/meanfield_model.h
Oct 26, 2021
f2dd0c1
modified: abstract_pynn_meanfield_model_standard.py
Oct 26, 2021
43621b6
modified: abstract_pynn_meanfield_model_standard.py
Oct 26, 2021
87c3120
modified: ../../../src/meanfield/implementations/meanfield_impl_st…
Oct 27, 2021
12222e2
modified: ../../../../spynnaker/pyNN/models/neuron/builds/meanfiel…
Oct 27, 2021
a8106ef
modified: ../../../src/meanfield/models/meanfield_model_impl.c
Oct 28, 2021
4bbfae7
modified: ../builds/meanfield_base.py
Oct 28, 2021
bc2dc01
modified: ../../../src/meanfield/implementations/meanfield_impl_st…
Oct 28, 2021
81dfef1
modified: ../../../src/meanfield/models/meanfield_model_impl.c
Oct 29, 2021
d275a9c
modified: ../../../src/meanfield/models/meanfield_model_impl.c
Nov 2, 2021
199bd23
modified: ../../../src/meanfield/models/meanfield_model_impl.h
Nov 2, 2021
4b7f219
modified: ../../../src/meanfield/models/meanfield_model_impl.c
Nov 3, 2021
3cdf4a9
modified: ../../../src/meanfield/implementations/meanfield_impl_st…
Nov 4, 2021
4728d48
modified: ../../../src/meanfield/models/mathsbox.h
Nov 4, 2021
cbcdb45
modified: ../../../src/meanfield/models/meanfield_model_impl.c
Nov 5, 2021
9650299
modified: ../../../src/meanfield/models/mathsbox.h
Nov 19, 2021
3e63072
Merge branch 'master' into meanfield_model
Nov 25, 2021
7afd2b9
Merge branch 'meanfield_model' of https://github.com/garandel/meanfie…
Nov 25, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions neural_modelling/makefiles/meanfield/meanfield_build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,16 @@ else
endif


ifndef CONFIG_H
$(error CONFIG_H is not set. Please select an input type header file)
ifndef PARAMS_FROM_NETWORK_H
$(error PARAMS_FROM_NETWORK_H is not set. Please select an input type header file)
else
CONFIG_H := $(call replace_source_dirs,$(CONFIG_H))
PARAMS_FROM_NETWORK_H := $(call replace_source_dirs,$(PARAMS_FROM_NETWORK_H))
endif

ifndef P_FIT_POLYNOMIAL_H
$(error P_FIT_POLYNOMIAL_H is not set. Please select an input type header file)
else
P_FIT_POLYNOMIAL_H := $(call replace_source_dirs,$(P_FIT_POLYNOMIAL_H))
endif

ifndef INPUT_TYPE_H
Expand Down Expand Up @@ -153,7 +159,8 @@ else
MEANFIELD_INCLUDES := \
-include $(MEANFIELD_MODEL_H) \
-include $(SYNAPSE_TYPE_H) \
-include $(CONFIG_H)\
-include $(PARAMS_FROM_NETWORK_H)\
-include $(P_FIT_POLYNOMIAL_H)\
-include $(MATHSBOX_H) \
-include $(INPUT_TYPE_H) \
-include $(THRESHOLD_TYPE_H) \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ APP = $(notdir $(CURDIR))

MEANFIELD_MODEL = $(MEANFIELD_DIR)/meanfield/models/meanfield_model_impl.c
MEANFIELD_MODEL_H = $(MEANFIELD_DIR)/meanfield/models/meanfield_model_impl.h
CONFIG_H = $(MEANFIELD_DIR)/meanfield/models/config.h
PARAMS_FROM_NETWORK_H = $(MEANFIELD_DIR)/meanfield/models/params_from_network.h
P_FIT_POLYNOMIAL_H = $(MEANFIELD_DIR)/meanfield/models/P_fit_polynomial.h
INPUT_TYPE_H = $(MEANFIELD_DIR)/meanfield/input_types/input_type_conductance.h
MATHSBOX_H = $(MEANFIELD_DIR)/meanfield/models/mathsbox.h
MEANFIELD_IMPL_H = $(MEANFIELD_DIR)/meanfield/implementations/meanfield_impl_standard.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@

// Includes for model parts used in this implementation
#include <meanfield/models/meanfield_model_impl.h>
#include <meanfield/models/config.h>
#include <meanfield/models/params_from_network.h>
#include <meanfield/models/P_fit_polynomial.h>
#include <meanfield/models/mathsbox.h>

#include <meanfield/input_types/input_type.h>
Expand All @@ -40,13 +41,15 @@
//! Indices for recording of words
enum word_recording_indices {
//! V (somatic potential) recording index
V_RECORDING_INDEX = 0,
VE_RECORDING_INDEX = 0,
VI_RECORDING_INDEX = 1,
W_RECORDING_INDEX = 2,
//! Gsyn_exc (excitatory synaptic conductance/current) recording index
GSYN_EXC_RECORDING_INDEX = 1,
GSYN_EXC_RECORDING_INDEX = 3,
//! Gsyn_inh (excitatory synaptic conductance/current) recording index
GSYN_INH_RECORDING_INDEX = 2,
GSYN_INH_RECORDING_INDEX = 4,
//! Number of recorded word-sized state variables
N_RECORDED_VARS = 10
N_RECORDED_VARS = 5
};

//! Indices for recording of bitfields
Expand All @@ -66,13 +69,15 @@ enum bitfield_recording_indices {
};*/


//! Array of meanfield states -> will be change in future
//! Array of meanfield states -> will be change in future , the future is now!!
static meanfield_t *meanfield_array;

static config_t *config_array;
static ParamsFromNetwork_t *pNetwork_array;

static mathsbox_t *mathsbox_array;

static pFitPolynomial_t *Pfit_exc_array;
static pFitPolynomial_t *Pfit_inh_array;

//! Input states array
static input_type_t *input_type_array;
Expand Down Expand Up @@ -136,17 +141,35 @@ static bool meanfield_impl_initialise(uint32_t n_meanfields) {
}

// Allocate DTCM for config array and copy block of data
if (sizeof(config_t)) {
config_array = spin1_malloc(n_meanfields * sizeof(config_t));
if (config_array == NULL) {
if (sizeof(ParamsFromNetwork_t)) {
pNetwork_array = spin1_malloc(n_meanfields * sizeof(ParamsFromNetwork_t));
if (pNetwork_array == NULL) {
log_error("Unable to allocate config array - Out of DTCM");
return false;
}
}


// Allocate DTCM for P fit from polyomial for exc array and copy block of data
if (sizeof(pFitPolynomial_t)) {
Pfit_exc_array = spin1_malloc(n_meanfields * sizeof(pFitPolynomial_t));
if (Pfit_exc_array == NULL) {
log_error("Unable to allocate Pfit_exc_array - Out of DTCM");
return false;
}
}

// Allocate DTCM for P fit from polyomial for exc array and copy block of data
if (sizeof(pFitPolynomial_t)) {
Pfit_inh_array = spin1_malloc(n_meanfields * sizeof(pFitPolynomial_t));
if (Pfit_inh_array == NULL) {
log_error("Unable to allocate Pfit_inh_array - Out of DTCM");
return false;
}
}

// Allocate DTCM for mathsbox array and copy block of data
if (sizeof(mathsbox_t)) {
mathsbox_array = spin1_malloc(n_meanfields * sizeof(config_t));
mathsbox_array = spin1_malloc(n_meanfields * sizeof(mathsbox_t));
if (mathsbox_array == NULL) {
log_error("Unable to allocate mathsbox array - Out of DTCM");
return false;
Expand Down Expand Up @@ -254,13 +277,27 @@ static void neuron_impl_load_neuron_parameters(
next += n_words_needed(n_meanfields * sizeof(meanfield_t));
}

if (sizeof(config_t)) {
if (sizeof(ParamsFromNetwork_t)) {
log_debug("reading config parameters");
spin1_memcpy(config_array, &address[next],
n_meanfields * sizeof(config_t));
next += n_words_needed(n_meanfields * sizeof(config_t));
spin1_memcpy(pNetwork_array, &address[next],
n_meanfields * sizeof(ParamsFromNetwork_t));
next += n_words_needed(n_meanfields * sizeof(ParamsFromNetwork_t));
}


if (sizeof(pFitPolynomial_t)) {
log_debug("reading pFitPolynomial exc parameters");
spin1_memcpy(Pfit_exc_array, &address[next],
n_meanfields * sizeof(pFitPolynomial_t));
next += n_words_needed(n_meanfields * sizeof(pFitPolynomial_t));
}

if (sizeof(pFitPolynomial_t)) {
log_debug("reading pFitPolynomial inh parameters");
spin1_memcpy(Pfit_inh_array, &address[next],
n_meanfields * sizeof(pFitPolynomial_t));
next += n_words_needed(n_meanfields * sizeof(pFitPolynomial_t));
}

if (sizeof(mathsbox_t)) {
log_debug("reading mathsbox parameters");
spin1_memcpy(mathsbox_array, &address[next],
Expand Down Expand Up @@ -315,8 +352,11 @@ static void neuron_impl_do_timestep_update(
// Get the neuron itself
meanfield_t *this_meanfield = &meanfield_array[meanfield_index];

// Get the config and mathsbox params for this neuron
config_t *config_types = &config_array[meanfield_index];
// Get the Params from network and mathsbox params for this neuron
ParamsFromNetwork_t *pNetwork_types = &pNetwork_array[meanfield_index];
pFitPolynomial_t *Pfit_exc_types = &Pfit_exc_array[meanfield_index];
pFitPolynomial_t *Pfit_inh_types = &Pfit_inh_array[meanfield_index];

mathsbox_t *mathsbox_types = &mathsbox_array[meanfield_index];

// Get the input_type parameters and voltage for this neuron
Expand All @@ -336,7 +376,12 @@ static void neuron_impl_do_timestep_update(
// and because the index doesn't actually matter
for (uint32_t i_step = n_steps_per_timestep; i_step > 0; i_step--) {
// Get the voltage->firing rate
state_t firing_rate = meanfield_model_get_firing_rate(this_meanfield);
state_t firing_rate_Ve = meanfield_model_get_firing_rate_Ve(
this_meanfield);
state_t firing_rate_Vi = meanfield_model_get_firing_rate_Vi(
this_meanfield);

state_t adaptation_W = meanfield_model_get_adaptation_W(this_meanfield);

// Get the exc and inh values from the synapses
input_t exc_values[NUM_EXCITATORY_RECEPTORS];
Expand All @@ -363,10 +408,14 @@ static void neuron_impl_do_timestep_update(
total_inh += inh_input_values[i];
}

// Do recording if on the first step
// Do recording if on the first step
if (i_step == n_steps_per_timestep) {
neuron_recording_record_accum(
V_RECORDING_INDEX, meanfield_index, firing_rate);
VE_RECORDING_INDEX, meanfield_index, firing_rate_Ve);
neuron_recording_record_accum(
VI_RECORDING_INDEX, meanfield_index, firing_rate_Vi);
neuron_recording_record_accum(
W_RECORDING_INDEX, meanfield_index, adaptation_W);
neuron_recording_record_accum(
GSYN_EXC_RECORDING_INDEX, meanfield_index, total_exc);
neuron_recording_record_accum(
Expand All @@ -375,19 +424,19 @@ static void neuron_impl_do_timestep_update(

// Call functions to convert exc_input and inh_input to current
input_type_convert_excitatory_input_to_current(
exc_input_values, input_types, firing_rate);
exc_input_values, input_types, firing_rate_Ve);
input_type_convert_inhibitory_input_to_current(
inh_input_values, input_types, firing_rate);

inh_input_values, input_types, firing_rate_Vi);
// input_t external_bias += additional_input_get_input_value_as_current(
// additional_inputs, firing_rate);

// update neuron parameters
state_t result = meanfield_model_state_update(
this_meanfield, config_types, mathsbox_types);

//reinitialise Fout_th
config_types->Fout_th = 0.0; // I don't understand what this does
state_t result = meanfield_model_state_update(this_meanfield,
pNetwork_types,
Pfit_exc_types,
Pfit_inh_types,
mathsbox_types);

// determine if a spike should occur
bool spike_now =
Expand All @@ -411,7 +460,7 @@ static void neuron_impl_do_timestep_update(

// Shape the existing input according to the included rule
synapse_types_shape_input(the_synapse_type);
if (config_types->Fout_th==0.0) {
if (pNetwork_types->Fout_th==0.0) {
has_spiked = true;
}
}
Expand Down Expand Up @@ -452,12 +501,14 @@ static void neuron_impl_store_neuron_parameters(
next += n_words_needed(n_meanfields * sizeof(meanfield_t));
}

if (sizeof(config_t)) {
/*
if (sizeof(ParamsFromNetwork_t)) {
log_debug("writing input type parameters");
spin1_memcpy(&address[next], config_array,
n_meanfields * sizeof(config_t));
next += n_words_needed(n_meanfields * sizeof(config_t));
spin1_memcpy(&address[next], pNetwork_array,
n_meanfields * sizeof(ParamsFromNetwork_t));
next += n_words_needed(n_meanfields * sizeof(ParamsFromNetwork_t));
}
*/

}

Expand Down
25 changes: 25 additions & 0 deletions neural_modelling/src/meanfield/models/P_fit_polynomial.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef _P_FIT_POLYNOMIAL_H_
#define _P_FIT_POLYNOMIAL_H_

#include "../../meanfield/models/meanfield_model.h"

typedef struct pFitPolynomial_t {
// nominally 'fixed' parameters
/*! \brief a structure for the polynomial parameters coming from a single neuron fit
* MORE INFO
*/
REAL P0;
REAL P1;
REAL P2;
REAL P3;
REAL P4;
REAL P5;
REAL P6;
REAL P7;
REAL P8;
REAL P9;
REAL P10;
} pFitPolynomial_t;


#endif
73 changes: 0 additions & 73 deletions neural_modelling/src/meanfield/models/config.h

This file was deleted.

7 changes: 5 additions & 2 deletions neural_modelling/src/meanfield/models/mathsbox.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#ifndef _MATHSBOX_H_
#define _MATHSBOX_H_

#include <sqrt.h>
//#include <sqrt.h>
#include <math.h>
#include <stdfix-exp.h>
//#include "../../common/maths-util.h"
//#include <common/math-utils.h>


Expand All @@ -15,9 +16,11 @@ typedef struct mathsbox_t {
REAL error_func_sample;

REAL err_func;

REAL var_sqrt;
}mathsbox_t;

//typedef struct mathsbox_params_t* mathsbox_pointer_t;

void error_function(REAL x, REAL factor, mathsbox_t *restrict mathsbox);
void error_function(REAL argument, mathsbox_t *restrict mathsbox);
#endif
Loading