Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/numexpr/__init__.py: 58%

24 statements  

« prev     ^ index     » next       coverage.py v7.2.5, created at 2023-05-10 06:15 +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#################################################################### 

10 

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. 

15 

16See: 

17 

18https://github.com/pydata/numexpr 

19 

20for more info about it. 

21 

22""" 

23 

24from numexpr.interpreter import MAX_THREADS, use_vml, __BLOCK_SIZE1__ 

25 

26is_cpu_amd_intel = False # DEPRECATION WARNING: WILL BE REMOVED IN FUTURE RELEASE 

27 

28# cpuinfo imports were moved into the test submodule function that calls them  

29# to improve import times. 

30 

31import os, os.path 

32import platform 

33from numexpr.expressions import E 

34from numexpr.necompiler import NumExpr, disassemble, evaluate, re_evaluate 

35 

36from numexpr.utils import (_init_num_threads, 

37 get_vml_version, set_vml_accuracy_mode, set_vml_num_threads, 

38 set_num_threads, get_num_threads, 

39 detect_number_of_cores, detect_number_of_threads) 

40 

41# Detect the number of cores 

42ncores = detect_number_of_cores() 

43# Initialize the number of threads to be used 

44nthreads = _init_num_threads() 

45# The default for VML is 1 thread (see #39) 

46# set_vml_num_threads(1) 

47 

48from . import version 

49__version__ = version.version 

50 

51def print_versions(): 

52 """Print the versions of software that numexpr relies on.""" 

53 try: 

54 import numexpr.tests 

55 return numexpr.tests.print_versions() 

56 except ImportError: 

57 # To maintain Python 2.6 compatibility we have simple error handling 

58 raise ImportError('`numexpr.tests` could not be imported, likely it was excluded from the distribution.') 

59 

60def test(verbosity=1): 

61 """Run all the tests in the test suite.""" 

62 try: 

63 import numexpr.tests 

64 return numexpr.tests.test(verbosity=verbosity) 

65 except ImportError: 

66 # To maintain Python 2.6 compatibility we have simple error handling 

67 raise ImportError('`numexpr.tests` could not be imported, likely it was excluded from the distribution.')