Skip to content

Commit 0b42b4a

Browse files
committed
Corrected calcBunchofWn
1 parent 5ca2c04 commit 0b42b4a

File tree

3 files changed

+36
-10
lines changed

3 files changed

+36
-10
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ py_hh_cpu.cpp
1414
!n_cycle.npy
1515
!m_cycle.npy
1616
!h_cycle.npy
17+
*.png
18+
*.out
19+
*.txt

hh_main.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ void freeMemory(){
105105
}
106106

107107
void set_calc_params(unsigned int devIdx, unsigned int Tsim, unsigned int cutoff_ns_tm, unsigned int Nneur, unsigned int Ncon, unsigned int recInt, float h){
108-
cudaSetDevice(devIdx);
108+
// int deviceCount = 0;
109+
// cudaGetDeviceCount(&deviceCount);
110+
// printf("%u, device count %i\n", devIdx, deviceCount);
111+
cudaSetDevice(devIdx % 3);
109112
if (firstRun){
110113
firstRun = false;
111114
} else {

scripts/calcBunchofWn.py

+29-9
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import py_hh as phh
1010
import numpy as np
1111
from numpy import random
12+
import matplotlib
13+
matplotlib.use('Agg')
1214
import matplotlib.pylab as pl
1315
pl.ioff()
1416
from distribute_delays import getDelays
@@ -18,21 +20,39 @@
1820
rank = comm.Get_rank()
1921
size = comm.Get_size()
2022

21-
w_n_range = np.linspace(1.3, 1.5, size, endpoint=False)
23+
#N = 60
24+
w_n_range = np.linspace(1.6, 2.0, size)
25+
26+
#N = 70
27+
#w_n_range = np.linspace(1.6, 1.8, size)
28+
29+
# N = 80
30+
#w_n_range = np.linspace(1.3, 1.5, size)
31+
32+
# N = 90
33+
#w_n_range = np.linspace(1.2, 1.4, size)
34+
35+
#w_n_range = np.linspace(1.1, 1.39, size)
36+
37+
# Neur = 120
38+
#w_n_range = np.linspace(1.14, 1.16, size)
39+
40+
# Nneur = 130
41+
#w_n_range = np.linspace(1.00, 1.12, size)
2242

2343
random.seed(0)
2444
psn_seed = 0
2545

26-
SimTime = 10000.
46+
SimTime = 1000000.
2747
h = 0.02
2848
Tcutoff = np.iinfo(np.int32).max
2949
Tsim = int(SimTime/h)
3050
recInt = np.iinfo(np.int32).max
3151

32-
w_ps = np.arange(1.88, 1.951, 0.01)
52+
w_ps = np.arange(1.87, 1.951, 0.01)
3353
nw = len(w_ps)
3454

35-
N = 100
55+
N = 50
3656
Nneur = N*nw
3757

3858
tau_psc = 0.2 # ms
@@ -42,7 +62,7 @@
4262
I0 = 5.27
4363

4464
rate = np.zeros(Nneur, dtype=fltSize) + 185.0 # Poisson noise rate, Hz (shouldn't be 0)
45-
pcon = 0.2
65+
pcon = 0.25
4666
Ncon = int(N*N*pcon)
4767
pre = np.zeros(Ncon*nw, dtype='uint32')
4868
post = np.zeros(Ncon*nw, dtype='uint32')
@@ -68,8 +88,8 @@
6888

6989
Vrec = np.zeros((int((Tsim + recInt - 1)/recInt), Nneur), dtype=fltSize)
7090

71-
#v0, n0, m0, h0 = 32.906693, 0.574676, 0.913177, 0.223994
72-
v0, n0, m0, h0 = -60.8457, 0.3763, 0.0833, 0.4636
91+
v0, n0, m0, h0 = 32.906693, 0.574676, 0.913177, 0.223994
92+
#v0, n0, m0, h0 = -60.8457, 0.3763, 0.0833, 0.4636
7393
Vm = np.zeros(Nneur, dtype=fltSize) + v0
7494
ns = np.zeros(Nneur, dtype=fltSize) + n0
7595
ms = np.zeros(Nneur, dtype=fltSize) + m0
@@ -85,7 +105,7 @@
85105
incTimes = np.zeros((NnumSp, Nneur), dtype='uint32')
86106
incSpWeights = np.zeros((NnumSp, Nneur), dtype=fltSize) + wInc*np.e/tau_psc
87107
#%%
88-
phh.setCalcParams(rank % 3, Tsim, Tcutoff, Nneur, Ncon*nw, recInt, h)
108+
phh.setCalcParams(rank, Tsim, Tcutoff, Nneur, Ncon*nw, recInt, h)
89109

90110
phh.setIncomSpikes(incTimes, nums, incSpWeights, NnumSp)
91111
phh.setNeurVars(Vm, Vrec, ns, ms, hs)
@@ -134,4 +154,4 @@
134154
# a2.set_xlim((0, SimTime/1000))
135155
#pl.show()
136156

137-
pl.savefig('N_{}_rate_{}_w_n_{}_Ie_{:.2f}_pcon_{:.2f}_delayRND.png'.format(N, rate[0], w_n, I0, pcon))
157+
pl.savefig('N_{}_rate_{:.2f}_w_n_{:.3f}_Ie_{:.2f}_pcon_{:.2f}_delayRND.png'.format(N, rate[0], w_n, I0, pcon))

0 commit comments

Comments
 (0)