-
Notifications
You must be signed in to change notification settings - Fork 1
/
GeneralIncludes.h
168 lines (140 loc) · 6.82 KB
/
GeneralIncludes.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#ifndef GENERAL_INCLUDES_H_
#define GENERAL_INCLUDES_H_
//#define DEBUG_MODE // not currently used
//#define DEBUG_MODE_MAIN // screen display of timestep based change of V and RHO
//#define DEBUG_MODE_NETWORK // print to file of connectivity statistics
//#define DEBUG_MODE_SPIKES // screen display of spike transfers
//#define DEBUG_MODE_SYNAPSE // screen display of synapse updates
#define ENABLE_SYNAPSE_UPDATES
//#define ENABLE_FIXED_TRANSFERS
//#define ENABLE_TRANSFER_RHO_INITIAL
//#define SYN_USE_SUPRATHRESHOLD_TIMESTEP
#define SYN_USE_FLAT_POTENTIAL
#define SYN_USE_HARD_BOUNDS
#define SYN_USE_CONST_INITIALISATION
//#define SYN_USE_RAND_UNIFORM_INITIALISATION
//#define SYN_USE_INVIVO_DOUBLE_WELL_INITIALISATION
//#define SYN_POTENTIATE_SUBSET_OF_SYNS
//#define SYN_DELAYED_POTENTIATE_SUBSET_OF_SYNS
#define SYN_MAINTAIN_FF_CONNECTIVITY // embeds a feed-forward network in the connectivity
#define MONITOR_UP_DOWN_POPS
//#define MONITOR_STIM_POPS /* incompatible with multiple stimulus subpops */
//#define LEARNING_CONST_EXTERN_STIM
//#define LEARNING_INDEP_POISSON_STIM
#define LEARNING_REPEATED_PATTERNED_STIM
#define FILE_NAME_LENGTH (50)
#define TEXT_BUFFER_LENGTH (100)
#define EPSILLON (0.0000001)
// Data reporters
#define RECORDER_NEURON_ID (1) /*(3)*/
#define RECORDER_SYNAPSE_ID (0) /* for modulo addressed multiple synaptic recordings this needs to be less than 400*/
//#define RECORDER_MULTI_SYNAPSE_SKIP (64000) /*(64000)*/ /*(450)*/
#define USE_GPU (1) /* 1=gpu, 0=cpu */
#define USE_OPENCL_PLATFORM_ID (1) /* index of platform to use, 1 for TU Berlin, 0 at Uchicago, MacOS, most other locations */
#define NETWORK_SEED (-14) /*(-14)*/
#define PARALLEL_SEED (2) /*keep positive for random123*/
#define GAUSSIAN_SYNAPTIC_SEED (-12)
#define UNIFORM_SYNAPTIC_SEED (-11)
#define RAN2_RESETTABLE_SEED (-1)
#define MAX_TIME_STEPS (180) /*(24100000)*/ /*(30500000)*/ /*(50000000)*/ /*(12000000)*/ /*(12000000)*/ /*(300000)*/ /*no of timesteps, each of size dt*/
// Network schema
#define NO_EXC (100) /*(8000)*/ /*(400)*/ /*(10000)*/
#define NO_INH (0) /*(2000)*/
#define NO_LIFS (NO_EXC + NO_INH)
#define CONNECTIVITY_PROBABILITY (0.05) /*(0.05)*/ /*(0.05)*/
// Time step sizes and statistical bin widths
#define LIF_DT (0.00001) /* modify refrac time and calcium delay in tandem, also MAX_TIME_STEPS */
#define SYN_DT LIF_DT /*TODO: at a later stage I will have the synapse update more slowly than the lif*/
#define BIN_SIZE (1.) /*(1.)*/ /*(0.1)*/
// Stimulation of subpopulation /* using secs despite inconsistency with other parameter units */
#define STIM_ON (1.)
#define STIM_OFF (1800.) /* want stimulation for full duration of simulation */
#define J_STIM (50) /* a delta stim should cause a spike */ /*(24.55)*/ /*24.55mV approx 50Hz, 34.8mV approx 100Hz*/
#define NO_STIM_LIFS (30)
#define NO_STIM_SUBSETS (2)
#define USE_SEPARATE_SUBPOP_PARAMS
#ifndef USE_SEPARATE_SUBPOP_PARAMS
// These are the parameters if all subpops are using same parameters
#define STIM_OFFSET (20)
#define STIM_PATTERN_DURATION (50000) /* in timesteps (otherwise should use it to initialise a variable)*/
#define STIM_PATTERN_PAUSE_DURATION (50000) /* in timesteps: pause between pattern repeats */
#define STIM_PATTERN_START_DELAY (1000) /* in timesteps! */
#define STIM_FIXED_OFFSET_ISI (500) /* in timesteps: pause between stimuli on adjacent neurons */
//#define STIM_PATTERN_DURATION_SECS (0.1) /* pattern duration in secs, for regular patterned stim */
#define STIM_PATTERN_AV_RATE (1.) /* for exponential drawing of interspike interval */
#else
// These are the parameters if we have different parameters per subpopulation (needs to be changed in C-code also)
#define STIM_OFFSET_1 (5)
#define STIM_OFFSET_2 (60)
#define STIM_OFFSET_3 (60)
#define STIM_PATTERN_DURATION_1 (50000)
#define STIM_PATTERN_DURATION_2 (50000)
#define STIM_PATTERN_DURATION_3 (50000)
#define STIM_PATTERN_PAUSE_DURATION_1 (50000)
#define STIM_PATTERN_PAUSE_DURATION_2 (50000)
#define STIM_PATTERN_PAUSE_DURATION_3 (50000)
#define STIM_PATTERN_START_DELAY_1 (0) /* in timesteps! */
#define STIM_PATTERN_START_DELAY_2 (25000) /* in timesteps! */
#define STIM_PATTERN_START_DELAY_3 (0) /* in timesteps! */
#define STIM_FIXED_OFFSET_ISI_1 (500) /* in timesteps: pause between stimuli on adjacent neurons */
#define STIM_FIXED_OFFSET_ISI_2 (500) /* in timesteps: pause between stimuli on adjacent neurons */
#define STIM_FIXED_OFFSET_ISI_3 (500) /* in timesteps: pause between stimuli on adjacent neurons */
#define STIM_PATTERN_AV_RATE_1 (1.)
#define STIM_PATTERN_AV_RATE_2 (1.)
#define STIM_PATTERN_AV_RATE_3 (1.)
#endif
// Transfer voltages
#define J_EE (2.2) /*(22.0)*/ /*(0.2)*/ /*(0.1)*/
#define J_IE (0.1)
#define J_II (-0.4)
#define J_EI (-0.4)
//#define J_EXT (11.45) /*(15.315)*/ /*(15.315)*/ /*(11.046)*/ /*(11.45) new in-vivo*/ /*(11.046) new in-vitro*/ /*(7.07)*/ /*(6.966) in-vivo*/ /*(7.07) 1hz in-vitro*/
#define J_EXT (0.0)
// LIF specific
#define LIF_V_INITIAL (-51.0) /*(-60.0)*/
#define LIF_V_REST (-51.0) /*(-70.0)*/
#define LIF_V_RESET (-51.0) /*(-70.0)*/ /*(-60.0)*/
#define LIF_V_THRESHOLD (-50.0)
#define LIF_CM (0.001)
#define LIF_RM (10.0) /*(20.0)*/
#define LIF_SIGMA (0) /*(5)*/
#define LIF_REFRAC_TIME (2000) /*200*/ /*timesteps*/
// Synapse model specific
#define SYN_RHO_INITIAL (0.0) /*arbitrary initialisation for now */ /*(0.019)*/ /*(0.406595)*/ /*(0.164840)*/ /*(0.406595)*/ /*(0.019) in-vivo*/ /*(0.164840) new in-vitro*/ /*(0.16492)*/ /*(0.203586)*/ /*(1.0)*/
#define SYN_CA_INITIAL (0.0)
#define SYN_CALCIUM_DELAY (461) /*46*/ /*4.6098ms*/ /*timesteps (needs to be modified when DT is modified above*/
#define SYN_GAMMA_P (725.085)
#define SYN_GAMMA_D (331.909)
#define SYN_THETA_P (1.3)
#define SYN_THETA_D (1.0)
#define SYN_SIGMA (0) /*(3.35)*/ /*3.35;*/ /*TODO: switch synapse noise back on*/
#define SYN_TAU (346.3615)
#define SYN_TAU_CA (0.0226936)
#define SYN_C_PRE (0.56175) /*(0.33705)*/ /*(0.56175)*/ /*(0.5617539)*/
#define SYN_C_POST (1.23964) /*(0.74378)*/ /*(1.23964)*/
#define SYN_RHO_FIXED SYN_RHO_INITIAL /*(0.5)*/
#include <stdio.h>
#include <errno.h> // Error numbers for file opening
//#include <limits.h> // System data limits
//#include <float.h> // Limits of system implementation of floating values
#include <stdlib.h> // malloc()
#include <fcntl.h> // manipulate file descriptors, opencl
//#include <strcmp.h>
#include <math.h> // supposedly for fmin()
#include <time.h> // to time main loop
#include <string.h> // strcpy() strcat()
//#include <ctype.h>
//#include <assert.h>
//#include <locale.h>
//#include <stddef.h>
#include <sys/types.h> // opencl
#include <sys/stat.h> // For mkdir()
//#include <sys/dir.h>
//from Mac OpenCL demo
#include <unistd.h>
#ifdef __APPLE__ //ifdef added from web suggestions
#include <OpenCL/opencl.h>
#else
#include <CL/cl.h>
#endif
#endif /*GENERAL_INCLUDES_H_*/