我正在为某人写得非常糟糕的项目而苦苦挣扎,我正试图尽快编译它……(最好的方法是正确地做到这一点,但时间是个问题)……不管怎样,他们似乎已经写了这个使用较旧的 API,其中 #include <cuda.h>
允许您访问 api 函数。
API 函数似乎已移至其他 header 和 #include <cuda.h>
已经不够了。我该怎么办:
- 包含cuda_runtime_api.h等头文件
- 用 nvcc 编译这个 cpp(没有内核函数调用)?
TIA
最佳答案
例如:
#include <cstdlib>
#include <stdio.h>
// includes CUDA Runtime
#include <cuda_runtime.h>
// maybe you need also helpers
#include <helper_cuda.h>
#include <helper_functions.h> // helper utility functions
你需要添加
/usr/local/cuda-5.0/bin/nvcc
作为 C++ Compiler -> Tool
还。适用于 g++ 4.4
在你的.cu
然后你需要的文件 #include <curand_kernel.h>
如果您使用 CURAND library
正如罗伯特·克罗维拉所说:
You should not need to explicitly include cuda.h if you are only using the cuda runtime API to access CUDA functionality. If you are using the driver API, things are different.
关于c++ - CUDA 5.0 头文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16592738/