hughperkins / tf-coriander

OpenCL 1.2 implementation for Tensorflow
Apache License 2.0
791 stars 90 forks source link

Cannot run any tensorflow files after install [URGENT] #6

Closed tgs266 closed 7 years ago

tgs266 commented 7 years ago

Hello Hugh, I installed tensorflow-cl as it said, but now I can't run any of the tests... I cant even import tensorflow in any file. Everytime I get the same error:

Traceback (most recent call last):
  File "/home/tucker/anaconda3/lib/python3.5/site-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/home/tucker/anaconda3/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
    _pywrap_tensorflow = swig_import_helper()
  File "/home/tucker/anaconda3/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
  File "/home/tucker/anaconda3/lib/python3.5/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/home/tucker/anaconda3/lib/python3.5/imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: /home/tucker/anaconda3/bin/../lib/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /home/tucker/anaconda3/lib/python3.5/site-packages/tensorflow/python/_pywrap_tensorflow.so)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/tucker/anaconda3/lib/python3.5/site-packages/tensorflow/__init__.py", line 23, in <module>
    from tensorflow.python import *
  File "/home/tucker/anaconda3/lib/python3.5/site-packages/tensorflow/python/__init__.py", line 60, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/home/tucker/anaconda3/lib/python3.5/site-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/home/tucker/anaconda3/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
    _pywrap_tensorflow = swig_import_helper()
  File "/home/tucker/anaconda3/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
  File "/home/tucker/anaconda3/lib/python3.5/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/home/tucker/anaconda3/lib/python3.5/imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: /home/tucker/anaconda3/bin/../lib/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /home/tucker/anaconda3/lib/python3.5/site-packages/tensorflow/python/_pywrap_tensorflow.so)

Error importing tensorflow.  Unless you are using bazel,
you should not try to import tensorflow from its source directory;
please exit the tensorflow source tree, and relaunch your python interpreter
from there.

How do I fix this? Thanks in advance

hughperkins commented 7 years ago

change to a different directory :-) You cant run python from the source tree.

tgs266 commented 7 years ago

The problem is that I am not in the source directory. I am in the home directory, running "python" in the terminal, then trying to import tensorflow. Even if I try to go into another folder like Documents or Downloads it doesn't work

hughperkins commented 7 years ago

Ah, hmmm, right. Seems like it cant import the version of libstdc++ that its expecting. What answers did you give to the questions about python paths, when you did ./configure in tensorflow?

tgs266 commented 7 years ago

I never did ./configure. Nothing about that came up during installation. All I did was run the wheel file

tgs266 commented 7 years ago

I am trying to install from source right now to see if it changes anything

hughperkins commented 7 years ago

Ah. Installing from source sounds like a good plan. Or using a binary that was built against the exact same version of anaconda you are using.

tgs266 commented 7 years ago

Ok I think I found one of the problems... I am not running OpenCL 1.2+ I am on 1.1. I have been googling for about and hour now with no luck. Do you know how to update opencl on ubuntu 16.04?

hughperkins commented 7 years ago

What do you mean by 'running OpenCL 1.2'? Normally, your system doesnt realy have an opencl version as such, I think. The GPU driver is what has an OpenCL version. What is the output of running:

sudo apt-get install clinfo
clinfo

?

tgs266 commented 7 years ago

Here is the output:

Number of platforms                               1
  Platform Name                                   Clover
  Platform Vendor                                 Mesa
  Platform Version                                OpenCL 1.1 MESA 11.2.0
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd
  Platform Extensions function suffix             MESA

  Platform Name                                   Clover
Number of devices                                 1
  Device Name                                     AMD PITCAIRN (DRM 2.43.0, LLVM 3.8.0)
  Device Vendor                                   AMD
  Device Vendor ID                                0x1002
  Device Version                                  OpenCL 1.1 MESA 11.2.0
  Driver Version                                  11.2.0
  Device OpenCL C Version                         OpenCL C 1.1 
  Device Type                                     GPU
  Device Profile                                  FULL_PROFILE
  Max compute units                               20
  Max clock frequency                             945MHz
  Max work item dimensions                        3
  Max work item sizes                             256x256x256
  Max work group size                             256
  Preferred work group size multiple              64
  Preferred / native vector sizes                 
    char                                                16 / 16      
    short                                                8 / 8       
    int                                                  4 / 4       
    long                                                 2 / 2       
    half                                                 0 / 0        (n/a)
    float                                                4 / 4       
    double                                               2 / 2        (cl_khr_fp64)
  Half-precision Floating-point support           (n/a)
  Single-precision Floating-point support         (core)
    Denormals                                     No
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 No
    Round to infinity                             No
    IEEE754-2008 fused multiply-add               No
    Support is emulated in software               No
    Correctly-rounded divide and sqrt operations  No
  Double-precision Floating-point support         (cl_khr_fp64)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
    Correctly-rounded divide and sqrt operations  No
  Address bits                                    32, Little-Endian
  Global memory size                              1073741824 (1024MiB)
  Error Correction support                        No
  Max memory allocation                           268435456 (256MiB)
  Unified memory for Host and Device              Yes
  Minimum alignment for any data type             128 bytes
  Alignment of base address                       1024 bits (128 bytes)
  Global Memory cache type                        None
  Image support                                   No
  Local memory type                               Local
  Local memory size                               32768 (32KiB)
  Max constant buffer size                        268435456 (256MiB)
  Max number of constant args                     16
  Max size of kernel argument                     1024
  Queue properties                                
    Out-of-order execution                        No
    Profiling                                     Yes
  Profiling timer resolution                      0ns
  Execution capabilities                          
    Run OpenCL kernels                            Yes
    Run native kernels                            No
  Device Available                                Yes
  Compiler Available                              Yes
  Device Extensions                               cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_fp64

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  Clover
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   Success [MESA]
  clCreateContext(NULL, ...) [default]            Success [MESA]
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  Success (1)
    Platform Name                                 Clover
    Device Name                                   AMD PITCAIRN (DRM 2.43.0, LLVM 3.8.0)
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  Success (1)
    Platform Name                                 Clover
    Device Name                                   AMD PITCAIRN (DRM 2.43.0, LLVM 3.8.0)

ICD loader properties
  ICD loader Name                                 OpenCL ICD Loader
  ICD loader Vendor                               OCL Icd free software
  ICD loader Version                              2.2.8
  ICD loader Profile                              OpenCL 1.2
    NOTE:   your OpenCL library declares to support OpenCL 1.2,
        but it seems to support up to OpenCL 2.1 too.

Also my gpu is r9 270x

hughperkins commented 7 years ago

Oh, Clover...

Soo....

Clover is an opensource driver, but it's OpenCL 1.1 as you see. Except it's not, because it doesnt support basic maths like tanh.

You can choose to try using Clover, but I dont support 1.1 for now: you'd need to hack around in the code, adding shims and stuff. This is hard.

On the whole, if you prefer 'easy' to 'hard', you might consider installing the proprietary AMD drivers.

hughperkins commented 7 years ago

(Note that the AMD driver for 270x supports 1.2: https://en.wikipedia.org/wiki/List_of_AMD_graphics_processing_units )

tgs266 commented 7 years ago

Ok. I am going to have to look around a little for a driver that is compatible with both the 270x and 16.04... There is a chance I am just going to have to roll back ubuntu to 14.04 or 15 which is going to be a pain to do. Thanks for your help