Skip to content

using bazel to build tensorflow.dll #22338

Closed

Description

@taotaolin

i try using bazel to build on windows, but tips:

Have I written custom code No
OS Platform and Distribution WIN7 Visual Studio 2015
TensorFlow installed from source master
Bazel version 0.17.1
CUDA/cuDNN version CUDA9.0 / CUDNN 7.2.1
GPU model and memory 1080Ti / 11G
Mobile device N/A
Exact command to reproduce

  1. python ./configure.py
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/C:/U
sers/tao/_bazel_tao/install/360a69cc0fef41d83a4dd948c0474ca5/_embedded_binaries/
A-server.jar) to field java.lang.String.value
WARNING: Please consider reporting this to the maintainers of com.google.protobu
f.UnsafeUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflect
ive access operations
WARNING: All illegal access operations will be denied in a future release
WARNING: --batch mode is deprecated. Please instead explicitly shut down your Ba
zel server using the command "bazel shutdown".
You have bazel 0.17.1 installed.
Please specify the location of python. [Default is C:\Users\tao\AppData\Local\Pr
ograms\Python\Python35\python.exe]:

Found possible Python library paths:
  C:\Users\tao\AppData\Local\Programs\Python\Python35\lib\site-packages
Please input the desired Python library path to use.  Default is [C:\Users\tao\A
ppData\Local\Programs\Python\Python35\lib\site-packages]

Do you wish to build TensorFlow with nGraph support? [y/N]:
No nGraph support will be enabled for TensorFlow.

Do you wish to build TensorFlow with CUDA support? [y/N]: y
CUDA support will be enabled for TensorFlow.

Please specify the CUDA SDK version you want to use. [Leave empty to default to
CUDA 9.0]:

Please specify the location where CUDA 9.0 toolkit is installed. Refer to README
.md for more details. [Default is C:/Program Files/NVIDIA GPU Computing Toolkit/
CUDA/v9.0]:


Please specify the cuDNN version you want to use. [Leave empty to default to cuD
NN 7.0]:


Please specify the location where cuDNN 7 library is installed. Refer to README.
md for more details. [Default is C:/Program Files/NVIDIA GPU Computing Toolkit/C
UDA/v9.0]:

Please specify a list of comma-separated Cuda compute capabilities you want to b
uild with.
You can find the compute capability of your device at: https://developer.nvidia.
com/cuda-gpus.
Please note that each additional compute capability significantly increases your
 build time and binary size. [Default is: 3.5,7.0]:

Please specify optimization flags to use during compilation when bazel option "-
-config=opt" is specified [Default is /arch:AVX]:

Would you like to override eigen strong inline for some C++ compilation to reduc
e the compilation time? [Y/n]:
Eigen strong inline overridden.

2.bazel build --config=opt --config=cuda //tensorflow:libtensorflow.so

bazel build --config=opt --config=cuda //tensorflow:libtensorflow.so will be generated tensorflow.so and tensorflow.lib ?

Then rename the libtensorflow.so to tensorflow.dll, it can be work? @meteorcloudy

Activity

  1. changed the title [-]using bazel to build tensorflow on windows[/-] [+]using bazel to build tensorflow on windows buid failed[/+] on Sep 18, 2018
  2. changed the title [-]using bazel to build tensorflow on windows buid failed[/-] [+]using bazel to build tensorflow.dll[/+] on Sep 18, 2018
  3. tensorflowbutler commented on Sep 18, 2018

    @tensorflowbutler
    Member

    Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks.
    TensorFlow version

  4. taotaolin commented on Sep 19, 2018

    @taotaolin
    Author

    Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks.
    TensorFlow version

    TensorFlow version master maybe r1.10

  5. meteorcloudy commented on Sep 19, 2018

    @meteorcloudy
    Member

    Yes, it should work.

  6. taotaolin commented on Sep 19, 2018

    @taotaolin
    Author
  7. meteorcloudy commented on Sep 19, 2018

    @meteorcloudy
    Member

    Debug: pass -c debug or -c fastbuild
    Release: pass -c opt

  8. taotaolin commented on Sep 20, 2018

    @taotaolin
    Author

    i try using bazel build --config=fastbuild --config=cuda //tensorflow:libtensorflow.so or bazel build --config=debug --config=cuda //tensorflow:libtensorflow.so but it's have some mistake, tips:

    ERROR: Config value fastbuild is not defined in any .rc file   
    or 
    ERROR: Config value debug is not defined in any .rc file
    
  9. meteorcloudy commented on Sep 20, 2018

    @meteorcloudy
    Member

    Sorry, I meant you need to pass -c debug or -c fastbuild, it's different from --config

  10. taotaolin commented on Sep 20, 2018

    @taotaolin
    Author

    fastbuild

    Thank you very much

  11. 53 remaining items

  12. duocang commented on Jul 7, 2019

    @duocang

    @taotaolin hi. my question is how do we use tensorflow.dll? where can we find the functions inside? Or can you share some example?

  13. taotaolin commented on Jul 11, 2019

    @taotaolin
    Author

    @taotaolin嗨。我的问题是我们如何使用tensorflow.dll?我们在哪里可以找到里面的功能?或者你能分享一些例子吗?

    I have an example of MNIST recognition, which I can show you tomorrow.

  14. taotaolin commented on Jul 23, 2019

    @taotaolin
    Author

    @taotaolin hi. my question is how do we use tensorflow.dll? where can we find the functions inside? Or can you share some example?

    Please tell me your contact information

  15. taotaolin commented on Jul 26, 2019

    @taotaolin
    Author

    @taotaolin [email protected]

    Thanks.

    It's too big. I put the code on github. The data set is MNIST.

    MNIST_tensorflow_C

  16. taotaolin commented on Dec 6, 2019

    @taotaolin
    Author

    This script cannot work on the latest Tensorflow. To be exact, it can only work on Tensorflow 1.11.0 at least now.

    @taotaolin Now the script has supported Tensorflow 1.12.0!

    ERROR LNK2019 . Have you resolved this problem? I don't seem to have solved this problem in the latest edition

  17. AndreyOrb commented on Dec 18, 2019

    @AndreyOrb

    @Roffild You may replace the fatal message with this code, and it will work:

    #if defined(PLATFORM_WINDOWS)
    for (const char* dir : std::vector<const char*>(
    {getenv("TEST_TMPDIR"), getenv("TMPDIR"), getenv("TMP"), getenv("TEMP"), "/tmp"})) {
    if (!dir || !dir[0]) {
    continue;
    }
    struct stat statbuf;
    if (!stat(dir, &statbuf) && S_ISDIR(statbuf.st_mode)) {
    string tmp_filepath;
    tmp_filepath = io::JoinPath(
    dir,
    strings::StrCat("tmp_file_tensorflow_", UniqueId(), "_XXXXXX", extension));
    //TODO Switch to secured method _mktemp_s
    //int sizeInChars = strnlen(names[i], 9) + 1;
    //int err = _mktemp_s( names[i], sizeInChars );
    char* fd = _mktemp(&tmp_filepath[0]);
    if (fd == nullptr) {
    LOG(FATAL) << "Failed to create temp file.";
    } else {
    return tmp_filepath;
    }
    }
    }
    LOG(FATAL) << "No temp directory found.";

  18. yuc8939 commented on Feb 24, 2020

    @yuc8939

    You may add --copt=/w34716 to the bazel build command line, e.g.
    bazel build --copt=/w34716 --experimental_shortened_obj_file_path //moco:moco
    This makes the MSVC compiler happy.
    Inspired by: https://stackoverflow.com/a/11386226/12338026

    error C4716: must return a value error

    LOG(FATAL) << "GetTempFilename is not implemented in this platform.";

    const DeviceAttributes& DeviceBase::attributes() const {

    const string& DeviceBase::name() const {

  19. self-assigned this
    on Sep 15, 2021
  20. kumariko commented on Sep 16, 2021

    @kumariko

    @taotaolin We are checking to see if you still need help on this issue. We recommend that you upgrade to 2.6 which is latest stable version of TF and let us know if the issue still persists in newer versions. check comment: #22338 (comment) Thanks!'

  21. google-ml-butler commented on Sep 23, 2021

    @google-ml-butler

    This issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Thank you.

  22. added
    staleThis label marks the issue/pr stale - to be closed automatically if no activity
    on Sep 23, 2021
  23. google-ml-butler commented on Sep 30, 2021

    @google-ml-butler

    Closing as stale. Please reopen if you'd like to work on this further.

  24. google-ml-butler commented on Sep 30, 2021

    @google-ml-butler

    Are you satisfied with the resolution of your issue?
    Yes
    No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

staleThis label marks the issue/pr stale - to be closed automatically if no activitystat:awaiting responseStatus - Awaiting response from authortype:build/installBuild and install issues

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions