ContNonContractRV.make_thunk#
- ContNonContractRV.make_thunk(node, storage_map, compute_map, no_recycling, impl=None)#
Create a thunk.
This function must return a thunk, that is a zero-arguments function that encapsulates the computation to be performed by this op on the arguments of the node.
- Parameters:
- node
Something previously returned by
Op.make_node()
.- storage_map
A
dict
mappingVariable
s to single-element lists where a computed value for eachVariable
may be found.- compute_map
A
dict
mappingVariable
s to single-element lists where a boolean value can be found. The boolean indicates whether theVariable
’sstorage_map
container contains a valid value (i.e.True
) or whether it has not been computed yet (i.e.False
).- no_recycling
List of
Variable
s for which it is forbidden to reuse memory allocated by a previous call.- impl
str
Description for the type of node created (e.g.
"c"
,"py"
, etc.)
Notes
If the thunk consults the
storage_map
on every call, it is safe for it to ignore theno_recycling
argument, because elements of theno_recycling
list will have a value ofNone
in thestorage_map
. If the thunk can potentially cache return values (likeCLinker
does), then it must not do so for variables in theno_recycling
list.Op.prepare_node()
is always called. If it tries'c'
and it fails, then it tries'py'
, andOp.prepare_node()
will be called twice.