File tree Expand file tree Collapse file tree 3 files changed +50
-20
lines changed
Expand file tree Collapse file tree 3 files changed +50
-20
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+
3+ import argparse
4+ import importlib
5+
6+ from stumpy .cache import get_njit_funcs
7+
8+
9+ def check_fastmath ():
10+ """
11+ Check if all njit functions have the `fastmath` flag set
12+
13+ Parameters
14+ ----------
15+ None
16+
17+ Returns
18+ -------
19+ None
20+ """
21+ missing_fastmath = [] # list of njit functions with missing fastmath flags
22+ for module_name , func_name in get_njit_funcs ():
23+ module = importlib .import_module (f".{ module_name } " , package = "stumpy" )
24+ func = getattr (module , func_name )
25+ if "fastmath" not in func .targetoptions .keys ():
26+ missing_fastmath .append (f"{ module_name } .{ func_name } " )
27+
28+ if len (missing_fastmath ) > 0 :
29+ msg = "Found one or more functions that are missing the `fastmath` flag. "
30+ msg += f"The function(s) are:\n { missing_fastmath } \n "
31+ raise ValueError (msg )
32+
33+ return
34+
35+
36+ parser = argparse .ArgumentParser ()
37+ parser .add_argument ("--perform" , required = True )
38+ EXCEPTED_VALUES = ["check" ]
39+
40+ args = parser .parse_args ()
41+ if args .perform not in EXCEPTED_VALUES :
42+ raise ValueError ("Invalid argument" )
43+
44+ if args .perform == "check" :
45+ check_fastmath ()
46+ else :
47+ pass
Original file line number Diff line number Diff line change @@ -93,10 +93,10 @@ check_print()
9393 fi
9494}
9595
96- check_fastmath ()
96+ fastmath ()
9797{
9898 echo " Checking Missing fastmath flags in njit functions"
99- ./check_fastmath .py
99+ ./fastmath .py --perform check
100100 check_errs $?
101101}
102102
@@ -342,7 +342,7 @@ check_ray
342342
343343
344344if [[ ! -z $NUMBA_DISABLE_JIT && ${NUMBA_DISABLE_JIT} -eq " 0" ]]; then
345- check_fastmath
345+ fastmath
346346fi
347347
348348
You can’t perform that action at this time.
0 commit comments