ctools 2.1.0.dev
Loading...
Searching...
No Matches
cscripts.mputils Namespace Reference

Functions

 nthreads (cls)
 
 process (nthreads, function, args)
 
 mpfunc (args)
 

Function Documentation

◆ mpfunc()

cscripts.mputils.mpfunc ( args)
Multiprocessing function

Parameters
----------
args : tuple
    Tuple comprised of class, function name and function argument

Returns
-------
result, info : tuple
    Tuple of function result and information

Definition at line 121 of file mputils.py.

◆ nthreads()

cscripts.mputils.nthreads ( cls)
Determines the number of parallel processes to use

The number is based on the user parameter "nthreads" and the availability
of the multiprocessing module.

Parameters
----------
cls : `~ctools.cscript`
    cscript class

Returns
-------
nthreads : int
    Number of threads

Definition at line 26 of file mputils.py.

◆ process()

cscripts.mputils.process ( nthreads,
function,
args )
Execute function in parallel

Parameters
----------
nthreads : int
    Number of parallel threads
function : Python function
    Function to be executed in parallel
args : list of tuples
    Function arguments for each evaluation

Returns
-------
results : list of dicts
    List of function evaluation results

Definition at line 77 of file mputils.py.