Visual Studio Intellisense and ViennaCL

Christian
2013-05-15
2013-10-22
  • Christian

    Christian - 2013-05-15

    Hi all,
    I have just begun to use ViennaCL with Microsoft Visual Studio 2010. I want to use OpenCL as backend. OpenCL, CUDA, and the ViennaCL headers are installed correctly and are all found by Visual Studio.

    So far I have not used any GPU programming code in my project. It compiles and runs correctly.
    As soon as I include

    #include "viennacl/vector.hpp"
    #include "viennacl/matrix.hpp"
    

    in my stdafx.h, Intellisense does not work anymore in my whole project. But I can still use ViennaCL in the code, compile and run it correctly.

    I have also created the samples with CMake, and also in the samples projects, Intellisense does not work.

    Does anyone have an idea what could be the reason for this behaviour? Thanks!

     
  • Karl Rupp

    Karl Rupp - 2013-05-15

    Hi,

    I have no immediate idea what might cause the trouble, as ViennaCL does not do any system-specific magic. Two thoughts:
    a) Does IntelliSense work with any of the OpenCL or CUDA examples in the standard SDKs?
    b) nvcc sometimes performs weird tricks to get the compilation going. Does the same problem show up if you only use the CPU backend or the OpenCL backend, i.e. without CUDA?

    Best regards,
    Karli

     
  • Christian

    Christian - 2013-05-15

    Hi,

    Thanks for your reply! I have removed all CUDA-related stuff. Also, I have removed all ViennaCL related code, and the problem is still the same. When I add the two includes, Intellisense does not work anymore, without the includes everything is fine.

    I have tested Intellisense in some CUDA and OpenCL examples and there it works…

     
  • Karl Rupp

    Karl Rupp - 2013-05-15

    Hey,

    which backends do you have enabled? Does it work if neither VIENNACL_WITH_OPENMP (including the openmp compiler flag), VIENNACL_WITH_OPENCL and VIENNACL_WITH_CUDA are defined? If so, which of them breaks IntelliSense? What if you only

    #include "viennacl/forwards.h"
    

    ?

    I'd really like to understand and fix the cause of the problem, but I can't access a suitable machine with IntelliSense installed right now.

    Best regards,
    Karli

     
  • Christian

    Christian - 2013-05-15

    Hi,

    Thanks for your effort!

    I think we got one step further. I have only had VIENNACL_WITH_OPENCL enabled, and the behaviour did not change when I disabled it.

    When I only include forwards.h, Intellisense works! But then I get compile errors, I also need vector.hpp and matrix.hpp. Adding vector.hpp or matrix.hpp breaks Intellisense. This seems to be independent from any #defines like VIENNACL_WITH_OPENCL.

     
  • Karl Rupp

    Karl Rupp - 2013-05-15

    Hey,

    alright, good to know, so the problem is decoupled from OpenCL and CUDA, i.e. it's probably a pure parsing issue. Do you have any experiences on whether IntelliSense works well with other reasonably complex projects, e.g. Boost?

    Thanks for your assistance and best regards,
    Karli

     
  • Christian

    Christian - 2013-05-15

    Hi,

    I have recently used Boost and OpenCV, both worked well with Intellisense.

     
  • Karl Rupp

    Karl Rupp - 2013-05-15

    Oh, okay, I see. I'm slowly running out of simple ideas and checks, so I'd need to find a machine and play around with it on my own.

    Do you happen to know whether I can debug/reproduce this in VS 2010 Express? Does the same issue shows up with VS 2012 Express? Actually, is IntelliSense part of the Express-Editions? (I'm mostly on Linux, hence the noob-questions)

    Best regards,
    Karli

     
  • Christian

    Christian - 2013-05-15

    Hi,

    I have made some additional interesting observations:

    I use a PC (64bit, Win7) with Visual Studio 2010 Pro. There the problem occurred.
    For testing, I created a new project on that machine. I used a precompiled header, and I added an

    #include <string>
    

    Intellisense works fine until I include viennacl/vector.hpp. Including viennacl/forwards.h does not cause any problems.

    I observed exactly the same behaviour on my laptop (64bit, Win8) with Visual Studio 2010 Pro. But I have also Visual Studio 2012 Pro installed on the laptop. Using the 2012 version, I could include viennacl/vector.hpp, and Intellisense still works!

    As far as I know, the Express Editiions come also with Intellisense.

     
  • Christian

    Christian - 2013-05-15

    Hi,

    I have just made a quick test on my PC, the behaviour is the same for Visual Studio 2010 Express C++.

     
  • Karl Rupp

    Karl Rupp - 2013-05-15

    Hi,

    alright, thanks for letting me know. Considering that IntelliSense works with ViennaCL and VS 2012, this should be only a single or at most a few needles in a not too large haystack which we need to find. I'll look into it later today and see if I can find the cause.

    Best regards,
    Karli

     
  • Deepfreeze

    Deepfreeze - 2013-10-21

    Hi,

    I had the same issue today. It was solved by commenting out
    line 1078 in vector.hpp.

    using base_type::operator=;
    

    There doesn't seem to go anything wrong for me, but please
    comment on what effect the commenting out could have and how
    to improve this line to work in visual studio 2010.

    Best Regards,

    Peter

     
  • Karl Rupp

    Karl Rupp - 2013-10-21

    Hi Peter,

    we found a similar issue with Clang and fixed it in the upcoming 1.5.0 release by replacing the using-statement with

    template <typename T>
    self_type & operator=(T const & other)
    {
      base_type::operator=(other);
      return *this;
    }
    

    The line was originally needed because operator= was also overloaded in vector=. Apparently the overload is gone, so there's no need for the using-statement. Since this uses only static polymorphism, everything should work normally as long as compilation succeeds.

    Best regards,
    Karli

     
  • Deepfreeze

    Deepfreeze - 2013-10-22

    Ok, thanks for the update!

    Peter

     

Log in to post a comment.