viennacl / viennacl-dev

Developer repository for ViennaCL. Visit http://viennacl.sourceforge.net/ for the latest releases.
Other
282 stars 91 forks source link

including `viennacl/generator/generate.hpp` produces errors #48

Closed albertz closed 10 years ago

albertz commented 10 years ago

When I do

#include <viennacl/generator/generate.hpp>

I get the following error:

In file included from main.cpp:12:
In file included from /usr/local/include/viennacl/generator/generate.hpp:33:
In file included from /usr/local/include/viennacl/generator/profiles.hpp:35:
In file included from /usr/local/include/viennacl/generator/profile_base.hpp:30:
In file included from /usr/local/include/viennacl/ocl/kernel.hpp:32:
In file included from /usr/local/include/viennacl/ocl/backend.hpp:26:
/usr/local/include/viennacl/ocl/context.hpp:627:29: error: variable has
      incomplete type 'viennacl::ocl::kernel'
      viennacl::ocl::kernel temp(kernel_handle, *this, *p_context_, kern...
                            ^
/usr/local/include/viennacl/ocl/forwards.h:44:11: note: forward declaration of
      'viennacl::ocl::kernel'
    class kernel;
          ^
In file included from main.cpp:12:
In file included from /usr/local/include/viennacl/generator/generate.hpp:33:
In file included from /usr/local/include/viennacl/generator/profiles.hpp:35:
In file included from /usr/local/include/viennacl/generator/profile_base.hpp:30:
In file included from /usr/local/include/viennacl/ocl/kernel.hpp:32:
In file included from /usr/local/include/viennacl/ocl/backend.hpp:26:
/usr/local/include/viennacl/ocl/context.hpp:640:15: error: member access into
      incomplete type 'viennacl::ocl::kernel'
        if (it->name() == name)
              ^
/usr/local/include/viennacl/ocl/forwards.h:44:11: note: forward declaration of
      'viennacl::ocl::kernel'
    class kernel;
          ^
In file included from main.cpp:12:
In file included from /usr/local/include/viennacl/generator/generate.hpp:33:
In file included from /usr/local/include/viennacl/generator/profiles.hpp:35:
In file included from /usr/local/include/viennacl/generator/profile_base.hpp:30:
In file included from /usr/local/include/viennacl/ocl/kernel.hpp:32:
In file included from /usr/local/include/viennacl/ocl/backend.hpp:26:
/usr/local/include/viennacl/ocl/context.hpp:650:32: error: incomplete type
      'viennacl::ocl::kernel' named in nested name specifier
    inline void viennacl::ocl::kernel::set_work_size_defaults()
                ~~~~~~~~~~~~~~~^~~~~~~~
/usr/local/include/viennacl/ocl/forwards.h:44:11: note: forward declaration of
      'viennacl::ocl::kernel'
    class kernel;
          ^
ptillet commented 10 years ago

Hello again, thanks for pointing at, I will investigate this ASAP. Do the tests in the main branch compile fine for you?

Philippe On Nov 20, 2013 8:49 PM, "Albert Zeyer" notifications@github.com wrote:

When I do

include <viennacl/generator/generate.hpp>

I get the following error:

In file included from main.cpp:12: In file included from /usr/local/include/viennacl/generator/generate.hpp:33: In file included from /usr/local/include/viennacl/generator/profiles.hpp:35: In file included from /usr/local/include/viennacl/generator/profile_base.hpp:30: In file included from /usr/local/include/viennacl/ocl/kernel.hpp:32: In file included from /usr/local/include/viennacl/ocl/backend.hpp:26: /usr/local/include/viennacl/ocl/context.hpp:627:29: error: variable has incomplete type 'viennacl::ocl::kernel' viennacl::ocl::kernel temp(kernel_handle, this, pcontext, kern... ^ /usr/local/include/viennacl/ocl/forwards.h:44:11: note: forward declaration of 'viennacl::ocl::kernel' class kernel; ^ In file included from main.cpp:12: In file included from /usr/local/include/viennacl/generator/generate.hpp:33: In file included from /usr/local/include/viennacl/generator/profiles.hpp:35: In file included from /usr/local/include/viennacl/generator/profile_base.hpp:30: In file included from /usr/local/include/viennacl/ocl/kernel.hpp:32: In file included from /usr/local/include/viennacl/ocl/backend.hpp:26: /usr/local/include/viennacl/ocl/context.hpp:640:15: error: member access into incomplete type 'viennacl::ocl::kernel' if (it->name() == name) ^ /usr/local/include/viennacl/ocl/forwards.h:44:11: note: forward declaration of 'viennacl::ocl::kernel' class kernel; ^ In file included from main.cpp:12: In file included from /usr/local/include/viennacl/generator/generate.hpp:33: In file included from /usr/local/include/viennacl/generator/profiles.hpp:35: In file included from /usr/local/include/viennacl/generator/profile_base.hpp:30: In file included from /usr/local/include/viennacl/ocl/kernel.hpp:32: In file included from /usr/local/include/viennacl/ocl/backend.hpp:26: /usr/local/include/viennacl/ocl/context.hpp:650:32: error: incomplete type 'viennacl::ocl::kernel' named in nested name specifier inline void viennacl::ocl::kernel::set_work_size_defaults()


/usr/local/include/viennacl/ocl/forwards.h:44:11: note: forward declaration of
      'viennacl::ocl::kernel'
    class kernel;
          ^

—
Reply to this email directly or view it on GitHubhttps://github.com/viennacl/viennacl-dev/issues/48
.
albertz commented 10 years ago

I just did make there, does that also build the tests? make test seems to run them (which I tried and is running right now but seems to take a long time).

ptillet commented 10 years ago

Hello,

For example : make generator_blas1-test-opencl triggers the compilation of the generator's test for the BLAS1 routine. Judging from your error, I think it's an internal error which appears only when the different headers are included in a specific order.

Could you show me the file which triggers this compilation error?

Philippe

2013/11/20 Albert Zeyer notifications@github.com

I just did make there, does that also build the tests? make test seems to run them (which I tried and is running right now but seems to take a long time).

— Reply to this email directly or view it on GitHubhttps://github.com/viennacl/viennacl-dev/issues/48#issuecomment-28888420 .

karlrupp commented 10 years ago

Similar issue on Visual Studio 2013: The error is compiler-dependent, I can't reproduce it on Linux with GCC (4.4-4.8) and Clang 3.0. http://sourceforge.net/p/viennacl/discussion/1143678/thread/656a9fa4/

albertz commented 10 years ago

Even a file with just that include line triggers the error for me.

make generator_blas1-test-opencl strangely works however. But it does not build if I do c++ tests/src/generator_blas1.cpp, then I get the same error.

The make script calls c++ different, with these parameters: /usr/bin/c++ -I/Users/az/Programmierung/viennacl-dev -I/opt/local/include -I/usr/local/include -I/Users/az/Programmierung/viennacl-dev/external -I/Users/az/Programmierung/viennacl-dev/libviennacl/include -DVIENNACL_WITH_OPENCL.

It also just works as c++ -DVIENNACL_WITH_OPENCL ../tests/src/generator_blas1.cpp. (It's a bit strange to me that in that file, it also does #define VIENNACL_WITH_UBLAS 1. Is that correct?)

So, it only works with the OpenCL backend at the moment?

karlrupp commented 10 years ago

The generator only works with OpenCL, yes, because this is where we have just-in-time compilation available :-)

ptillet commented 10 years ago

Hey,

Yes, it only work with the OpenCL backend, and actually there is no real plan to extend the compatibility, because CUDA and C++ are hardly JIT-compilable without messing with the filesystem !

Thanks for reporting, i'll add a proprecessor assertion to check that the OpenCL backend is activated

2013/11/20 Albert Zeyer notifications@github.com

Even a file with just that include line triggers the error for me.

make generator_blas1-test-opencl strangely works however. But it does not build if I do c++ tests/src/generator_blas1.cpp, then I get the same error.

The make script calls c++ different, with these parameters: /usr/bin/c++ -I/Users/az/Programmierung/viennacl-dev -I/opt/local/include -I/usr/local/include -I/Users/az/Programmierung/viennacl-dev/external -I/Users/az/Programmierung/viennacl-dev/libviennacl/include -DVIENNACL_WITH_OPENCL.

It also just works as c++ -DVIENNACL_WITH_OPENCL ../tests/src/generator_blas1.cpp. (It's a bit strange to me that in that file, it also does #define VIENNACL_WITH_UBLAS 1. Is that correct?)

So, it only works with the OpenCL backend at the moment?

— Reply to this email directly or view it on GitHubhttps://github.com/viennacl/viennacl-dev/issues/48#issuecomment-28889661 .

ddemidov commented 10 years ago

Hello everyone!

Yes, it only work with the OpenCL backend, and actually there is no real plan to extend the compatibility, because CUDA and C++ are hardly JIT-compilable without messing with the filesystem !

My $0.02 regarding CUDA JIT-compilation: it took me about two weeks to implement CUDA backend for VexCL, so I should say it is definitely possible :). Boost.filesystem really helps to mess with the filesystem in a portable way. Also, CUDA backend performs a couple of percents better than OpenCL backend (same kernels, same launch configuration).

karlrupp commented 10 years ago

Nice job, Denis. :+1: Still, I don't dare to call nvcc through a system call and the file system, as I really don't want to maintain a build system for CUDA inside ViennaCL. Still hoping for a jit-interface for CUDA instead...

ddemidov commented 10 years ago

Yes, calling nvcc through system() is a bit ugly. Having a library interface for the compiler would be much nicer.

Regarding the filesystem, I already had the necessary framework in place. It is used for offline caching of compiled kernel binaries. This really helps with AMD and Intel OpenCL SDK's. For example, compare times for the first (no cache available, 17.52 sec), and second (offline cache is in use, 2.86 sec) runs. NVIDIA does this already behind the scene (the cache is located at .nv/ComputeCache).