DEMutilities. start_parallel

In order to be able to use this module import it like this:

import DEMutilities.start_parallel
#or assign it to a shorter name
import DEMutilities.start_parallel as sta

SimulationThread

class DEMutilities.start_parallel.SimulationThread(queue, runScript, paramsName='./params.pickle', dirkey='dir', out_name='out.txt', verbose=True, skipExisting=False, skipDone=False, done_name='done.txt')

Bases: threading.Thread

Threaded start of run script

SimulationThread(name, parent, **kwargs)
run()
DEMutilities.start_parallel.start_parallel(run_script, parameters, dirs=None, N_threads=-1, params_pickle_name='params.pickle', out_name='out.txt', dirkey='dir', verbose=True, skipExisting=False, skipDone=False, done_name='done.txt')

Starts ‘run_script’ in ‘threads’ (or N_cpus, default) parallel processes in the directories ‘dirs’. Alternatively, the list of dictionaries representing the ‘parameters’ can also contain a key ‘dirkey’ (default: dir), whose value then has to be a path. This item will be deleted from the dictionary prior to pickling it to the target directory. The ‘run_script’ itself has to unpickle the dictionary ‘params_pickle_name’ and change its own parameters accordingly.

Parameters:
-run_script the simulation that can be run by ‘python run_script’.
-parameters list of dictionaries representing the parameters
-dirs list of directories to simulate in (same length as parameters)

-N_threads Number of threads to use, if not in [1,N_cpus], N_cpus is taken -params_pickle_name name of the pickle’d file containing the parameter dictionary that run_script wants to read in. -out_name file into which both stdout and stderr of the simulation are piped -dirkey string which is the key to the directory item in ‘parameters’

DEMutilities.start_parallel.test()