1

I'm trying to import the tensorflow project into the CLion IDE (on Linux) so that I can run various cc tests for example this.

I've built tensorflow from source using Bazel following the instructions from here . Now, I'm trying to import the bazel project into the CLion IDE by following the steps listed here.

I'm not able to select an initial project view file of .bazelproject type since it does not exist in my tensorflow directory.

Am I missing something or is there another way so that I can run tensorflow test files on my ide?

5
  • I am not clear on what you are attempting to do. What test files do you want to run? Assuming you want to use the c bindings in Tensorflow? Since you are using CLion? Commented Aug 8, 2018 at 19:57
  • I'm trying to modify tf source code and I notice many *_test.cc files, like this for example. I want to test such files with the help of CLion. Commented Aug 8, 2018 at 20:57
  • Ok now it makes sense. Did you install the CLion Bazel plugin here and followed the instructions here. There is a workspace.bzl file in the root of the TF repository. If this doesn't get you going let me know and I will post a detailed step by step instructions. Commented Aug 8, 2018 at 21:11
  • yes, I installed the plugin by going into the Settings > Plugins > Install > Browse Repositories of IDE. Then, I'm trying to import the project following the link [here] (ij.bazel.build/docs/import-project.html) , but am unable to get the built tensorflow project into CLion. Commented Aug 8, 2018 at 21:14
  • I do see a workspace.bzl file in tensorflow/tensorflow directory. But, I'm not sure where and how to use that. Commented Aug 8, 2018 at 22:53

1 Answer 1

1

Importing the Tensorflow project is no different than any other Bazel Project. It works fine for me when I try the following:

  1. Install the Bazel plugin by going to configure -> Plugins -> and searching for Bazel. Install the following plugin:

enter image description here

  1. Once installed restart CLion

  2. Once restarted click on the open project option in the load screen:

enter image description here

  1. This will open and import the tensorflow project with build settings. You can see from this image that the bazel configuration and settings are imported correctly:

enter image description here

Note: Bazel builds the entire tensorflow project into an installable python package. If you are purely interested in compiling it for C/C++ then I suggest you look at how to build and use the C++ API as building the entire project for every edit you make will age you very quickly.

Recommendation: If you just want to run the test files then install Tensorflow and simply execute the test files like you would run any program with cpp source files.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much Isak, I will try doing this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.