You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# TODO: Swap this out for a local type-wide memo cache.
# Could also be a decorator, should look a bit like this:
# global memo_cache, memo_cache_lock
# _tid = id(self)
# val: T
# with memocache_lock:
# if _tid in memo_cache:
# val = memo_cache[_tid]
# return val
# val = self.compute()
# memo_cache[_tid] = val
# return val
def__call__(self) ->T:
raiseNotImplementedError
Steps are
1 - bring back the global cache + lock,
2 - insert values based on the id of the inserting memo,
3 - add a clear_memo_cache API, maybe factoring out everything related into a nnbench.types.memo submodule.
4 - (optional) - check if evicting the memoized value in Memo.del() does anything (debug logs!)
5 - drop functools.cache decorators everywhere (examples!)
NB: Check that the Memo.__call__() type annotation is not affected by the solution, since that breaks typechecking in benchmarks. (With a decorator, this should not be a problem.)
What would be super nice: Showcase a parametrized benchmark with a collection of large numpy array memos, checking if evicting an array after the last run of the family and triggering GC (gc.collect()) does anything. memray is (hopefully) your friend: https://bloomberg.github.io/memray/index.html
-> This needs #125.
The text was updated successfully, but these errors were encountered:
As per this TODO:
nnbench/src/nnbench/types/types.py
Lines 104 to 119 in 65fc45b
Steps are
1 - bring back the global cache + lock,
2 - insert values based on the id of the inserting memo,
3 - add a
clear_memo_cache
API, maybe factoring out everything related into annbench.types.memo
submodule.4 - (optional) - check if evicting the memoized value in Memo.del() does anything (debug logs!)
5 - drop functools.cache decorators everywhere (examples!)
NB: Check that the
Memo.__call__()
type annotation is not affected by the solution, since that breaks typechecking in benchmarks. (With a decorator, this should not be a problem.)What would be super nice: Showcase a parametrized benchmark with a collection of large numpy array memos, checking if evicting an array after the last run of the family and triggering GC (
gc.collect()
) does anything. memray is (hopefully) your friend: https://bloomberg.github.io/memray/index.html-> This needs #125.
The text was updated successfully, but these errors were encountered: