CUDA on Qt
-
Integrated .cpp and .cu files, giving errors like
error: undefined reference to__imp__ZN16QCoreApplicationC1ERiPPci', error: undefined reference to
__imp__ZN16QCoreApplication4execEv',
error: undefined reference to__imp__ZN16QCoreApplicationD1Ev', error: undefined reference to
__imp__ZN16QCoreApplicationD1Ev'
in main.cpp file.I am using Qt Creator 4.0.3 , cuda 7.5 on windows 10(64 bit)
I m uploading the .pro file here
TARGET=cuda-qt-integration # project build directories DESTDIR = ./ OBJECTS_DIR = $$DESTDIR/Obj/ #Enter your gencode here! GENCODE = arch=compute_52,code=sm_52 # as I want to support 4.8 and 5 this will set a flag for some of the mac stuff # mainly in the types.h file for the setMacVisual which is native in Qt5 isEqual(QT_MAJOR_VERSION, 5) { cache() DEFINES +=QT5BUILD } MOC_DIR=moc QT += core QT -= gui CONFIG += c++11 TARGET = cuda-qt-integration CONFIG += console CONFIG -= app_bundle TEMPLATE = app VPATH += ./ SOURCES += main.cpp INCLUDEPATH +=./include !win32:{ INCLUDEPATH+= /opt/local/include LIBS += -L/opt/local/lib -lGLEW } DEFINES += _USE_MATH_DEFINES #in on mac define DARWIN macx:DEFINES+=DARWIN win32:{ DEFINES+=WIN32 DEFINES+=_WIN32 DEFINES += GLEW_STATIC INCLUDEPATH+=C:/boost LIBS+= -lopengl32 #-lglew32s #LIBS+= -L"C:/Program Files (x86)/NVIDIA Corporation/Nsight Visual Studio Edition 4.7/Monitor/glew/lib" -lglew32s } # basic compiler flags (not all appropriate for all platforms) QMAKE_CXXFLAGS+= -msse -msse2 -msse3 # use this to suppress some warning from boost unix*:QMAKE_CXXFLAGS_WARN_ON += "-Wno-unused-parameter" #---------------------------------------------------------------- #-------------------------Cuda setup----------------------------- #---------------------------------------------------------------- #Enter your gencode here! GENCODE = arch=compute_52,code=sm_52 #We must define this as we get some confilcs in minwindef.h and helper_math.h DEFINES += NOMINMAX #set out cuda sources CUDA_SOURCES = "$$PWD"/host_sw.cu #This is to add our .cu files to our file browser in Qt SOURCES+= host_sw.cu SOURCES-= host_sw.cu # Path to cuda SDK install macx:CUDA_DIR = /Developer/NVIDIA/CUDA-6.5 linux:CUDA_DIR = /usr/local/cuda-6.5 win32:CUDA_DIR = "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v7.5" # Path to cuda toolkit install macx:CUDA_SDK = /Developer/NVIDIA/CUDA-6.5/samples linux:CUDA_SDK = /usr/local/cuda-6.5/samples win32:CUDA_SDK = "C:/ProgramData/NVIDIA Corporation/CUDA Samples/v7.5" #Cuda include paths INCLUDEPATH += $$CUDA_DIR/include #INCLUDEPATH += $$CUDA_DIR/common/inc/ #INCLUDEPATH += $$CUDA_DIR/../shared/inc/ #To get some prewritten helper functions from NVIDIA win32:INCLUDEPATH += $$CUDA_SDK/common/inc #cuda libs macx:QMAKE_LIBDIR += $$CUDA_DIR/lib linux:QMAKE_LIBDIR += $$CUDA_DIR/lib64 win32:QMAKE_LIBDIR += $$CUDA_DIR/lib/x64 linux|macx:QMAKE_LIBDIR += $$CUDA_SDK/common/lib win32:QMAKE_LIBDIR +=$$CUDA_SDK/common/lib/x64 LIBS += -lcudart -lcudadevrt -lcuda # join the includes in a line CUDA_INC = $$join(INCLUDEPATH,'" -I"','-I"','"') # nvcc flags (ptxas option verbose is always useful) NVCCFLAGS = --compiler-options -fno-strict-aliasing --ptxas-options=-v -maxrregcount 20 --use_fast_math #On windows we must define if we are in debug mode or not CONFIG(debug, debug|release) { #DEBUG # MSVCRT link option (static or dynamic, it must be the same with your Qt SDK link option) win32:MSVCRT_LINK_FLAG_DEBUG = "/MDd" win32:NVCCFLAGS += -D_DEBUG -Xcompiler $$MSVCRT_LINK_FLAG_DEBUG } else{ #Release UNTESTED!!! win32:MSVCRT_LINK_FLAG_RELEASE = "/MD" win32:NVCCFLAGS += -Xcompiler $$MSVCRT_LINK_FLAG_RELEASE } #prepare intermediat cuda compiler cudaIntr.input = CUDA_SOURCES cudaIntr.output = ${OBJECTS_DIR}${QMAKE_FILE_BASE}.o #So in windows object files have to be named with the .obj suffix instead of just .o #God I hate you windows!! win32:cudaIntr.output = $$OBJECTS_DIR/${QMAKE_FILE_BASE}.obj ## Tweak arch according to your hw's compute capability cudaIntr.commands = $$CUDA_DIR/bin/nvcc -m64 -g -gencode $$GENCODE -dc $$NVCCFLAGS $$CUDA_INC $$LIBS ${QMAKE_FILE_NAME} -o ${QMAKE_FILE_OUT} #Set our variable out. These obj files need to be used to create the link obj file #and used in our final gcc compilation cudaIntr.variable_out = CUDA_OBJ cudaIntr.variable_out += OBJECTS cudaIntr.clean = cudaIntrObj/*.o win32:cudaIntr.clean = cudaIntrObj/*.obj QMAKE_EXTRA_UNIX_COMPILERS += cudaIntr # Prepare the linking compiler step cuda.input = CUDA_OBJ cuda.output = ${QMAKE_FILE_BASE}_link.o win32:cuda.output = ${QMAKE_FILE_BASE}_link.obj # Tweak arch according to your hw's compute capability cuda.commands = $$CUDA_DIR/bin/nvcc -m64 -g -gencode $$GENCODE -dlink ${QMAKE_FILE_NAME} -o ${QMAKE_FILE_OUT} cuda.dependency_type = TYPE_C cuda.depend_command = $$CUDA_DIR/bin/nvcc -g -M $$CUDA_INC $$NVCCFLAGS ${QMAKE_FILE_NAME} # Tell Qt that we want add more stuff to the Makefile QMAKE_EXTRA_UNIX_COMPILERS += cuda
please help me to sort out the issue
Thanks
-
Hi @Maithri ,
error: undefined reference to __imp__ZN16QCoreApplicationC1ERiPPci', error: undefined reference to__imp__ZN16QCoreApplication4execEv',
AFAIK, this is because of using the different bit version. You might be using 32 bit version to build 64 bit application. Please check the versions.
-
Hi @Maithri ,
error: undefined reference to __imp__ZN16QCoreApplicationC1ERiPPci', error: undefined reference to__imp__ZN16QCoreApplication4execEv',
AFAIK, this is because of using the different bit version. You might be using 32 bit version to build 64 bit application. Please check the versions.
-
I Changed it to 64 bit version, now I am facing problem with
**error: file not recognized: File format not recognized ** for cuda object(.obj) file -
For this error:
**error: file not recognized: File format not recognized ** for cuda object(.obj) fileChange the include path and lib path to following style and delete the build folder and .pro.user file, rebuild:
INCLUDEPATH +="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v7.5/include"
macx:QMAKE_LIBDIR += "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v7.5/lib"
linux:QMAKE_LIBDIR += "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v7.5/lib64"
win32:QMAKE_LIBDIR += "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v7.5/lib/x64"I met similar problem in win 7, not sure about win 10.
-
These are the settings in my .pro file with win 7. I don't have win 10.
For your reference:# CUDA with Windows #CUDA_DIR = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5" CUDA_DIR = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0" SYSTEM_NAME = x64 # Depending on your system either 'Win32', 'x64', or 'Win64' SYSTEM_TYPE = 64 # '32' or '64', depending on your system CUDA_ARCH = sm_52 # Type of CUDA architecture, for example 'compute_10', 'compute_11', 'sm_10' NVCC_OPTIONS = --use_fast_math # default setting #include paths #INCLUDEPATH += $$CUDA_DIR\include #INCLUDEPATH += "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\include" INCLUDEPATH += "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include" #library directories #QMAKE_LIBDIR += $$join(CUDA_DIR,'" -I"','-I"','"')\lib\$$SYSTEM_NAME #QMAKE_LIBDIR += "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\lib\x64" QMAKE_LIBDIR += "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64" CUDA_LIBS = -lcuda -lcudart -lcufft CUDA_INC += $$join(INCLUDEPATH,'" -I"','-I"','"') LIBS += $$CUDA_LIBS # MSVCRT link option (static or dynamic, it must be the same with your Qt SDK link option) MSVCRT_LINK_FLAG_DEBUG = "/MDd" MSVCRT_LINK_FLAG_RELEASE = "/MD" CONFIG(debug, debug|release){ cuda_d.input = CUDA_SOURCES cuda_d.output = ${QMAKE_FILE_BASE}_cuda.obj cuda_d.commands = $$CUDA_DIR/bin/nvcc.exe -D_DEBUG $$NVCC_OPTIONS $$CUDA_INC $$LIBS \ --machine $$SYSTEM_TYPE -arch=$$CUDA_ARCH \ --compile -cudart static -g -DWIN32 -D_MBCS \ -Xcompiler "/wd4819,/EHsc,/W3,/nologo,/Od,/Zi,/RTC1" \ -Xcompiler $$MSVCRT_LINK_FLAG_DEBUG \ -c -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME} cuda_d.dependency_type = TYPE_C QMAKE_EXTRA_COMPILERS += cuda_d } else { # Release settings cuda.input = CUDA_SOURCES cuda.output = ${QMAKE_FILE_BASE}_cuda.obj cuda.commands = $$CUDA_DIR/bin/nvcc.exe $$NVCC_OPTIONS $$CUDA_INC $$LIBS \ --machine $$SYSTEM_TYPE -arch=$$CUDA_ARCH \ --compile -cudart static -DWIN32 -D_MBCS \ -Xcompiler "/wd4819,/EHsc,/W3,/nologo,/O2,/Zi" \ -Xcompiler $$MSVCRT_LINK_FLAG_RELEASE \ -c -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME} cuda.dependency_type = TYPE_C QMAKE_EXTRA_COMPILERS += cuda }
-
Thanks for the support,
Compilation problems got solved, now getting run time error
D:\maithri_MODD\CUDA_QT_5.7\build-cuda-qt-integration-GCC-Debug\cuda-qt-integration.exe exited with code -1073741515
@Maithri said in CUDA on Qt:
exited with code -1073741515
Hi
If you start in debug mode and place breakpoint at main()Do you get to the BP before the error ?
or does error just comes at once and main never reached?
-
hello,
if I run it in debug mode, it's not reaching breakpoint and giving some other error.
I have attached error msg and main.cpp code
Thanks
[Fixed images' URLs ~kshegunov]
@Maithri
Super but picture upload is broken here and I cant see it.
Can you please use external site and post links here.
Oh you did, for some reason they are not shown.
http://pasteboard.co/jvoRueubz.png
http://pasteboard.co/jvqX5yI1J.pngI am not huge Visual Studio user but this error
-1073741515 == 0xC0000135
and that should mean STATUS_DLL_NOT_FOUNDSo maybe it needs some Dlls it cant find? Maybe some cuda ones?
If you have an idea which one it could be, then try copy them to the build folder next to the exe and try to
run again ( from editor) (Double clicking on EXE is 100% other matter so please dont do that)Alternatively, download
http://www.dependencywalker.com/It shows which dlls it will try to load and from where. that can also give hints.
So you will simply install it and open the .exe in it. it then shows all all it uses.
This tool is a bit confusing at first but gives great insight in what dlls being needed. -
main.cpp and error message
http://pasteboard.co/jvqX5yI1J.png
http://pasteboard.co/jvtvlRcWF.png -
main.cpp and error message
http://pasteboard.co/jvqX5yI1J.png
http://pasteboard.co/jvtvlRcWF.pngMy best guess would it just wants some DLLS from cuda.
Something like
Projects- > Build & Run" tab
"Run Settings" (chosen in the "Kit") For you is VS 64 bit !
"Run Environment" > "Details" > PATH
and see if it has paths to where cuda DLLS are. ( if such exists :)
-
hi @mrjj ,
using the dependency walker figer out that the .exe file depends on so many dll files, I have given the path for the available dll's but still the problem exist .
Following are some of dll's which are not available in the system,
API-MS-WIN-CORE-HEAP-L2-1-0.DLL
API-MS-WIN-CORE-LIBRARYLOADER-L1-2-0.DLL
API-MS-WIN-CORE-APIQUERY-L1-1-0.DLL
API-MS-WIN-CORE-APPCOMPAT-L1-1-1.DLL
API-MS-WIN-CORE-APPINIT-L1-1-0.DLL
API-MS-WIN-CORE-ATOMS-L1-1-0.DLL
API-MS-WIN-CORE-COM-L1-1-1.DLL........................... -
hi @mrjj ,
using the dependency walker figer out that the .exe file depends on so many dll files, I have given the path for the available dll's but still the problem exist .
Following are some of dll's which are not available in the system,
API-MS-WIN-CORE-HEAP-L2-1-0.DLL
API-MS-WIN-CORE-LIBRARYLOADER-L1-2-0.DLL
API-MS-WIN-CORE-APIQUERY-L1-1-0.DLL
API-MS-WIN-CORE-APPCOMPAT-L1-1-1.DLL
API-MS-WIN-CORE-APPINIT-L1-1-0.DLL
API-MS-WIN-CORE-ATOMS-L1-1-0.DLL
API-MS-WIN-CORE-COM-L1-1-1.DLL...........................Those are normal. Shown as missing most of the time-
I was more after some CUDA dlls or something it need for this project.Also click on those CUDA dlls it have and see if those have indirectly a need for a dll it cant find.
-
main.cpp and error message
http://pasteboard.co/jvqX5yI1J.png
http://pasteboard.co/jvtvlRcWF.png@Maithri said in CUDA on Qt:
main.cpp and error message
http://pasteboard.co/jvqX5yI1J.png
http://pasteboard.co/jvtvlRcWF.pngIn addition to Mr. @mrjj .
Usually, this debug error is caused due to mismatach of the bit version. Earlier , even I have faced the same problem . Please check that you are using the right cdb.exe (32 bit or 64 bit). Check here to configure the debug
CDB Process terminated unexpectedly
you can find your 64 bit path of cdb here (Win10)
C:\Program Files (x86)\Windows Kits\8.1\Debuggers\x64\cdb.exe
If still, does not run, check all the required dll's you have them or not. (not the general windows dll's).
Does it run fine in release mode ?
-
@Maithri said in CUDA on Qt:
main.cpp and error message
http://pasteboard.co/jvqX5yI1J.png
http://pasteboard.co/jvtvlRcWF.pngIn addition to Mr. @mrjj .
Usually, this debug error is caused due to mismatach of the bit version. Earlier , even I have faced the same problem . Please check that you are using the right cdb.exe (32 bit or 64 bit). Check here to configure the debug
CDB Process terminated unexpectedly
you can find your 64 bit path of cdb here (Win10)
C:\Program Files (x86)\Windows Kits\8.1\Debuggers\x64\cdb.exe
If still, does not run, check all the required dll's you have them or not. (not the general windows dll's).
Does it run fine in release mode ?