7 views
Skip to first unread message

Russell Jarvis

unread,
Aug 9, 2016, 6:15:58 PM8/9/16
to scoop...@googlegroups.com

Hi everyone,


I am trying to use scoop to use multiple hosts to iterate over a loop. My problem differs from the example problems in that the list used for iteration has elements which are length 3 tuples.


The code properly iterates through the entire list when I execute it without invoking scoop with:

$ipython -i ex_scoop.py


However if I use scoop:

with

$python -m scoop ex_scoop.py


The program only iterates through the first 4 values of the much larger list, and then quits. Does anyone know why this is? Can futures.map get confused about the length of a list of tuples type list?


The code that is generating the problem is below. I am sure it is some kind of beginners conceptual error.


I looked at the full_tree.py example at https://github.com/soravux/scoop/blob/master/examples/full_tree.py

But it does not have any examples quiet like mine. Thanks for your help:)



import numpy as np

import pdb

from scoop import futures

import scoop.utils as utils

import scoop as scoop

import code



class Individual(list):


    def __init__(self, *args):

        list.__init__(self, *args)      


     


def simulator(individual,param_dict):

    R = Model(individual,param_dict)

    volts = R.sn()    

    return volts




individual=[0 for i in xrange(0,3)]

paramdict = {i: 0 for i in params}


faster_iter=[]

ap=8e-8

for zz in xrange(0,27):

    va=7e-4

    for jj in xrange(0,1):

        hd=6e-6

        for ii in xrange(0,89): 

            #Append a tuple of iterator contents also flattening iteration into a list.

            faster_iter.append((ap,va,hd))

            hd=hd+1e-6

        va=va+1e-4 

    ap=ap*10

 


def do_this(faster_iter):

    (x,y,z) = faster_iter

    print x,y,z, scoop.worker

    paramdict={}

    paramdict['ap']=x

    paramdict['va']=y

    paramdict['hd']=z  

    volts = simulator(individual,paramdict)    

    hdl.append(x)

    lval.append(y)

    napl.append(z)


if __name__ == '__main__':

    hdl=[]

    lval=[]

    napl=[]

    serial_contents=futures.map(do_this,faster_iter)

    list_of_lists=zip(hdl, lval, napl)

    print len(list_of_lists)

Reply all
Reply to author
Forward
0 new messages