def enable_threads(self, n_threads, multisplit_on=True): """Enable threads in neuron Using the parall Neuron""" h.load_file('parcom.hoc') pc =h.ParallelComputeTool() pc.nthread(n_threads, 1) if multisplit_on: pc.multisplit(1)
def multisplit(): h.load_file("parcom.hoc") parcom = h.ParallelComputeTool() parcom.multisplit(1) if settings.rank == 0: lb = parcom.lb print ('multisplit rank 0: %d pieces Load imbalance %.1f%%' % (lb.npiece, (lb.thread_cxbal_ -1)*100))
def discover_cores_activate_multisplit(h): """ Use case: discover_cores_activate_multisplit(h) where h is a module; from neuron import h. """ # discover no. of cores in 1CPU and activate multisplit to use all cores cores = multiprocessing.cpu_count() h.load_file("parcom.hoc") p = h.ParallelComputeTool() p.change_nthread(cores, 1) p.multisplit(1)
def activate_cores(): """Activates cores **Arguments:** Nothing is passed. **Returned values:** Nothing is returned. """ cores = multiprocessing.cpu_count() h.load_file("parcom.hoc") p = h.ParallelComputeTool() #p.change_nthread(cores, 1) #p.multisplit(1) return "cores are activated" # for hardwareTest.py
from neuron import h, gui from Cereb_GrC_regular import Grc_regular import multiprocessing import numpy as np import matplotlib.pyplot as plt cell = Grc_regular(1) h.nrncontrolmenu() time_step = h.CVode() time_step.active(0) #0 fixed step, 1 variable time step cpu = multiprocessing.cpu_count() h.load_file("parcom.hoc") p = h.ParallelComputeTool() if cpu > 8: p.change_nthread(8, 1) print('Maximum 8 threads') else: p.change_nthread(cpu, 1) print('N° of treads', cpu) p.multisplit(1) h('load_file("vm.ses")') stimdata = dict() stimdata['timeglobal'] = 2500 synapsesdata = dict()