hughperkins / tf-coriander

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

Can't compile gtests with gcc #10

Closed inferrna closed 7 years ago

inferrna commented 7 years ago

Seems that gcc 5.4.0 can't handle string like this, needed escaping or to put all on one line.

    EXPECT_EQ(R"(    v2 = v1[0];
    v3 = (&(v1[0].f1));
    v6 = v5[0];
)", oss.str());

Got

tensorflow-cl/third_party/cuda-on-cl/test/gtest/test_block_dumper.cpp:428:23: error: expected ‘)’ before ‘;’ token

and a lot of similar errors

hughperkins commented 7 years ago

Needs -std=c++11.

(edit: for more info: https://en.wikipedia.org/wiki/C%2B%2B11#New_string_literals )

hughperkins commented 7 years ago

I think this builds ok now in current tensorflow-cl branch, is that a fair impression?

inferrna commented 7 years ago

It's cuda-on-cl related bug, my mistake. But it still fails even with -std=c++11 and updated tensorflow-cl and cuda-on-cl

/usr/lib/ccache/c++   -DUSE_CLEW -I/media/Compressed/Drivers_bios/src/dev/tensorflow-cl/third_party/cuda-on-cl/src/CLBlast/src -I/media/Compressed/Drivers_bios/src/dev/tensorflow-cl/third_party/cuda-on-cl/src -I/media/Compressed/Drivers_bios/src/dev/tensorflow-cl/third_party/cuda-on-cl/third_party/gtest -I/usr/lib/llvm-3.8/include  -std=c++11 -fPIC   -I/usr/lib/llvm-3.8/include -std=c++11 -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -O2 -g -fexceptions -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -o CMakeFiles/cocl_unittests.dir/test/gtest/test_block_dumper.cpp.o -c /media/Compressed/Drivers_bios/src/dev/tensorflow-cl/third_party/cuda-on-cl/test/gtest/test_block_dumper.cpp
/media/Compressed/Drivers_bios/src/dev/tensorflow-cl/third_party/cuda-on-cl/test/gtest/test_block_dumper.cpp:246:24: warning: missing terminating " character
     ASSERT_EQ(R"(    v5 = (&((&mysharedmem)[0][0]));
                        ^
/media/Compressed/Drivers_bios/src/dev/tensorflow-cl/third_party/cuda-on-cl/test/gtest/test_block_dumper.cpp:246:5: error: missing terminating " character
     ASSERT_EQ(R"(    v5 = (&((&mysharedmem)[0][0]));
     ^

$ /usr/lib/ccache/c++ -v
Using built-in specs.
COLLECT_GCC=/usr/bin/c++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.4' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 
hughperkins commented 7 years ago

I'm not sure. I have gcc5.4 as my default compiler too, on Ubuntu 16.04 Can you perhaps paste your entire configure and build commands and output into a gist? Maybe upload your entire build directory onto Dropbox?

On 26 November 2016 10:19:15 GMT+00:00, inferrna notifications@github.com wrote:

It's cuda-on-cl related bug, my mistake. But it still fails even with -std=c++11 and updated tensorflow-cl and cuda-on-cl

/usr/lib/ccache/c++   -DUSE_CLEW
-I/media/Compressed/Drivers_bios/src/dev/tensorflow-cl/third_party/cuda-on-cl/src/CLBlast/src
-I/media/Compressed/Drivers_bios/src/dev/tensorflow-cl/third_party/cuda-on-cl/src
-I/media/Compressed/Drivers_bios/src/dev/tensorflow-cl/third_party/cuda-on-cl/third_party/gtest
-I/usr/lib/llvm-3.8/include  -std=c++11 -fPIC  
-I/usr/lib/llvm-3.8/include -std=c++11 -fPIC
-fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter
-Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic
-Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor
-Wno-comment -ffunction-sections -fdata-sections -O2 -g -fexceptions
-D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
-D__STDC_LIMIT_MACROS -o
CMakeFiles/cocl_unittests.dir/test/gtest/test_block_dumper.cpp.o -c
/media/Compressed/Drivers_bios/src/dev/tensorflow-cl/third_party/cuda-on-cl/test/gtest/test_block_dumper.cpp
/media/Compressed/Drivers_bios/src/dev/tensorflow-cl/third_party/cuda-on-cl/test/gtest/test_block_dumper.cpp:246:24:
warning: missing terminating " character
    ASSERT_EQ(R"(    v5 = (&((&mysharedmem)[0][0]));
                       ^
/media/Compressed/Drivers_bios/src/dev/tensorflow-cl/third_party/cuda-on-cl/test/gtest/test_block_dumper.cpp:246:5:
error: missing terminating " character
    ASSERT_EQ(R"(    v5 = (&((&mysharedmem)[0][0]));
    ^

$ /usr/lib/ccache/c++ -v
Using built-in specs.
COLLECT_GCC=/usr/bin/c++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
5.4.0-6ubuntu1~16.04.4'
--with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs
--enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++
--prefix=/usr --program-suffix=-5 --enable-shared
--enable-linker-build-id --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --libdir=/usr/lib
--enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin
--with-system-zlib --disable-browser-plugin --enable-java-awt=gtk
--enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre
--enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64
--with-arch-directory=amd64
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc
--enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/hughperkins/tensorflow-cl/issues/10#issuecomment-263055620

-- Sent from my Android device with K-9 Mail. Please excuse my brevity.

inferrna commented 7 years ago

ccache was the reason - passing directly paths to gcc and g++ solved the problem

hughperkins commented 7 years ago

Ah :-) Cool :-)