Skip to content
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

Building from source in Ubuntu 16.04 LTS amd64 #2306

Closed
hholst80 opened this issue May 10, 2016 · 15 comments
Closed

Building from source in Ubuntu 16.04 LTS amd64 #2306

hholst80 opened this issue May 10, 2016 · 15 comments
Labels
stat:contribution welcome Status - Contributions welcome

Comments

@hholst80
Copy link
Contributor

I have installed the nvidia-cuda-toolkit from Ubuntu Multiverse package and I wish to compile TensorFlow from source. I realize that I still need CuDNN to be installed the traditional way because its not (yet) packaged by Ubuntu.

The configure scripts has some issues which hinders me to configure it for Compute Capability 3.0.

Environment info

Operating System: Ubuntu 16.04 LTS (amd64)

TensorFlow version hash as reported by git log -1 --oneline:
5681406 Add polygamma and zeta function to tensorflow (#1834)

Installed version of CUDA and cuDNN:

# find /usr/lib -name libcud\*
/usr/lib/i386-linux-gnu/libcuda.so.1
/usr/lib/i386-linux-gnu/libcuda.so.361.42
/usr/lib/i386-linux-gnu/libcuda.so
/usr/lib/x86_64-linux-gnu/libcuda.so.1
/usr/lib/x86_64-linux-gnu/libcudart.so.7.5.18
/usr/lib/x86_64-linux-gnu/libcuda.so.361.42
/usr/lib/x86_64-linux-gnu/libcudart.so
/usr/lib/x86_64-linux-gnu/libcudart.so.7.5
/usr/lib/x86_64-linux-gnu/libcudadevrt.a
/usr/lib/x86_64-linux-gnu/stubs/libcuda.so
/usr/lib/x86_64-linux-gnu/libcuda.so
/usr/lib/x86_64-linux-gnu/libcudart_static.a
# find /usr/local/cuda
/usr/local/cuda
/usr/local/cuda/lib64
/usr/local/cuda/lib64/libcudnn_static.a
/usr/local/cuda/lib64/libcudnn.so
/usr/local/cuda/lib64/libcudnn.so.4
/usr/local/cuda/lib64/libcudnn.so.4.0.7
/usr/local/cuda/include
/usr/local/cuda/include/cudnn.h

Steps to reproduce

  1. git checkout https://github.com/tensorflow/tensorflow
  2. git checkout 5681406
  3. ./configure
@vladfi1
Copy link
Contributor

vladfi1 commented May 10, 2016

You should configure with TF_UNOFFICIAL_SETTINGS=1 in order to allow compute capability 3.0.

@hholst80
Copy link
Contributor Author

I used grep to search through the source for that string and I could not find any trace of it being used by the configuration script. I will however try that and report back to make sure I did not miss anything.

@vladfi1
Copy link
Contributor

vladfi1 commented May 10, 2016

@hholst80 You're right, git grep didn't turn up anything for me either. This worked for me though on my GTX 660.

I got the solution from #25 (comment). Note that the variable is actually TF_UNOFFICIAL_SETTING (no "s") - sorry!

@hholst80
Copy link
Contributor Author

I made some changes to build TensorFlow 0.8.0 on my workstation which is running Ubuntu 16.04 LTS amd64. The changes can be found here https://git.frostbite.com/hholst/ea-tensorflow

@adamcavendish
Copy link

@hholst80 How did you escape the configure:

Please specify the location where CUDA 7.5 toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]:
Invalid path to CUDA  toolkit. /usr/local/cuda/lib64/libcudart.so cannot be found

when asked for libcudart.so?

Cause nvidia-cuda-toolkit package is installed in /usr/lib/x86_64-linux-gnu/libcudart.so

@prafiles
Copy link

@adamcavendish apparently just use "/usr" instead of "/usr/local/cuda" for cuda path.
Helped me a lot for caffe. Found it on Google Forums. Sorry but cant find the reference anymore.

