def from_cli(opt):
    """Parses the command line options and returns a precessing scheme.

    Parameters
    ----------
    opt: object
        Result of parsing the CLI with OptionParser, or any object with
        the required attributes.

    Returns
    -------
    ctx: Scheme
        Returns the requested processing scheme.
    """
    scheme_str = opt.processing_scheme.split(':')
    name = scheme_str[0]

    if name == "cuda":
        logging.info("Running with CUDA support")
        ctx = CUDAScheme(opt.processing_device_id)
    elif name == "mkl":
        if len(scheme_str) > 1:
            numt = scheme_str[1]
            if numt.isdigit():
                numt = int(numt)
            ctx = MKLScheme(num_threads=numt)
        else:
            ctx = MKLScheme()
        logging.info("Running with MKL support: %s threads" % ctx.num_threads)
    else:
        if len(scheme_str) > 1:
            numt = scheme_str[1]
            if numt.isdigit():
                numt = int(numt)
            ctx = CPUScheme(num_threads=numt)
        else:
            ctx = CPUScheme()
        logging.info("Running with CPU support: %s threads" % ctx.num_threads)
    return ctx
def from_cli ( opt ) : scheme_str = opt . processing_scheme . split ( ':' ) name = scheme_str [ 0 ] if name == "cuda" : logging . info ( "Running with CUDA support" ) ctx = CUDAScheme ( opt . processing_device_id ) elif name == "mkl" : if len ( scheme_str ) > 1 : numt = scheme_str [ 1 ] if numt . isdigit ( ) : numt = int ( numt ) ctx = MKLScheme ( num_threads = numt ) else : ctx = MKLScheme ( ) logging . info ( "Running with MKL support: %s threads" % ctx . num_threads ) else : if len ( scheme_str ) > 1 : numt = scheme_str [ 1 ] if numt . isdigit ( ) : numt = int ( numt ) ctx = CPUScheme ( num_threads = numt ) else : ctx = CPUScheme ( ) logging . info ( "Running with CPU support: %s threads" % ctx . num_threads ) return ctx
Parses the command line options and returns a precessing scheme.

    Parameters
    ----------
    opt: object
        Result of parsing the CLI with OptionParser, or any object with
        the required attributes.

    Returns
    -------
    ctx: Scheme
        Returns the requested processing scheme.