Skip to content

Instantly share code, notes, and snippets.

@hackolite
Created March 1, 2013 14:07
Show Gist options
  • Save hackolite/5064881 to your computer and use it in GitHub Desktop.
Save hackolite/5064881 to your computer and use it in GitHub Desktop.
This script use the brian module (neuroscience), to benchmark cpu(s) from a computer.
'''
Model fitting example using several machines.
Before running this example, you must start the Playdoh server on the remote machines.
'''
from brian import loadtxt, ms, Equations
from brian.library.modelfitting import *
import time
import datetime
numberpop = 100000
nbr_cpu = 1
def bench(nbr_cpu,numberpop):
# List of machines IP addresses
now = datetime.datetime.now().strftime("%s")
machines = ['bobs-machine.university.com',
'jims-machine.university.com']
equations = Equations('''
dV/dt=(R*I-V)/tau : 1
I : 1
R : 1
tau : second
''')
input = loadtxt('current.txt')
spikes = loadtxt('spikes.txt')
results = modelfitting( model = equations,
reset = 0,
threshold = 1,
data = spikes,
input = input,
dt = .1*ms,
popsize = numberpop,
maxiter = 3,
delta = 4*ms,
unit_type = 'CPU',
#machines = machines,
R = [1.0e9, 9.0e9],
tau = [10*ms, 40*ms],
refractory = [0*ms, 10*ms],
cpu=nbr_cpu)
#print_table(results)
cal_time = int(datetime.datetime.now().strftime("%s"))-int(now)
return cal_time
if __name__ == '__main__':
numberpop = 10000
liste_cpu_perf=[]
while numberpop < 100000 :
nbr_cpu = 2
liste_cpu_perf.append(bench(nbr_cpu,numberpop))
numberpop = numberpop+10000
print liste_cpu_perf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment