how to compile the tutorial program on tensorflow - tensorflow

After configuring the tensorflow, I tried to run the command
bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer
But an error occured which I tried every possible but failed to solve.
ERROR: Skipping '//tensorflow/cc:tutorials_example_trainer': error loading package 'tensorflow/cc': Encountered error while reading extension file 'cuda/build_defs.bzl': no such package '#local_config_cuda//cuda': Traceback (most recent call last):
File "/home/manyz/tensorflow/third_party/gpus/cuda_configure.bzl", line 1042
_create_local_cuda_repository(repository_ctx)
File "/home/manyz/tensorflow/third_party/gpus/cuda_configure.bzl", line 975, in _create_local_cuda_repository
_host_compiler_includes(repository_ctx, cc)
File "/home/manyz/tensorflow/third_party/gpus/cuda_configure.bzl", line 145, in _host_compiler_includes
get_cxx_inc_directories(repository_ctx, cc)
File "/home/manyz/tensorflow/third_party/gpus/cuda_configure.bzl", line 120, in get_cxx_inc_directories
set(includes_cpp)
The set constructor for depsets is deprecated and will be removed. Please use the depset constructor instead. You can temporarily enable the deprecated set constructor by passing the flag --incompatible_disallow_set_constructor=false
WARNING: Target pattern parsing failed.
ERROR: error loading package 'tensorflow/cc': Encountered error while reading extension file 'cuda/build_defs.bzl': no such package '#local_config_cuda//cuda': Traceback (most recent call last):
File "/home/manyz/tensorflow/third_party/gpus/cuda_configure.bzl", line 1042
_create_local_cuda_repository(repository_ctx)
File "/home/manyz/tensorflow/third_party/gpus/cuda_configure.bzl", line 975, in _create_local_cuda_repository
_host_compiler_includes(repository_ctx, cc)
File "/home/manyz/tensorflow/third_party/gpus/cuda_configure.bzl", line 145, in _host_compiler_includes
get_cxx_inc_directories(repository_ctx, cc)
File "/home/manyz/tensorflow/third_party/gpus/cuda_configure.bzl", line 120, in get_cxx_inc_directories
set(includes_cpp)
The set constructor for depsets is deprecated and will be removed. Please use the depset constructor instead. You can temporarily enable the deprecated set constructor by passing the flag --incompatible_disallow_set_constructor=false
INFO: Elapsed time: 2.293s
FAILED: Build did NOT complete successfully (0 packages loaded)
currently loading: tensorflow/cc
Note that: I've installed the CUDA8.0, cuDNN 5.0 and Bazel 0.6.0, My system is Ubuntu 16.04.

It seems there is already an issue open for this problem: https://github.com/tensorflow/tensorflow/issues/11859. Last comment says that the issue can be fixed by editing line 120 in tensorflow/third_party/gpus/cuda_configure.bzl. If that doesn't help I'd subscribe to the issue and wait for a fix.

Related

ninja WebRtc build error :ninja: build stopped: subcommand failed

WSL + Ubuntu18.04 + webrtc
This project is proper functioning in Ubuntu 18.04 doesn't with WSL;
gn command:
gn gen out/SDK --args='target_os="android" target_cpu="arm" is_debug=true rtc_use_h264=true use_openh264=true rtc_libvpx_build_vp9=false rtc_build_libvpx=true rtc_include_tests=false rtc_include_ilbc=false rtc_include_pulse_audio=false ffmpeg_branding="Chrome"'
error Info :
ninja: Entering directory `out/SDK'
[2138/5820] ACTION
//api/video:video_frame_enums(//build/toolchain/android:android_clang_arm)
FAILED: gen/api/video/video_frame_enums.srcjar
python ../../build/android/gyp/java_cpp_enum.py --depfile gen/api/video/video_frame_enums.d --srcjar=gen/api/video/video_frame_enums.srcjar ../../api/video/video_codec_type.h
Traceback (most recent call last):
File "../../build/android/gyp/java_cpp_enum.py", line 437, in <module>
DoMain(sys.argv[1:])
File "../../build/android/gyp/java_cpp_enum.py", line 429, in DoMain
for output_path, data in DoGenerate(input_paths):
File "../../build/android/gyp/java_cpp_enum.py", line 329, in DoGenerate
source_path)
Exception: No enums found in ../../api/video/video_codec_type.h
Did you forget prefixing enums with "// GENERATED_JAVA_ENUM_PACKAGE: foo"?
[2140/5820] ACTION //api:rtp_parameters_enums(//build/toolchain/android:android_clang_arm)
FAILED: gen/api/rtp_parameters_enums.srcjar
python ../../build/android/gyp/java_cpp_enum.py --depfile gen/api/rtp_parameters_enums.d --srcjar=gen/api/rtp_parameters_enums.srcjar ../../api/rtp_parameters.h
Traceback (most recent call last):
File "../../build/android/gyp/java_cpp_enum.py", line 437, in <module>
DoMain(sys.argv[1:])
File "../../build/android/gyp/java_cpp_enum.py", line 429, in DoMain
for output_path, data in DoGenerate(input_paths):
File "../../build/android/gyp/java_cpp_enum.py", line 329, in DoGenerate
source_path)
Exception: No enums found in ../../api/rtp_parameters.h
Did you forget prefixing enums with "// GENERATED_JAVA_ENUM_PACKAGE: foo"?
[2143/5820] CC obj/third_party/libaom/libaom_intrinsics_neon/av1_inv_txfm_neon.o
ninja: build stopped: subcommand failed.
How can I change it to compile properly?

Failed to run bcc-tools profiler

I am attempting to run the bcc tool's "profile.py", and ran into the following error:
./bcc/tools/profile.py
Sampling at 49 Hertz of all threads by user + kernel stack... Hit Ctrl-C to end.
In file included from <built-in>:1:
././include/linux/kconfig.h:5:10: fatal error: 'generated/autoconf.h' file not found
#include <generated/autoconf.h>
^~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Traceback (most recent call last):
File "./bcc/tools/profile.py", line 265, in <module>
b = BPF(text=bpf_text)
File "/usr/lib/python2.7/dist-packages/bcc/__init__.py", line 325, in __init__
raise Exception("Failed to compile BPF text")
The linux headers are found under the normal location of /lib/modules. This is running under kernel version 4.19.88.
Any pointer will be appreciated.

CalledProcessError while installing Tensorflow using Bazel

I am trying to install Tensorflow from source using Bazel on Raspberry pi. I am following the official documentation as given here. When I run the ./configure in Tensorflow directory after completing all the steps written for Bazel, I get the following error
/home/cvit/bin/bazel: line 88: /home/cvit/.bazel/bin/bazel-real: cannot execute binary file: Exec format error
/home/cvit/bin/bazel: line 88: /home/cvit/.bazel/bin/bazel-real: Success
Traceback (most recent call last):
File "./configure.py", line 1552, in <module>
main()
File "./configure.py", line 1432, in main
check_bazel_version('0.15.0')
File "./configure.py", line 450, in check_bazel_version
curr_version = run_shell(['bazel', '--batch', '--bazelrc=/dev/null', 'version'])
File "./configure.py", line 141, in run_shell
output = subprocess.check_output(cmd)
File "/usr/lib/python2.7/subprocess.py", line 223, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['bazel', '--batch', '--bazelrc=/dev/null', 'version']' returned non-zero exit status 1
I didn't put the user flag in the bazel installation. So, I think this might be bazelrc error so I tried to set $PATH=$BAZEL/bin but nothing happened.
Please give any suggestion !!
Probably the problem is that the non appropriate version of bazel is installed.
Run bazel version in the tensorflow directory, and see if there is an error.
If there is a problem with bazel version, then check out the .baselversion file, and if it contains a version that isn't installable with apt, then dowload the installer from https://github.com/bazelbuild/bazel/releases then install it, else install with apt.
After that everything should work fine.

Bazel build error with Tensorflow

I am getting issue when I want build bazel with tf, I saw almost same issue in this link
I am using NVIDIA GFORCE 1080, CUDA 8, cudnn 5.ubuntu 16.04
jesse#jesse-System-Product-Name:~/tensorflow$ bazel build -c opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
..........
ERROR: Skipping '//tensorflow/tools/pip_package:build_pip_package': error loading package 'tensorflow/tools/pip_package': Encountered error while reading extension file 'cuda/build_defs.bzl': no such package '#local_config_cuda//cuda': Traceback (most recent call last):
File "/home/jesse/tensorflow/third_party/gpus/cuda_configure.bzl", line 1039
_create_local_cuda_repository(repository_ctx)
File "/home/jesse/tensorflow/third_party/gpus/cuda_configure.bzl", line 976, in _create_local_cuda_repository
_host_compiler_includes(repository_ctx, cc)
File "/home/jesse/tensorflow/third_party/gpus/cuda_configure.bzl", line 145, in _host_compiler_includes
get_cxx_inc_directories(repository_ctx, cc)
File "/home/jesse/tensorflow/third_party/gpus/cuda_configure.bzl", line 120, in get_cxx_inc_directories
set(includes_cpp)
depsets cannot contain mutable items
WARNING: Target pattern parsing failed.
ERROR: error loading package 'tensorflow/tools/pip_package': Encountered error while reading extension file 'cuda/build_defs.bzl': no such package '#local_config_cuda//cuda': Traceback (most recent call last):
File "/home/jesse/tensorflow/third_party/gpus/cuda_configure.bzl", line 1039
_create_local_cuda_repository(repository_ctx)
File "/home/jesse/tensorflow/third_party/gpus/cuda_configure.bzl", line 976, in _create_local_cuda_repository
_host_compiler_includes(repository_ctx, cc)
File "/home/jesse/tensorflow/third_party/gpus/cuda_configure.bzl", line 145, in _host_compiler_includes
get_cxx_inc_directories(repository_ctx, cc)
File "/home/jesse/tensorflow/third_party/gpus/cuda_configure.bzl", line 120, in get_cxx_inc_directories
set(includes_cpp)
depsets cannot contain mutable items
INFO: Elapsed time: 3.739s
FAILED: Build did NOT complete successfully (0 packages loaded)
currently loading: tensorflow/tools/pip_package

Error loading library gpuarray with Theano

I am trying to run this script to test Theano's use of my GPU and get the following error:
ERROR (theano.gpuarray): Could not initialize pygpu, support disabled
Traceback (most recent call last):
File "/home/me/anaconda3/envs/py35/lib/python3.5/site-
packages/theano/gpuarray/__init__.py", line 164, in <module>
use(config.device)
File "/home/me/anaconda3/envs/py35/lib/python3.5/site-
packages/theano/gpuarray/__init__.py", line 151, in use
init_dev(device)
File "/home/me/anaconda3/envs/py35/lib/python3.5/site-
packages/theano/gpuarray/__init__.py", line 60, in init_dev
sched=config.gpuarray.sched)
File "pygpu/gpuarray.pyx", line 614, in pygpu.gpuarray.init
(pygpu/gpuarray.c:9419)
File "pygpu/gpuarray.pyx", line 566, in pygpu.gpuarray.pygpu_init
(pygpu/gpuarray.c:9110)
File "pygpu/gpuarray.pyx", line 1021, in
pygpu.gpuarray.GpuContext.__cinit__ (pygpu/gpuarray.c:13472)
pygpu.gpuarray.GpuArrayException: Error loading library: -1
I need to use the nvidia-381 driver since my GPU is a 1080 ti and is not compatible with nvidia-375. I'm not sure if that matters but installing nvcc overwrites 381 and causes some errors if I reinstall 381 after setting up nvcc so I can't use nvcc.
I can import pygpu without errors but if I run pygpu.test() I get the following error and I don't know how to specify the DEVICE variable without nvcc.
======================================================================
ERROR: Failure: RuntimeError (No test device specified. Specify one using the DEVICE or GPUARRAY_TEST_DEVICE environment variables.)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/me/anaconda3/envs/py35/lib/python3.5/site-packages/nose/failure.py", line 39, in runTest
raise self.exc_val.with_traceback(self.tb)
File "/home/me/anaconda3/envs/py35/lib/python3.5/site-packages/nose/loader.py", line 418, in loadTestsFromName
addr.filename, addr.module)
File "/home/me/anaconda3/envs/py35/lib/python3.5/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/home/me/anaconda3/envs/py35/lib/python3.5/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/home/me/anaconda3/envs/py35/lib/python3.5/imp.py", line 234, in load_module
return load_source(name, filename, file)
File "/home/me/anaconda3/envs/py35/lib/python3.5/imp.py", line 172, in load_source
module = _load(spec)
File "<frozen importlib._bootstrap>", line 693, in _load
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/me/.local/lib/python3.5/site-packages/pygpu-0.6.2-py3.5-linux-x86_64.egg/pygpu/tests/test_tools.py", line 5, in <module>
from .support import (guard_devsup, rand, check_flags, check_meta, check_all,
File "/home/me/.local/lib/python3.5/site-packages/pygpu-0.6.2-py3.5-linux-x86_64.egg/pygpu/tests/support.py", line 32, in <module>
context = gpuarray.init(get_env_dev())
File "/home/me/.local/lib/python3.5/site-packages/pygpu-0.6.2-py3.5-linux-x86_64.egg/pygpu/tests/support.py", line 29, in get_env_dev
raise RuntimeError("No test device specified. Specify one using the DEVICE or GPUARRAY_TEST_DEVICE environment variables.")
RuntimeError: No test device specified. Specify one using the DEVICE or GPUARRAY_TEST_DEVICE environment variables.
----------------------------------------------------------------------
Ran 7 tests in 0.003s
FAILED (errors=7)
<nose.result.TextTestResult run=7 errors=7 failures=0>
Warning: its entirely possible that this is all wrong and the actual reason for your problem is in fact - as you suspect - your gpu driver.
I had the same issue with gpuarray on Windows 10.
In the end I solved it by:
completely uninstall python
install cuda 8.0 (with cudnn 5.1)
install anaconda
install theano through anaconda:
conda install theano pygpu
As you are using linux: This error message basically means It didn't work, don't ask me why And is mostly shown if something with your setup is wrong (e.g. different compilers used for compiling python and theano, or incompatible cuda version)
I would recommend to update to cuda 8.0 and to reinstall your python environment over anaconda (just in case)
On a side note: I tested your example script from the docu and at least that is working....
Note for windows users: Never try to install Anaconda in a location where you have spaces in the path... Everything looks fine ... until theano starts having trouble finding and compiling things.
Note regarding the pygpu.test():
Normally you just set the environment variable:
windows: set DEVICE=cuda
linux: export DEVICE=cuda
BUT The test has the habit of saying you didn't specify a device if the library couldn't be loaded...