3

nvcc コンパイラの使用に問題があります。nvcc 4.2 を使用してコンパイルされたホスト コードは、g++ 4.4.6 を使用してコンパイルされた同じコードよりも約 5 倍遅く実行されることがわかりました。NVIDIA SDK Makefile テンプレートを使用して、リリース構成でコードをコンパイルしています。どちらの場合も -O2 最適化が使用されます。nvcc はホスト コードをホスト コンパイラに渡す必要があるため、これはどうすればよいでしょうか。何か案は?

これは私のメイクファイルです:

# 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
4

1 に答える 1

1

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.

于 2012-07-31T15:48:50.203 に答える