community
community copied to clipboard
Add tutorial and sample code for TensorFlow plugin development
Add tutorial and code sample for TensorFlow plugin development
@mihaimaruseac @penpornk can you review?
@theadactyl Yes, I will review it soon.
Hi,
I've been following the tutorial and it's pretty useful, but I have one question: what should be the name of the plugin package? In TensorFlow I see that it's explicitly looking for a python package named tensorflow_plugins
, but wouldn't that mean that 2 plugins can't be used simultaneously? Is there a way to register a pluggable device with a different name?
Let me know if this isn't the right place to ask this question.
Thanks!
Hi @PatriceVignola,
Yes, here is the right place to ask.
TensorFlow doesn't exactly look for a package named tensorflow_plugins
, it's just going to look for shared libraries (.so files for linux) in a folder named tensorflow-plugins. That folder can have multiple shared libraries from multiple plugin packages, e.g., apu.so, bpu.so, dpu.so, etc.
I think the current pip-package generation script in this tutorial puts more than just the shared library file into the tensorflow-plugins
folder when the package is installed. So it might need some adjustments.
@PatriceVignola each package can have its own package name,the only requirement is the pluggable device library should be copied to tensorflow-plugins
folder, I will update the tutoral example code. Thanks
Thanks! That makes sense.
@penpornk we have update the graph optimization C API part, including sample code. Thanks.
What would be the best way to get the equivalent of libtensorflow_framework.so
in Windows without building TensorFlow from source (if any)? It's not included as part of the python package and there doesn't seem to be Windows nightly builds for the C API library.
Thank you!
@penpornk Have all your changes been addressed? If so, could you re-review?
I have (partially) ported this sample code to Rust. Which way should I better post it? Could I publish that template in my repository or submit it to get included into this PR?
For now it only includes unsafe port of most plugin registration features except profiling and optimization.
@sh7dm Thank you for your contribution! We will try to merge this PR soon. Then you can open a new PR to add new changes. How does this sound? :)
Great! May I push stuff I have into an own repo at least for now (of course linking to this PR as the initial source)?
Let it be here for now.
I'm now working on extending my Rust port with stuff like device-bound kernels (accessing device from kernel).
@penpornk Once you approve, we'll get this merged.