Cuda dll封装
2016-04-13 11:02
363 查看
新建Cuda工程 –Cuda 7.5 Runtime
项目-右键属性-配置属性 修改配置类型为dll。
添加一个头文件和一个cpp文件。
test.h test.cpp
test.h :
test.cpp
包含目录啥的都不需要配置。生成即可得到dll库。
项目-右键属性-配置属性 修改配置类型为dll。
添加一个头文件和一个cpp文件。
test.h test.cpp
test.h :
#ifndef CUDA_TEST_H #define CUDA_TEST_H __declspec(dllexport) int GetGPUCount(void); #endif
test.cpp
#include "test.h" #include <cuda_runtime.h> #pragma comment(lib,"cuda_static.lib") int GetGPUCount(void){ int deviceCount = 0; cudaError_t error_id = cudaGetDeviceCount(&deviceCount); if(error_id != cudaSuccess){ printf("cudaGetDeviceCount returned %d\n->%s\n",(int)error_id,cudaGetErrorString(error_id)); return 0; } return deviceCount; }
包含目录啥的都不需要配置。生成即可得到dll库。
相关文章推荐
- MATLAB NN中train和adapt区别
- RSqlBuilder
- jms之activeQM
- 两种方法使用for循环动态创建按钮(类似九宫格)
- Runloop循环机制
- React Native 代码规范
- ViewTreeObserver的使用
- java.lang.IllegalStateException: Cannot forward after response has been committed
- Java数据类型和MySql数据类型对应表
- Velocity配置详解(三)
- Android之WebView加载网页
- MySQL存储过程
- 存储过程-求当前日期是这个月的第几周
- seajs官方文档地址
- 权限和特征的对应
- 数据存储全方案-文件存储、sharedPreferences、sqlite
- ubuntu下swoole安装
- dyld: Library not loaded: @rpath/libswiftCore.dylib 错误的解决
- 401,404的布尔值居然是False,又被坑了
- 二叉树的非递归遍历算法