forked from ModelDBRepository/127388
-
Notifications
You must be signed in to change notification settings - Fork 0
/
parBGLaunch.hoc
137 lines (80 loc) · 2.7 KB
/
parBGLaunch.hoc
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
/*----------------------------------------------------------------------------
SIMULATIONS OF INTERCONNECTED STN, GPe & GPi - Parallel network version
=============================================
----------------------------------------------------------------------------*/
//----------------------------------------------------------------------------
load_file("nrngui.hoc")
create acell_home_
access acell_home_
celsius=33
dt=0.05
steps_per_ms=20
tstop=10000
v_init=-58
//----------------------------------------------------------------------------
objref pnm
load_file("pBGconst.hoc")
readParms("pPARrun.txt")
load_file("netparmpi.hoc")
pnm = new ParallelNetManager(ncell)
//----------------------------------------------------------------------------
objref rf
if (pnm.pc.id() == 0) {
rf = new File("randseed.txt")
rf.ropen()
seedVal = rf.scanvar()
rf.close()
// master sends seed to workers
pnm.pc.post("seed", seedVal)
} else {
// workers receive seed from master
ret = 0
while (ret == 0) {
if (ret = pnm.pc.look("seed")) {
seedVal = pnm.pc.upkscalar()
}
}
}
//----------------------------------------------------------------------------
xopen("pSTN.tem")
xopen("pGPeA.tem")
xopen("pGPi.tem")
allocCells()
//----------------------------------------------------------------------------
load_file("pBGbias.hoc") // add bias currents to set resting frequencies
load_file("pBGconnect1.hoc") // network make connections
load_file("pBGinput.hoc") // cortical and striatal inputs
load_file("pBGstim.hoc") // stimulate
load_file("pBGrecord.hoc") // record supplemental info (spike times recorded by pnm)
load_file("pBGutil.hoc")
//----------------------------------------------------------------------------
randomize(seedVal)
//pnm.set_maxstep(10) // will end up being minimum synaptic delay
pnm.want_all_spikes()
//xopen("parBGnet.ses")
//stdinit()
//runtime = startsw()
//pnm.psolve(tstop)
//runtime = startsw() - runtime
//load_file("pBGtrainUtil2.hoc")
load_file("pBGconfData.hoc")
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// END OF COMMON CODE (that is run by all worker processes)
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
pnm.pc.runworker
objref res
res = new Vector()
// Update and save seed value
rf.wopen("randseed.txt")
rf.printf("%d\n", seedVal+1)
rf.close()
strdef fname
i = xred("Enter number of launch file ", -1, 0, 999)
if (i >= 0) {
sprint(fname, "pBGLaunch.%03d", i)
print "Launching file ", fname
load_file(fname)
}
pnm.pc.done