cmake and emulation mode

Hi all. I am new in CUDA, and this is my first post here.

I am using the findCuda script for merging some CUDA code with an existing c++ code using cmake. I use Ubuntu Linux 8.04 and my graphics card is an Nvidia Quadro 4600 FX.

My problem is that the executable is always running in emulation mode, even if CUDA_BUILD_TYPE is set to Device

I have several CMakeLists.txt files, The one in the base directory the relevant lines there are:

CMAKE_MINIMUM_REQUIRED(VERSION 2.4)

PROJECT(mytest)

ENABLE_TESTING()

INCLUDE(${CMAKE_SOURCE_DIR}/CMake/cuda/FindCuda.cmake)

ADD_SUBDIRECTORY(cpp)

ADD_SUBDIRECTORY(cuda)

In the cpp directory the CMakeLists.txt file looks like

ADD_DEFINITIONS(-DTHIS_SOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\")

ADD_LIBRARY(mylib_cpp mylib_cpp.cc)

And in the cuda directory it is something like:

SET(CUDA_BUILD_TYPE Device)

ADD_DEFINITIONS(-DTHIS_SOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\")

CUDA_ADD_LIBRARY(mylib_cuda 

  mylib_cuda.cu

  mylib_cuda_kernels.cu

)

CUDA_ADD_EXECUTABLE(mylib_test mylib_test.cu

  )

TARGET_LINK_LIBRARIES(mylib_test 

                      mylib_cpp

                      mylib_cuda

)

The code is compiling and the executable does what it is intended to do. The problem is that I am not able to run it in Device mode. I don’t think that it is a matter of linux permissions (I have changed them to 666 and ran the code with sudo).

Thanks for your help

Regards

According to Abe stephens, the author of FindCuda script, the CUDA_BUILD_TYPE must be set with “Device” with a CAPITAL ‘D’. Otherwise, it would still run in Emulation only!

Check that out.

Also, if you had set “Device” in CMAKE-GUI then you better do a “configure” and “generate” from GUI itself – otherwise your changes will not reflect in CMakeCache.txt.

Also check CMakeCache.txt to see what exactly is set for “CUDA_BUILD_TYPE”

And, you can always hack FindCuda to do some “MESSAGE” to console – so you know which control path it is taking.

Good Luck

Thank you Sarnath. The capital ‘D’ was ok but the point was that the quotation marks were missing, and it was always defaulting to emulation mode.

Regards,