mcsolve windows freeze_support()

167 views
Skip to first unread message

Joe Bowen

unread,
Nov 9, 2015, 8:55:14 AM11/9/15
to QuTiP: Quantum Toolbox in Python
It seems to be generating this warning for each traj in the mcsolver.

RuntimeError:

       
An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase
.


This probably means that you are not using fork to start your
        child processes
and you have forgotten to use the proper idiom
       
in the main module:


           
if __name__ == '__main__':
                freeze_support
()




So I tried to work around this indenting my code within:

     

def run():

   
...

if __name__=="__main__":
   run
()



Which works fine until I add a time dependent Hamiltonian, then I get an error:


_pickle
.PicklingError: Can't pickle <function run.<locals>.H1_coeff at 0x06B21618>: attribute lookup H1_coeff on __main__ failed



where my H1_coeff is:


def H1_coeff(t, args):
           
return np.cos(t)
HMC
=[H0,[H1,H1_coeff]]


Is there another tip to get the mcsolver working? I know it's not ideal to be using windows but it's all I have at the moment.


Thanks,

Joe



















Paul Nation

unread,
Nov 13, 2015, 9:11:24 AM11/13/15
to QuTiP Group

In short, freeze_support issues are a major pain.  I have really no clue how to fix them.  Indeed, you cannot pass an indented function to the parallel processing routines. This is one of the many reasons why we frown upon windows.  Or at least I do.

Paul

--
You received this message because you are subscribed to the Google Groups "QuTiP: Quantum Toolbox in Python" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qutip+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages