目录
概述
首先先通过一个简单的demo来演示cuda编程是怎么进行的。
cmake代码:
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(helloC++)
find_package(CUDA REQUIRED)
include_directories(${PROJECT_SOURCE_DIR}/include) # 通过源码根目录来定位include2
cuda_add_executable (helloworld helloworld.cpp addition.cu)
注意添加了include文件夹,cmake写法要注意:
include_directories(include1) # 注意当前CMakeLists.txt和include1相对路径关系, 此时必须是在同一个目录下
include_directories(${PROJECT_SOURCE_DIR}/include2) # 通过源码根目录来定位include2
头文件代码:
修饰符extern