Toolchefs / atomsGaffer

Atoms Crowd extension for Gaffer
https://atoms.toolchefs.com
27 stars 15 forks source link

Use Gaffer 0.54 Cache Policies #36

Closed johnhaddon closed 5 years ago

johnhaddon commented 5 years ago

Until now, if more than one thread in Gaffer wanted the result of the same computation, and that result wasn't in the cache yet, both threads would perform the compute. This can be particularly bad for big computes that do IO, which I believe is a good description of the AtomsCrowdReader.__engine plug.

Gaffer 0.54 provides the option of blocking in this case, so that the computation is only performed on a single thread. Relevant documentation here :

https://github.com/GafferHQ/gaffer/blob/master/include/Gaffer/ComputeNode.h#L81-L86 https://github.com/GafferHQ/gaffer/blob/master/include/Gaffer/ValuePlug.h#L105-L129

And an example is here :

https://github.com/GafferHQ/gaffer/blob/master/src/GafferImage/OpenImageIOReader.cpp#L756-L771

Feel free to give me a shout if you have any questions.