Qt creator with CUDA show Semantic Issue

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

    SOURCES += \
    CUDA_DIR = /usr/local/cuda-10.0
    CUDA_SOURCES +=  cuda_functions.cu
    CUDA_ARCH = sm_53
    NVCC_OPTIONS = --use_fast_math
    equals(HOST_COMPILER, "aarch64-linux-gnu-g++") {
    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

    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


  • Lifetime Qt Champion

    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?


  • Lifetime Qt Champion


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

Log in to reply