-
Notifications
You must be signed in to change notification settings - Fork 45.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding a new op when using tensorflow in windows #1103
Comments
Thanks for the clear question @AnmolChachra ! I bet @mrry has an answer for this. |
The current Windows release does not support (We're currently investigating a way to provide /cc @guschmue |
Thanks for clearing it out. @mrry |
I pushed a change for tf.load_library() on windows to here: I think I'll get the contrib/rnn working tomorrow before sending a pull request. |
contrib/rnn with tf.load_library() on windows is working now (cpu). Waiting for a gpu build before sending PR. |
Hi @mrry, I'm running tensorflow-gpu (1.0.1) on Windows 10. How would you suggest I create and load word2vec_ops.so? My options appear limited - would really appreciate help... |
@robosoup We don't currently have any docs for this, but if you're feeling adventurous you could try following @guschmue's CMake recipe for building a user ops library, which we currently use for the fused RNN ops only: (In the long term, we hope to switch this process to use a set of Bazel rules that match the Linux and Mac OS builds, but this is still TBD.) |
I have being using the load_library() and have some workable process ... can put up a little howto shortly. |
My favorite way is here: |
I was wondering if there are any updates on this? Thanks a lot for the wonderful library. I absolutely love it!! |
@zeeshanzia84 Thanks to some heroic efforts by @guschmue, it's now possible to use |
Thank you @guschmue for your great work, I wonder if this way of walking around works for gpus? |
Yes, gpu does work with the dll, for example the gru uses a gpu kernel that loads as dll: |
Does someone have an example that shows how to compile external C/C++ code into a dll that can be loaded by tensorflow as an external op (without building entire tensorflow source) on Windows? The word2vec code that builds word2vec_ops.so/dll would be a great example.. |
Automatically closing due to lack of recent activity. Please update the issue when new information becomes available, and we will reopen the issue. Thanks! |
Hello, I'm trying to compile a custom op and I'm struggling to get everything working on Windows. You can see all my attempts here on StackOverflow. My current situations is that I've installed both CMake and VS2015 and I'm using the test .cc, .cu and CMakeLists.txt files linked in the SO question, I can get CMake to run with this: CMake CMakeLists.txt -DCMAKE_GENERATOR_PLATFORM=x64 -G "Visual Studio 14 2015" to generate the VS project files, and then I manage to compile something with: MSBuild /p:Configuration=Release add_one.vcxproj But it fails due to the missing Any ideas on how to proceed? |
Decided to go another way and followed the advice posted here, to build TensorFlow from sources.
cmake -A x64 -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE="C:\Users\Sergio\Anaconda3\python.exe" -DPYTHON_LIBRARIES="C:\Users\Sergio\Anaconda3\libs\python35.lib" -DSWIG_EXECUTABLE="C:\Users\Sergio\Downloads\swigwin-3.0.12\swig.exe" -Dtensorflow_ENABLE_GPU=ON -DCUDNN_HOME="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0" -G "Visual Studio 14 2015"
@guschmue Do you have any suggestions here? I might have configured something wrong in the .cmake file, or did something wrong elsewhere, but I tried to follow your guide step by step and I'm not sure about what else to do at this point. Thanks! |
Hello, any ideas on how to tackle this? Is there any way to achieve this? I saw that you've been doing some work to use Bazel to build TF on Windows in the last few months, is there maybe a way to use that to build the .dll for the custom op on Windows too? @mrry I'd love to help if needed, I just have no clue on what I could do here. I'd be happy to eventually test build configurations to give feedbacks though, if that might help. |
This basically states that you have not referenced it to a library, just add the following lines as shown by @guschmue
|
Hi @karShetty - thank you for your answer. I mean, ideally this should be added to the official docs and integrated into TF not as some weird thing that you'd have to look over on GitHub to figure out how to do, but as a properly supported and document process. I saw they've actually added a page dedicated to building TF on Windows with Bazel with TF 11, so hopefully we're getting there, or at least moving in that direction 😄 |
Ah, well I thought you wanted a separate compilation of a custom op as a dll by calling |
@karShetty That's indeed exactly what I want (and what I've been doing on Linux for the last 6 months). As I said on the other issue, I'd just like to see feature parity on Windows here, nothing more and nothing less than what has already been available for years on Mac/Linux. EDIT: this doesn't seem to be clear though, now that I re-read your message. I want to be able to build a custom GPU op from binary, without having to build the whole TF library from source. That's the key difference here with what you're suggesting. |
Well the suggested method works fine even with tf r1.12, I use Cmake just to build the dll file. This is how it would typically look like
This would generate my Also in my header files I add And in python I just call |
@karShetty Could you please show the full CMakeLists file. |
Hi all, At this time, do we have a custom GPU op guide for tensorflow > 2.0 on Windows platforms other than https://www.tensorflow.org/guide/create_op which works for Linux and Ubuntu? It seemed some pioneers tried the CMake method in this issue discussion, but failed eventually at some point. I have my custom op work for Linux but would love to see it work on Windows as well. Any suggestion would be appreciated. Thanks. |
Following the (https://www.tensorflow.org/extend/adding_an_op) step by step.
The first two steps , i.e Registering the new_op and Initializing the kernels for the op are same for all operating systems.
Build the op library (https://www.tensorflow.org/extend/adding_an_op#build_the_op_library) is OS specific.
The code for Linux and mac users is given.
How to do it in windows?
The text was updated successfully, but these errors were encountered: