Is there any findCuda.cmake step by step tutorial?

Hi guys,

I heard about this findCuda.cmake as well as cmake recently. And most of you reported it worked!

I downloaded it from FindCuda site and installed cmake under Windows Vista and Linux (ubuntu 9.04). Now I have no clue what to do.

Here are what I have tried:

Linux:

go to FindCuda/CMAKE/;

sudo cmake …;

sudo make;

sudo make install; (this gives me error: no install target specified)

After that i dont know what to do

Windows

  1. installed cmake;

  2. open cmake-gui.exe;

  3. “Where is the source code” xxx/xxx/FindCUDA/src;

  4. “Where to build the binaries” xxx/xxx/FindCUDA;

  5. Configure, I chose VS2008 64 bit/VS 2008 or Eclipse CDT4 xxx, they all give me error CMake Error at CMakeLists.txt:7 (CUDA_INCLUDE_DIRECTORIES):

Unknown CMake command “CUDA_INCLUDE_DIRECTORIES”

What should I do now? I think I really need some step by step tutorial to get started.

I real apprieciate your help! Thanks in advance!

UPDATES:

I re-downloaded the FindCUDA under VISTA 64 bit, and used CMake2.6.4.

This time I put the source code dir: “C:/CUDA/FindCUDA” (since the CMakeLists.txt is in this dir)

            and the build dir as:       "C:/CUDA/FindCUDA/build"

Then Configure. I chose Visual Studio 9 2008 Win64.

This time no error came out, :haha: and then kept all red values unchanged (all of them were correct for my case). Clicked configure again and Generate.

All files generated. :yes:

But now, I could load it into the VS and built without any problem.

Could anyone tell me how to use the produced VS project? And how can i use it to apply to my own project? Thanks!

Just open the project “projectname”.sln and edit source files and compile any target you wish with the normal VS build commands.

It can be as simple as putting the FindCUDA.cmake files in your project directory and:

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake/cuda")

find_package(Cuda)

cuda_add_executable(executable_name source1.cpp source2.cpp source3.cu)

I opened it and found there were a lot of stuff in the project. “ALL_BUILD”,“CLEAN_CUDA_DEPENDS”,“cuda_compile_example”,“lib_example”,“test”,“test_lib”,“ZERO_CHECK”

I have no idea where they came from. I just expect to see “test

Even in the “test” there are extra stuff in there, such as CMakeLists.txt, CMake_Rules.

So my questions are:

  1. Which files should I exclude them from the project?

  2. And I checked the project properties, found $(NVSDKCUDA_ROOT)/commom/inc dir is missing, and the cutil64D.lib was not included as well. Did i do anything wrong in the FindCuda.cmake step?

Yeah, those are extra build rules generated by CMake. You can build ALL_BUILD to compile all default targets. Or you can choose your target (i.e. test) and just build that. All dependancies are added automatically. Just ignore the extra junk like CLEAN_CUDA_DEPENDS and ZERO_CHECK. I think CMakeLists.txt is added to the project as a convenience so you can edit in VS without having to hunt down the file.

You don’t have to exclude anything. CMake should generate a fully working project.

I beat tmurray: DON’T USE CUTIL!!! It is not designed or intended to be used by application developers.

However, in general you do have to tell CMake what libraries to link to. It cannot determine that automatically. So if target “test” needs to be linked to /opt/myfavlib/lib/lib.a, then just use the command:

target_link_libraries(test /opt/myfavlib/lib/lib.a)

However, do note that a majority of CMake is built to make finding where library files are easy so you don’t have to hard code locations and it will thus build on anyones computer. But this is getting into CMake specific stuff, so I would suggest the CMake tutorial, the manual, or the CMake mailing list for more info.

Tutorial:

http://www.cmake.org/cmake/help/runningcmake.html

http://www.cmake.org/cmake/help/syntax.html

http://www.cmake.org/cmake/help/examples.html

Documentation:

http://www.cmake.org/cmake/help/cmake2.6docs.html

List of libraries CMake knows how to find:

http://www.cmake.org/cmake/help/cmake2.6do…CMake%20Modules

I have a DSP code on C, and now want to port it to CUDA, but also can’t understand, what to do. I’m on KUbuntu 9.04 using Eclipse CDT. Please, tell me, how to use FindCUDA to generate project for Eclipse with CMake CDT4Generator? I’ve downloaded CMake 2.8 and FindCUDA too.
Please.help me.

Does anybody have a manual or link,or advice?

Did you read the post where I linked to all the manuals and tutorials? Did you read the very brief example I wrote? What more do you need?

FYI, if you download and use a CMake 2.8.0 release candidate, the latest FindCUDA.cmake comes with it. Documentation here:

http://www.cmake.org/cmake/help/cmake-2-8-…module:FindCUDA

In addition to all the helpful information that MisterAnder42 has provided on the forums there is a simple example of how to use FindCUDA in a CMake script. It can be found in the svn repository where I keep my simple test system used for developement:

svn checkout https://code.sci.utah.edu/svn/findcuda/trunk FindCUDA

There’s an html file (which is slightly outdated) and an example project.

Note that I’ve never generated an eclipse project from CMake, so there may be some bugs when using that generator. Please let us know on this forum if you encounter any problems.