@adamcavendish
Copy link

@prafiles Sorry, I can't make it work. The configure file asks me to specify a CUDA path, and it'll look for THE_CUDA_PATH/lib64/libcudart.so while the libcudart.so is here at /usr/lib/x86_64-linux-gnu/libcudart.so, therefore it failed.

@prafiles
Copy link

prafiles commented May 14, 2016

@adamcavendish
Sadly I too spent my last day fixing these bugs. Two things came to light. Install CUDA SDK from the .run file. Use the provided driver. And finally use gcc-5 only along with INLINE changes for NVCC.

Installed Caffe, Theano and Tensorflow as per this. There is a lot of mixture of information available over the internet about this. However removing CUDA SDK from apt and switching to run won't be that hard i guess. (Your mileage may vary)

Installing CUDA reference:
https://www.pugetsystems.com/labs/articles/NVIDIA-CUDA-with-Ubuntu-16-04-beta-on-a-laptop-if-you-just-cannot-wait-775/

Modifying NVCC flags:
NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS).
Reference: BVLC/caffe#4046
CMake method didn't work for me.

I'll try to help you more, however I am not at my CUDA workstation right now.

@adamcavendish
Copy link

@prafiles Thx a lot. There's not many choices for us.

@hholst80
Copy link
Contributor Author

Sorry, I did not see that the corperate git repo was firewalled. I copy up the changes to github instead.

@hholst80
Copy link
Contributor Author

https://github.com/hholst80/tensorflow is a snapshot of the customizations I made to build TensorFlow v0.8.0 on Ubuntu 16.04 LTS.

@albertotonda
Copy link

albertotonda commented May 26, 2016

@hholst80 First of all, thanks for sharing your solution. Secondly, I have tried it on Ubuntu 16.04 64 bit, and I manage to run "./configure" with no problem, but I get an error when attempting the next step on the tensorflow instructions. Specifically, when I run "bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer", I get the following:
bazel build -c opt --config=cuda //tensorflow/tools/pip_package:build_pip_package ERROR: /home/alberto/Temporary/tensorflow/tensorflow/tools/pip_package/BUILD:8:1: error loading package 'tensorflow/core': Extension file not found. Unable to load package for '//google/protobuf:protobuf.bzl': BUILD file not found on package path and referenced by '//tensorflow/tools/pip_package:other_headers_gather'. ERROR: Loading failed; build aborted. INFO: Elapsed time: 0.105s
I am a n00b for this, could you help me understand the error?

@hholst80
Copy link
Contributor Author

@albertotonda I have not maintained that version or looked at it since this. I can try and get some time to return to this later, but time and talent is as always a limiting factor. I think that any solution used for this should rely on the official Cuda repository provided by NVIDIA:

$ cat /etc/apt/sources.list.d/cuda.list 
deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 /

@albertotonda
Copy link

Dear Henrik,

actually, I managed to solve the issue and/or it was addressed in one of
the later releases (I cannot remember, exactly); point is, it's now working.

Thanks anyway and best regards.

On Mon, Nov 14, 2016 at 1:33 PM, Henrik Holst notifications@github.com
wrote:

@albertotonda https://github.com/albertotonda I have not maintained
that version or looked at it since this. I can try and get some time to
return to this later, but time and talent is as always a limiting factor. I
think that any solution used for this should rely on the official Cuda
repository provided by NVIDIA:

$ cat /etc/apt/sources.list.d/cuda.list
deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 /


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#2306 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGb6kRqG6BwQj9g87YnxMLOdnCaxDrdzks5q-FUzgaJpZM4IbO5B
.

Alberto Tonda

@gunan
Copy link
Contributor

gunan commented Dec 21, 2016

Looks like this has been resolved. Closing this issue.

@gunan gunan closed this as completed Dec 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:contribution welcome Status - Contributions welcome
Projects
None yet
Development

No branches or pull requests

7 participants