Пример #1
0
def reset():
    """Hard reset of the qutip.settings values
    Recompute the threshold for openmp, so it may be slow.
    """
    for key in __default:
        __self[key] = __default[key]

    from qutip.utilities import available_cpu_count
    __self["num_cpus"] = available_cpu_count()

    try:
        from qutip.cy.openmp.parfuncs import spmv_csr_openmp
    except:
        __self["has_openmp"] = False
        __self["openmp_thresh"] = 10000
    else:
        __self["has_openmp"] = True
        from qutip.cy.openmp.bench_openmp import calculate_openmp_thresh
        thrsh = calculate_openmp_thresh()
        __self["openmp_thresh"] = thrsh

    try:
        __IPYTHON__
        __self["ipython"] = True
    except:
        __self["ipython"] = False

    from qutip._mkl.utilities import _set_mkl
    _set_mkl()
Пример #2
0
def reset():
    """Hard reset of the qutip.settings values
    Recompute the threshold for openmp, so it may be slow.
    """
    for key in __default:
        __self[key] = __default[key]

    import os
    if 'QUTIP_NUM_PROCESSES' in os.environ:
        num_cpus = int(os.environ['QUTIP_NUM_PROCESSES'])
    elif 'cpus' in info:
        import qutip.hardware_info
        info = qutip.hardware_info.hardware_info()
        num_cpus = info['cpus']
    else:
        try:
            num_cpus = multiprocessing.cpu_count()
        except:
            num_cpus = 1
    __self["num_cpus"] = num_cpus

    try:
        from qutip.cy.openmp.parfuncs import spmv_csr_openmp
    except:
        __self["has_openmp"] = False
        __self["openmp_thresh"] = 10000
    else:
        __self["has_openmp"] = True
        from qutip.cy.openmp.bench_openmp import calculate_openmp_thresh
        thrsh = calculate_openmp_thresh()
        __self["openmp_thresh"] = thrsh

    try:
        __IPYTHON__
        __self["ipython"] = True
    except:
        __self["ipython"] = False

    from qutip._mkl.utilities import _set_mkl
    _set_mkl()
Пример #3
0
import qutip.cy.pyxbuilder as pbldr
pbldr.install(setup_args={'include_dirs': [numpy.get_include()]})
del pbldr

# -----------------------------------------------------------------------------
# Load user configuration if present: override defaults.
#
import qutip.configrc
has_rc, rc_file = qutip.configrc.has_qutip_rc()

# Make qutiprc and benchmark OPENMP if has_rc = False
if qutip.settings.has_openmp and (not has_rc):
    from qutip.cy.openmp.bench_openmp import calculate_openmp_thresh
    #bench OPENMP
    print('Calibrating OPENMP threshold...')
    thrsh = calculate_openmp_thresh()
    qutip.configrc.generate_qutiprc()
    has_rc, rc_file = qutip.configrc.has_qutip_rc()
    if has_rc:
        qutip.configrc.write_rc_key(rc_file, 'openmp_thresh', thrsh)
# Make OPENMP if has_rc but 'openmp_thresh' not in keys
elif qutip.settings.has_openmp and has_rc:
    from qutip.cy.openmp.bench_openmp import calculate_openmp_thresh
    has_omp_key = qutip.configrc.has_rc_key(rc_file, 'openmp_thresh')
    if not has_omp_key:
        print('Calibrating OPENMP threshold...')
        thrsh = calculate_openmp_thresh()
        qutip.configrc.write_rc_key(rc_file, 'openmp_thresh', thrsh)

# Load the config file
if has_rc:
Пример #4
0
import qutip.cy.pyxbuilder as pbldr
pbldr.install(setup_args={'include_dirs': [numpy.get_include()]})
del pbldr

# -----------------------------------------------------------------------------
# Load user configuration if present: override defaults.
#
import qutip.configrc
has_rc, rc_file = qutip.configrc.has_qutip_rc()

# Make qutiprc and benchmark OPENMP if has_rc = False
if qutip.settings.has_openmp and (not has_rc):
    from qutip.cy.openmp.bench_openmp import calculate_openmp_thresh
    #bench OPENMP
    print('Calibrating OPENMP threshold...')
    thrsh = calculate_openmp_thresh()
    qutip.configrc.generate_qutiprc()
    has_rc, rc_file = qutip.configrc.has_qutip_rc()
    if has_rc:
        qutip.configrc.write_rc_key(rc_file, 'openmp_thresh', thrsh)
# Make OPENMP if has_rc but 'openmp_thresh' not in keys
elif qutip.settings.has_openmp and has_rc:
    from qutip.cy.openmp.bench_openmp import calculate_openmp_thresh
    has_omp_key = qutip.configrc.has_rc_key(rc_file, 'openmp_thresh')
    if not has_omp_key:
        print('Calibrating OPENMP threshold...')
        thrsh = calculate_openmp_thresh()
        qutip.configrc.write_rc_key(rc_file, 'openmp_thresh', thrsh)

# Load the config file
if has_rc: