Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/numexpr-2.8.7.dev1-py3.8-linux-x86_64.egg/numexpr/__init__.py: 58%
24 statements
« prev ^ index » next coverage.py v7.3.1, created at 2023-09-19 06:05 +0000
« prev ^ index » next coverage.py v7.3.1, created at 2023-09-19 06:05 +0000
1###################################################################
2# Numexpr - Fast numerical array expression evaluator for NumPy.
3#
4# License: MIT
5# Author: See AUTHORS.txt
6#
7# See LICENSE.txt and LICENSES/*.txt for details about copyright and
8# rights to use.
9####################################################################
11"""
12Numexpr is a fast numerical expression evaluator for NumPy. With it,
13expressions that operate on arrays (like "3*a+4*b") are accelerated
14and use less memory than doing the same calculation in Python.
16See:
18https://github.com/pydata/numexpr
20for more info about it.
22"""
24from numexpr.interpreter import MAX_THREADS, use_vml, __BLOCK_SIZE1__
26is_cpu_amd_intel = False # DEPRECATION WARNING: WILL BE REMOVED IN FUTURE RELEASE
28# cpuinfo imports were moved into the test submodule function that calls them
29# to improve import times.
31import os, os.path
32import platform
33from numexpr.expressions import E
34from numexpr.necompiler import (NumExpr, disassemble, evaluate, re_evaluate,
35 validate)
37from numexpr.utils import (_init_num_threads,
38 get_vml_version, set_vml_accuracy_mode, set_vml_num_threads,
39 set_num_threads, get_num_threads,
40 detect_number_of_cores, detect_number_of_threads)
42# Detect the number of cores
43ncores = detect_number_of_cores()
44# Initialize the number of threads to be used
45nthreads = _init_num_threads()
46# The default for VML is 1 thread (see #39)
47# set_vml_num_threads(1)
49from . import version
50__version__ = version.version
52def print_versions():
53 """Print the versions of software that numexpr relies on."""
54 try:
55 import numexpr.tests
56 return numexpr.tests.print_versions()
57 except ImportError:
58 # To maintain Python 2.6 compatibility we have simple error handling
59 raise ImportError('`numexpr.tests` could not be imported, likely it was excluded from the distribution.')
61def test(verbosity=1):
62 """Run all the tests in the test suite."""
63 try:
64 import numexpr.tests
65 return numexpr.tests.test(verbosity=verbosity)
66 except ImportError:
67 # To maintain Python 2.6 compatibility we have simple error handling
68 raise ImportError('`numexpr.tests` could not be imported, likely it was excluded from the distribution.')