def completeConfiguration(self, props): self.num_java_threads = props.getValue(self.p_num_java_threads) self.num_sim_GPU = props.getValue(self.p_num_sim_GPU) self.use_GPU_for_creation = props.getValue(self.p_use_GPU_for_creation) NodeThreadPool.setNumJavaThreads(self.num_java_threads) NEFGPUInterface.setRequestedNumDevices(self.num_sim_GPU) WeightedCostApproximator.setUseGPU(self.use_GPU_for_creation)
def completeConfiguration(self,props): self.num_java_threads=props.getValue(self.p_num_java_threads) self.num_sim_GPU=props.getValue(self.p_num_sim_GPU) self.use_GPU_for_creation=props.getValue(self.p_use_GPU_for_creation) NodeThreadPool.setNumJavaThreads(self.num_java_threads) NEFGPUInterface.setRequestedNumDevices(self.num_sim_GPU) WeightedCostApproximator.setUseGPU(self.use_GPU_for_creation)
def __init__(self,network): self.nodes=[] self.projections=[] self.tasks=[] self.network=network self.initialize(network) if NodeThreadPool.getNumJavaThreads() > 0: NEFGPUInterface.requireAllOutputsOnCPU(True); self.thread_pool=NodeThreadPool(network,[]); else: self.thread_pool=None;
def initPanel(self): IntegerPanel.initPanel(self) num_avail_devices = NEFGPUInterface.getNumAvailableDevices() if num_avail_devices < 1: self.tf.setEnabled(False) self.tf.setEditable(False) error_message = " %s" % (NEFGPUInterface.getErrorMessage()) error_message_label = JLabel(error_message) error_message_label.setForeground(Color.red) self.add(error_message_label)
class ParallelizationConfiguration(IConfigurable): num_java_threads = NodeThreadPool.getNumJavaThreads() num_sim_GPU = NEFGPUInterface.getRequestedNumDevices() use_GPU_for_creation = WeightedCostApproximator.getUseGPU() p_num_java_threads = PInt('Number of Java Threads', num_java_threads, 1, NodeThreadPool.getMaxNumJavaThreads()) p_num_sim_GPU = PGpuCount('Number of GPU\'s for Simulation') p_use_GPU_for_creation = PGpuUse('Use GPU for Ensemble Creation') properties = [p_num_java_threads, p_num_sim_GPU, p_use_GPU_for_creation] def __init__(self): self.button = make_button('parallelization', self.do_configure, 'Configure Parallelization') self.button.enabled = True def do_configure(self, event): self.p_num_java_threads.setDefaultValue( NodeThreadPool.getNumJavaThreads()) self.p_num_sim_GPU.setDefaultValue( NEFGPUInterface.getRequestedNumDevices()) self.p_use_GPU_for_creation.setDefaultValue( WeightedCostApproximator.getUseGPU()) uc = ca.nengo.ui.configurable.managers.UserTemplateConfigurer(self) try: uc.configureAndWait() except ConfigException, e: e.defaultHandleBehavior()
def do_configure(self, event): self.p_num_java_threads.setDefaultValue(NodeThreadPool.getNumJavaThreads()) self.p_num_sim_GPU.setDefaultValue(NEFGPUInterface.getRequestedNumDevices()) self.p_use_GPU_for_creation.setDefaultValue(WeightedCostApproximator.getUseGPU()) uc=ca.nengo.ui.configurable.managers.UserTemplateConfigurer(self) try: uc.configureAndWait() except ConfigException, e: e.defaultHandleBehavior()
def do_configure(self, event): self.p_num_java_threads.setDefaultValue( NodeThreadPool.getNumJavaThreads()) self.p_num_sim_GPU.setDefaultValue( NEFGPUInterface.getRequestedNumDevices()) self.p_use_GPU_for_creation.setDefaultValue( WeightedCostApproximator.getUseGPU()) uc = ca.nengo.ui.configurable.managers.UserTemplateConfigurer(self) try: uc.configureAndWait() except ConfigException, e: e.defaultHandleBehavior()
def __init__(self,network): self.nodes=[] self.projections=[] self.network=network self.initialize(network) if NEFGPUInterface.getUseGPU(): gpuNodes = LocalSimulator.collectNodes(self.nodes) gpuNetworkArrays = LocalSimulator.collectNetworkArraysForGPU(self.nodes) gpuProjections = LocalSimulator.collectProjections(self.nodes, self.projections) self.thread_pool=NEFGPUInterface(gpuNodes, gpuProjections, gpuNetworkArrays) elif NodeThreadPool.isMultithreading(): multithread_nodes = LocalSimulator.collectNodes(self.nodes) multithread_projs = LocalSimulator.collectProjections(self.nodes, self.projections) self.thread_pool=NodeThreadPool(multithread_nodes, multithread_projs) else: self.thread_pool=None
def __init__(self, name): default = NEFGPUInterface.getRequestedNumDevices() maximum = NEFGPUInterface.getNumAvailableDevices() PInt.__init__(self, name, default, 0, maximum)
def __init__(self, name): default = NEFGPUInterface.getNumDevices() maximum = NEFGPUInterface.getNumDetectedDevices() PInt.__init__(self, name, default, 0, maximum)
def kill(self): if self.thread_pool is not None: NEFGPUInterface.requireAllOutputsOnCPU(False); self.thread_pool.kill() self.thread_pool = None