-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Fix #708 #1025
base: main
Are you sure you want to change the base?
[WIP] Fix #708 #1025
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1025 +/- ##
==========================================
- Coverage 97.32% 96.57% -0.75%
==========================================
Files 89 91 +2
Lines 14964 15145 +181
==========================================
+ Hits 14563 14626 +63
- Misses 401 519 +118 ☔ View full report in Codecov by Sentry. |
@NimaSarajpoor Thank you for painstakingly going through all of the files/functions. I am wondering if we might be able to write a Python script to help notify us as to which functions are missing |
@seanlaw I was wondering how one can accomplish this:
? This seems to be hard. Right? I mean... detecting that by just going through the function's docstring / body may not be a feasible solution. What do you think? |
@NimaSarajpoor I don't know but I think we'll have to |
[Update]
Note1: The if-block Note2: I tried it on the following script:
And the output is correct:
And when I tried it for
That's. a huge set. This will be reduced when I check if a callee is a njit-decorated function @seanlaw |
@NimaSarajpoor I think that looks great. Here are a few things to consider:
|
One solution is to create one "helper" dictionary where the key is function name, and the value is the name of its corresponding script. So, this can help us to follow the chain by going from caller to the callee, and then see what functions the callee calls, and so on.
|
@seanlaw Lines 77 to 85 in b7b355c
Lines 91 to 96 in b7b355c
The new version of my script (provided below) goes through each file and returns a dictionary with the following keys:
After obtaining such dictionary for each file, the script combines the information, and do some processing. The final output is a nested dictionary. One item of this dictionary is provided below as instance:
Note 1: The callees only contain the functions that are defined in one of the Note 2: In the each set in callees, I used the format Code:
Next step is to revise the script above to check for |
@seanlaw Since we are in PR, I was wondering if I should push my new script to this PR chunk by chunk so that you can review it more easily. |
Sure. If there is sufficient overlap with |
So, are you thinking of having common functions in Let's check the output of Example 1:
Example 2:
|
@NimaSarajpoor Things look fine. However, for the two examples that you provided, I don't like that the outputs are allowed to be of different type. Specifically, I expect Example 2 to return lists as well. |
@seanlaw I think I should have written something like |
for file_name, file_functions_metadata in all_functions.items(): | ||
all_stumpy_functions.update(file_functions_metadata["func_names"]) | ||
|
||
all_stumpy_functions = list(all_stumpy_functions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels strange. You declare all_stumpy_functions
as a set()
above and then you update
it and then you convert it into a list all within a for-loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing that I forgot to notice is that the nested dictionary all_functions
has unique values for all_functions['file_name']['func_names"]. So, I can just use list
.
all_stumpy_functions = []
for file_name in all_functions.keys():
all_stumpy_functions.extend(all_functions['file_name']['func_names'])
Does that address your concern?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not entirely clear what the goal is here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every time I look at it... I feel like the nested dictionary makes it hard to read. I need to re-design it.
It's not entirely clear what the goal is here
My goal was to create a comprehensive list that contains all the functions that are defined in ./stumpy/
, and then use it to ignore any callee that is NOT in that comprehensive list. For instance, range
can be a callee of a function. However, I do not want to keep it. I want to only have the callers/ callees that are defined in stumpy.
return func_names, is_njit, fastmath_values | ||
|
||
|
||
def _get_callees(node, all_functions): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Note to self]
One thing I need to consider here is how things will work if a callee is assigned to a variable before being used. For instance:
Line 2569 in b7b355c
a_subseq_isconstant = _rolling_isconstant |
|
||
|
||
# output 2: func_callers | ||
func_callers = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@seanlaw
Previously, I wanted to follow the chain of callees. Now, as you may notice here, I am trying to get list of callers for each function. We can start with those functions that are njit-decorated and have fastmath flag, and then follow the chain of callers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Whatever you think might work
for f in func_metadata.keys(): | ||
func_callers[f] = [] | ||
|
||
for filepath in filepaths: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to confess here... I think there is a code smell here because of nested for-loop. Although I tried a couple of times, I think I still need to work on this part as it seems to be complicated.
See #708. This PR should address #708 (and #1011)
Each main checkbox below has at least one indented checkbox. The main checkbox represents a callee function with
fastmath=True
and an indented checkbox represents a caller function. If the caller function itself hasfastmath=True
flag as well, a star(*) is written next to its name. In such case, the callers of this function are represented in another checkbox set.maap._compute_multi_p_norm
core._sliding_dot_product
core._p_norm_distance_profile
core._calculate_squared_distance_profile
core.calculate_distance_profile
core._mass
core._apply_exclusion_zone
stump._stump
stump._compute_diagonal
* scraamp._compute_PI
scraamp._prescraamp
mstump._compute_multi_D
scrump._compute_PI
scrump. _prescrump
aamp._compute_diagonal
aamp._aamp
NOTE: The functions
core._count_diagonal_ndist
andcore._total_diagonal_ndists
are ignored as their input parameters cannot have non-finite value.