【问题标题】:cudaMallocManaged() returns "operation not supported"cudaMallocManaged() 返回“不支持操作”
【发布时间】:2014-05-12 11:09:57
【问题描述】:

在调用 cudaMallocManaged() 时,在 CUDA 6.0 中试用托管内存给了我 operation not supported。

#include "cuda_runtime.h"

#include <stdio.h>

#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),使用 CUDA 6.0 使用 compute_50,sm_50 编译。 Windows 7 64 位。使用驱动程序 335.23 (whql) 和 337.50 (beta) 进行测试。 Visual Studio 2012。尝试了 32 位调试和发布版本。

C:\rd\projects\cpp\test_cuda6\test_cuda6>"C:\Program 文件\NVIDIA GPU 计算工具包\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\包括" --keep-dir 发布 -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() 工作的任何想法?

【问题讨论】:

    标签: cuda


    【解决方案1】:

    尝试了 32 位调试和发布版本。

    使用 64 位调试或发布版本。

    来自the documentation:

    J.1.4。系统要求

    统一内存有三个基本要求:

    •具有 SM 架构 3.0 或更高版本(Kepler 类或更高版本)的 GPU

    • 64 位主机应用程序和操作系统,Android 除外

    •Linux 或 Windows

    64 位主机应用程序意味着您无法针对 32 位调试或发布版本进行编译。

    【讨论】:

    • 呵呵——通读系统要求,完全错过了 64 位应用程序要求。这是我第一次遇到需要 64 位构建的东西。你知道技术原因吗?再次感谢你的帮助。一如既往地受到赞赏。
    • UM 需要跨系统中所有 GPU 和 CPU just like UVM/UA 的统一地址空间。这在 64 位空间中更容易实现。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-11-27
    • 1970-01-01
    • 1970-01-01
    • 2018-03-29
    • 1970-01-01
    • 1970-01-01
    • 2017-11-09
    相关资源
    最近更新 更多