Returns a dictionary containing the currently supported CPU dispatched features for all optimized functions. Parameters ---------- func_name : str (optional) Regular expression to filter by function name. signature : str (optional) Regular expression to fil
(func_name=None, signature=None)
| 6 | |
| 7 | |
| 8 | def opt_func_info(func_name=None, signature=None): |
| 9 | """ |
| 10 | Returns a dictionary containing the currently supported CPU dispatched |
| 11 | features for all optimized functions. |
| 12 | |
| 13 | Parameters |
| 14 | ---------- |
| 15 | func_name : str (optional) |
| 16 | Regular expression to filter by function name. |
| 17 | |
| 18 | signature : str (optional) |
| 19 | Regular expression to filter by data type. |
| 20 | |
| 21 | Returns |
| 22 | ------- |
| 23 | dict |
| 24 | A dictionary where keys are optimized function names and values are |
| 25 | nested dictionaries indicating supported targets based on data types. |
| 26 | |
| 27 | Examples |
| 28 | -------- |
| 29 | Retrieve dispatch information for functions named 'add' or 'sub' and |
| 30 | data types 'float64' or 'float32': |
| 31 | |
| 32 | >>> import numpy as np |
| 33 | >>> dict = np.lib.introspect.opt_func_info( |
| 34 | ... func_name="add|abs", signature="float64|complex64" |
| 35 | ... ) |
| 36 | >>> import json |
| 37 | >>> print(json.dumps(dict, indent=2)) # may vary (architecture) |
| 38 | { |
| 39 | "absolute": { |
| 40 | "dd": { |
| 41 | "current": "SSE41", |
| 42 | "available": "SSE41 baseline(SSE SSE2 SSE3)" |
| 43 | }, |
| 44 | "Ff": { |
| 45 | "current": "FMA3__AVX2", |
| 46 | "available": "AVX512F FMA3__AVX2 baseline(SSE SSE2 SSE3)" |
| 47 | }, |
| 48 | "Dd": { |
| 49 | "current": "FMA3__AVX2", |
| 50 | "available": "AVX512F FMA3__AVX2 baseline(SSE SSE2 SSE3)" |
| 51 | } |
| 52 | }, |
| 53 | "add": { |
| 54 | "ddd": { |
| 55 | "current": "FMA3__AVX2", |
| 56 | "available": "FMA3__AVX2 baseline(SSE SSE2 SSE3)" |
| 57 | }, |
| 58 | "FFF": { |
| 59 | "current": "FMA3__AVX2", |
| 60 | "available": "FMA3__AVX2 baseline(SSE SSE2 SSE3)" |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | """ |