Skip to content
  • 0 Votes
    10 Posts
    256 Views
    SGaistS

    Hi,

    As @Pl45m4 wrote, CUDA kernels are a different beast that you should keep separated from QObject.
    You won't be able to use signals and slots from CUDA code anyway.
    Make your QObject based classes use CUDA kernels and keep compilation units separate.

  • 0 Votes
    6 Posts
    811 Views
    J

    @Christian-Ehrlicher

    That would be ideal, but QMake was the system used when the project started. We're considering porting everything to CMake, but it looks like it's going to take some doing.

    @Pl45m4
    I tried to use the search function, but those seem to be good sources that I hadn't seen yet. I'll take a look at those right now. But I was able to find an answer on StackOverflow that I somehow missed until now:
    https://stackoverflow.com/questions/32279193/cuda-win7-qt-creator-lnk1104-cannot-open-file-cuda-file-obj
    I just copy-pasted it and it worked (after changing the version number from 7.0 to 12.1). Then I used the code I pasted above and it worked. Then I used a legit CUDA program and it worked. So I'm going to go through it line by line to understand why that .pro works. Thank you for the links!

  • 0 Votes
    1 Posts
    351 Views
    No one has replied
  • 0 Votes
    3 Posts
    1k Views
    R

    This "solution" is just to enable syntax highlighting. Try the following very basic code:

    __global__ void hello() { printf("This is a test"); } int main(int argc, char* argv[]) { hello<<<1,1>>>(); return 0; }

    The code above is a very basic example for CUDA source file that includes a kernel definition and will cause a lot of problems with Qt Creator. I am guessing the same will happen if we use __device__. Adjusting the MIME type for C++ to include CUDA helps only with the syntax highlighting. Ultimately CUDA, while being very, very similar to C/C++, is a different language that requires its own language model that is not included in Qt Creator as well as a compiler, which - through CMake - can somewhat be integrated into the IDE. If you want to develop with CUDA and CMake I would suggest using VS Code or Visual Studio with the second still (2019 edition) having a not that great support for CMake). Last but not least the devs from NVidia have done a really sloppy job in regards to offering integration of the CUDA infrastructure in popular IDEs. It takes hours if not days to make a setup that just works.

  • 0 Votes
    4 Posts
    800 Views
    SGaistS

    What processing are you doing with OpenCV ?

  • 0 Votes
    1 Posts
    616 Views
    No one has replied
  • 0 Votes
    4 Posts
    2k Views
    SGaistS

    Good !

    Thanks for sharing the solution

    Since you have it working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)