Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cudaMallocManaged() returns "operation not supported"

Tags:

cuda

Trying out managed memory in CUDA 6.0 gives me operation not supported when calling cudaMallocManaged().

#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), compiled with CUDA 6.0 using compute_50,sm_50. Windows 7 64-bit. Tested with drivers 335.23 (whql) and 337.50 (beta). Visual Studio 2012. Tried 32-bit debug and release builds.

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"

The program runs without error if I replace cudaMallocManaged() with cudaMalloc().

Any ideas on how to get cudaMallocManaged() working?

like image 687
Roger Dahl Avatar asked May 12 '14 02:05

Roger Dahl


1 Answers

Tried 32-bit debug and release builds.

Use a 64 bit debug or release build.

From the documentation:

J.1.4. System Requirements

Unified Memory has three basic requirements:

•a GPU with SM architecture 3.0 or higher (Kepler class or newer)

•a 64-bit host application and operating system, except on Android

•Linux or Windows

64 bit host application means you cannot compile for a 32 bit debug or release build.

like image 196
Robert Crovella Avatar answered Nov 05 '22 07:11

Robert Crovella