matrixfunctions / GraphMatFun.jl

Computation graphs for matrix functions
MIT License
13 stars 0 forks source link

topo order vs priohelp #25

Closed jarlebring closed 3 years ago

jarlebring commented 3 years ago

The idea behind priohelp in get_topo_order and gen_code was to have a point system in order to influence the order returned in get_topo_order. The "default" behaviour in get_topo_order is greedy in the sense that it gives extra points to nodes with few children (so memory is likely to be freed sooner). If a node frees memory the point is set to -Inf or NaN. Since priohelp is added to this value, and -Inf+ a is always -Inf, the priohelp does not provide as much control as it could.

Suggestion: We replace -Inf and NaN usage in get_topo_order with -free_mem_bonus and -2*free_mem_bonus where free_mem_bonus is a kwarg.