Пример #1
0
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()