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. Qt creator with CUDA show Semantic Issue
Qt 6.11 is out! See what's new in the release blog

Qt creator with CUDA show Semantic Issue

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
3 Posts 3 Posters 802 Views 1 Watching
  • 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.
  • K Offline
    K Offline
    kubikula
    wrote on last edited by
    #1

    Hi,
    I try to compile simple CUDA code with qt creator.
    In .pro file I use this code

    ...
    SOURCES += \
            main.cpp
    
    CUDA_DIR = /usr/local/cuda-10.0
    CUDA_SOURCES +=  cuda_functions.cu
    CUDA_ARCH = sm_53
    NVCC_OPTIONS = --use_fast_math
    HOST_COMPILER=$$QMAKE_CXX
    LIB_PATH=x86_64-linux
    
    equals(HOST_COMPILER, "aarch64-linux-gnu-g++") {
        LIB_PATH=aarch64-linux
    }
    
    INCLUDEPATH += $$CUDA_DIR/targets/$$LIB_PATH/include
    QMAKE_LIBDIR += $$CUDA_DIR/targets/$$LIB_PATH/lib
    LIBS += -L $$CUDA_DIR/targets/$$LIB_PATH/lib -lcudart -lcuda
    
    CONFIG(debug, debug|release) { #debug
        cuda_d.commands = $$CUDA_DIR/bin/nvcc -ccbin $$HOST_COMPILER -D_DEBUG $$NVCC_OPTIONS -m64  -arch=$$CUDA_ARCH -c -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
        cuda_d.dependency_type = TYPE_C
        cuda_d.input = CUDA_SOURCES
        cuda_d.output = cuda/${QMAKE_FILE_BASE}.o
        QMAKE_EXTRA_COMPILERS += cuda_d
    } else { #release
        cuda.commands = $$CUDA_DIR/bin/nvcc -ccbin $$HOST_COMPILER $$NVCC_OPTIONS -m64 -arch=$$CUDA_ARCH -c -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
        cuda.dependency_type = TYPE_C
        cuda.input = CUDA_SOURCES
        cuda.output = cuda/${QMAKE_FILE_BASE}.o
        QMAKE_EXTRA_COMPILERS += cuda
    }
    ...
    

    Everything works fine, so I can compile and run the code.
    But Qt creator show me semantic issue (see in the picture):

    use of undeclared identifier blockDim, blockIdx and threadIdx
    

    although the compile was successful.

    It looks like indexer or I don't know issues.
    Please can you help me how to remove this "cometics" problem.
    Thank you

    cuda_semantic_issues.png

    aha_1980A 1 Reply Last reply
    0
    • K kubikula

      Hi,
      I try to compile simple CUDA code with qt creator.
      In .pro file I use this code

      ...
      SOURCES += \
              main.cpp
      
      CUDA_DIR = /usr/local/cuda-10.0
      CUDA_SOURCES +=  cuda_functions.cu
      CUDA_ARCH = sm_53
      NVCC_OPTIONS = --use_fast_math
      HOST_COMPILER=$$QMAKE_CXX
      LIB_PATH=x86_64-linux
      
      equals(HOST_COMPILER, "aarch64-linux-gnu-g++") {
          LIB_PATH=aarch64-linux
      }
      
      INCLUDEPATH += $$CUDA_DIR/targets/$$LIB_PATH/include
      QMAKE_LIBDIR += $$CUDA_DIR/targets/$$LIB_PATH/lib
      LIBS += -L $$CUDA_DIR/targets/$$LIB_PATH/lib -lcudart -lcuda
      
      CONFIG(debug, debug|release) { #debug
          cuda_d.commands = $$CUDA_DIR/bin/nvcc -ccbin $$HOST_COMPILER -D_DEBUG $$NVCC_OPTIONS -m64  -arch=$$CUDA_ARCH -c -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
          cuda_d.dependency_type = TYPE_C
          cuda_d.input = CUDA_SOURCES
          cuda_d.output = cuda/${QMAKE_FILE_BASE}.o
          QMAKE_EXTRA_COMPILERS += cuda_d
      } else { #release
          cuda.commands = $$CUDA_DIR/bin/nvcc -ccbin $$HOST_COMPILER $$NVCC_OPTIONS -m64 -arch=$$CUDA_ARCH -c -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
          cuda.dependency_type = TYPE_C
          cuda.input = CUDA_SOURCES
          cuda.output = cuda/${QMAKE_FILE_BASE}.o
          QMAKE_EXTRA_COMPILERS += cuda
      }
      ...
      

      Everything works fine, so I can compile and run the code.
      But Qt creator show me semantic issue (see in the picture):

      use of undeclared identifier blockDim, blockIdx and threadIdx
      

      although the compile was successful.

      It looks like indexer or I don't know issues.
      Please can you help me how to remove this "cometics" problem.
      Thank you

      cuda_semantic_issues.png

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by aha_1980
      #2

      Hi @kubikula,

      most likely the Code Model has problems parsing a header file.

      Where do these definitions actually come from? Are there more errors when you open the header file containing these definitions?

      Regards

      Qt has to stay free or it will die.

      1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        AFAIR, these come directly from CUDA. Therefore I am not sure that the clang code model is ready for CUDA kernel code.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        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