Code Monkey home page Code Monkey logo

Comments (7)

russelljjarvis avatar russelljjarvis commented on September 4, 2024

The following pattern works when called in serial (using fall back to regular python map). It does not work in parallel due to the error below:

def test_to_model(local_test_methods,model):
    import matplotlib.pyplot as plt
    model.re_init(model.attrs)
    local_test_methods(model)
    print(local_test_methods)
    plt.plot(model.results['t'], model.results['vm'])
    plt.savefig(str(local_test_methods)+str('.png'))
    plt.clf()

    return model.results


def build_single(indexs):
    attrs,name,rheobase=indexs
    from scoop import futures
    model.attrs=attrs
    model.update_run_params(attrs)
    model.update_run_params(model.attrs)
    model.name = str(attrs)
    get_neab.suite.tests[0].prediction={}
    get_neab.suite.tests[0].prediction['value']=rheobase*qt.pA
    judged = list(futures.map(test_to_model,local_test_methods,repeat(model)))

stderr

 File "/opt/conda/lib/python3.5/site-packages/scoop-0.7.2.0-py3.5.egg/scoop/bootstrap/__main__.py", line 92, in main
  File "/opt/conda/lib/python3.5/site-packages/scoop-0.7.2.0-py3.5.egg/scoop/bootstrap/__main__.py", line 285, in run
  File "/opt/conda/lib/python3.5/site-packages/scoop-0.7.2.0-py3.5.egg/scoop/bootstrap/__main__.py", line 266, in futures_startup
  File "/opt/conda/lib/python3.5/site-packages/scoop-0.7.2.0-py3.5.egg/scoop/futures.py", line 65, in _startup
  File "/opt/conda/lib/python3.5/site-packages/scoop-0.7.2.0-py3.5.egg/scoop/_control.py", line 257, in runController
  File "/opt/conda/lib/python3.5/site-packages/scoop-0.7.2.0-py3.5.egg/scoop/_types.py", line 409, in sendResult
  File "/opt/conda/lib/python3.5/site-packages/scoop-0.7.2.0-py3.5.egg/scoop/_comm/scoopzmq.py", line 396, in sendResult
  File "/opt/conda/lib/python3.5/site-packages/sciunit-0.1.5.6-py3.5.egg/sciunit/__init__.py", line 51, in __getstate__
    for key in self.unpicklable:
AttributeError: 'InputResistanceTest' object has no attribute 'unpicklable'
/o

from neuronunit.

rgerkin avatar rgerkin commented on September 4, 2024

Before going any further in this direction, I want to understand why we should expect parallelizing the inside of the test suite to confer any advantage over just parallelizing the parameter search, given a fixed number of cores. Is there any reason to think that cores are sitting around unused if we don't parallelize inside the test suite?

As for the error, I can only imagine it results from the InputResistanceTest constructor not calling the sciunit.SciUnit constructor. I'm not sure why that is happening in serial but not in parallel. Or maybe in parallel when it unpickles that attribute disappears somehow, because it is not actually defined as an attribute of the class anywhere, only initialized in the constructor. Maybe you can try adding unpicklable as an attribute to the sciunit.SciUnit class, i.e. unpicklable = None outside the constructor, just in the body of the class definition (and make sure to use that version of sciunit).

from neuronunit.

russelljjarvis avatar russelljjarvis commented on September 4, 2024

Its not happening in serial because its only parallel mapping (future mapping that pickles), its iwith out futures.map it just falls back to map which has no need to pickle. Pickling is used to collate results spread out across different CPUs onto rank 0

I think there is an advantage in spreading out the work load when ever a call to NEURON is involved.

Timing would be the only way to find out if this approach has real merit or not.

You are probably right that CPUs should only spread across different parameter spaces, and not the calculation of all of the different types of error.

I am happy to hold back and just assume everything we have done so far is sufficient.

from neuronunit.

russelljjarvis avatar russelljjarvis commented on September 4, 2024

More on this issue. If you look at SCOOPs logo which contains a prominent tree or a graph, you can actually see that the philosophy of SCOOP is about nested parallel calls. The easiest way to think about what I am proposing is that calls to futures.map inside futures.map is causing a branching and tree like network topology (its not a persistent topology, it only exists for the duration of the the nested calls to futures.map). The 'O' in or the root, is more like a broker, but sometimes its behaves like a serial processor as all the results are mapped back to it.

image

I guess my belief that the work loads will get done faster if jobs are spread out across the leaves of a tree (a hierarchal spread as opposed to just spread a flat spread) is only motivated by the philosophy of SCOOP. It may not actually be merit based.

from neuronunit.

rgerkin avatar rgerkin commented on September 4, 2024

Did you try the idea to list unpicklable explicitly as an attribute of sciunit.SciUnit?

from neuronunit.

russelljjarvis avatar russelljjarvis commented on September 4, 2024

I found where the unpicklable list was initialized as empty list inside an abstract base class inside sciunit. I thought from previous conversations the idea was to append things to this list. Presumably to append them to the list after the base classes object instances are made, and not inside the class definition code itself.

This is not an area that I have a lot of experience with and I can't really pretend to understand how this works.

from neuronunit.

rgerkin avatar rgerkin commented on September 4, 2024

Closing since we decided to focus on ipyparallel.

from neuronunit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.