Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. CMake CUDA QTCreator
QtWS25 Last Chance

CMake CUDA QTCreator

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
cudaqt creatorcmake
3 Posts 2 Posters 1.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sai_b
    wrote on 16 Jul 2020, 16:13 last edited by
    #1

    OK so i setup a cmake project in QTCreator and my cuda program compiles correctly.
    But I get a warning: This file is not part of any project. The code model might have issues parsing this file properly.

    also qt creator goes not give any include headers in the auto complete.

    cmake tells me this is enough but i d like to get atlest come kind of code completion. can i fix this in any way?
    link text

    this is the contents of my cmake file

    cmake_minimum_required(VERSION 3.17)
    
    project(cutest LANGUAGES CUDA)
    add_executable(cutest main.cu)
    
    set_target_properties(
        cutest
        PROPERTIES
        CUDA_SEPARABLE_COMPILATION ON)
    
    
    S 1 Reply Last reply 27 Aug 2020, 18:34
    0
    • S Sai_b
      16 Jul 2020, 16:13

      OK so i setup a cmake project in QTCreator and my cuda program compiles correctly.
      But I get a warning: This file is not part of any project. The code model might have issues parsing this file properly.

      also qt creator goes not give any include headers in the auto complete.

      cmake tells me this is enough but i d like to get atlest come kind of code completion. can i fix this in any way?
      link text

      this is the contents of my cmake file

      cmake_minimum_required(VERSION 3.17)
      
      project(cutest LANGUAGES CUDA)
      add_executable(cutest main.cu)
      
      set_target_properties(
          cutest
          PROPERTIES
          CUDA_SEPARABLE_COMPILATION ON)
      
      
      S Offline
      S Offline
      Sai_b
      wrote on 27 Aug 2020, 18:34 last edited by Sai_b
      #2

      ok late reply. found an easy fix for this. go to
      Tools -> Options -> Environment -> MIME Types

      type .cu in the Filter tab. (just to search for the right type)
      click on text/vnd.nvidia.cuda.csrc and clear the*.cu in the patterns tab.

      now type c++ in the Filter tab.
      click on text/x-c++src and add*.cu;*.cuh in the patters tab. dont clear whats alredy here.

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Red Baron
        wrote on 8 Dec 2021, 10:03 last edited by
        #3

        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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved