在CUDA 6.0中尝试使用托管内存可以在operation not supported
调用时提供给我cudaMallocManaged()
.
#include "cuda_runtime.h" #include#define CHECK(r) {_check((r), __LINE__);} void _check(cudaError_t r, int line) { if (r != cudaSuccess) { printf("CUDA error on line %d: %s\n", line, cudaGetErrorString(r), line); exit(0); } } int main() { int *c; CHECK(cudaMallocManaged(&c, sizeof(int))); *c = 0; return 0; }
GeForce GTX 750 Ti(Maxwell),使用compute_50,sm_50与CUDA 6.0编译.Windows 7 64位.使用驱动程序335.23(whql)和337.50(beta)进行测试.Visual Studio 2012.尝试过32位调试和发布版本.
C:\ rd\projects\cpp\test_cuda6\test_cuda6>"C:\ Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.0\bin \nvcc.exe"-gencode = arch = compute_50,code = \"sm_50, compute_50 \" - use-local-env --cl-version 2012 -ccbin"C:\ Program Files(x86)\ Microsoft Visual Studio 11.0\VC\bin"-I\C\common\inc -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.0\include"-I"C:\ Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.0\include"--keep-dir Release -maxrregcount = 0 - -machine 32 --compile -cudart static -DWIN32 -DNDEBUG -D_CONSOLE -D_MBCS -Xcompiler"/ EHsc/W3/nologo/O2/Zi/MD"-o Release\kernel.cu.obj"C:\ rd\projects\CPP\test_cuda6\test_cuda6\kernel.cu"
如果我替换cudaMallocManaged()
,程序运行没有错误cudaMalloc()
.
关于如何cudaMallocManaged()
工作的任何想法?