Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CUDA nvcc slow host code

Tags:

cuda

nvcc

I have a problem using the nvcc compiler. I found out that host code compiled using nvcc 4.2 runs about 5 times slower than the same code compiled using g++ 4.4.6. I am using the NVIDIA SDK Makefile template to compile the code in release configuration. In both cases the -O2 optimization is used. How can this be, since the nvcc should pass the host code to the host compiler. Any ideas?

This is my makefile:

# Add source files here
EXECUTABLE  := App
verbose=1
# C/C++ source files (compiled with gcc / c++)
CCFILES     := \
    cmdl.cpp main.cpp
# Cuda source files (compiled with cudacc)
CUFILES_sm_30       := AppCuda.cu AppHost.cpp 

# Do not link with CUTIL
OMIT_CUTIL_LIB := 1

################################################################################
# Rules and targets
ROOTDIR=/home/snpsyn/NVIDIA_GPU_Computing_SDK/C/common
include $(ROOTDIR)/../common/common.mk
like image 676
ECHO001 Avatar asked Jun 19 '26 19:06

ECHO001


1 Answers

There should be no difference in compiling c++ code with nvcc or g++ (CUDA compiler driver)

But try compiling all c++ code with g++ directly. In the example you gave, the AppHost.cpp file is being passed to nvcc and not g++.

It would help a lot if you could provide the source code and makefile.

like image 89
rda Avatar answered Jun 21 '26 10:06

rda